mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-31 03:04:11 +03:00
Turn the init.d scripts into autoconf config files
This change ensures the paths used by the provided init scripts always reference the prefixes provided at configure time. The @sbindir@ and @sysconfdir@ prefixes will be correctly replaced at build time. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #336
This commit is contained in:
committed by
Brian Behlendorf
parent
7f4afd300b
commit
5faa9c0367
@@ -0,0 +1,95 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# zfs This shell script takes care of starting (mount) and
|
||||
# stopping (umount) zfs shares.
|
||||
#
|
||||
# chkconfig: 35 60 40
|
||||
# description: ZFS is a filesystem developed by Sun, ZFS is a
|
||||
# combined file system and logical volume manager
|
||||
# designed by Sun Microsystems. Made available to Linux
|
||||
# using SPL (Solaris Porting Layer) by zfsonlinux.org.
|
||||
# probe: true
|
||||
|
||||
ZFS="@sbindir@/zfs"
|
||||
ZPOOL="@sbindir@/zpool"
|
||||
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
|
||||
|
||||
case $1 in
|
||||
start) echo "$1ing ZFS filesystems"
|
||||
|
||||
# Delay until all required block devices are present.
|
||||
udevadm settle
|
||||
|
||||
if ! grep "zfs" /proc/modules > /dev/null; then
|
||||
echo "ZFS kernel module not loaded yet; loading...";
|
||||
if ! modprobe zfs; then
|
||||
echo "Failed to load ZFS kernel module...";
|
||||
exit 0;
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [ `uname -m` == "x86_64" ]; then
|
||||
echo "Warning: You're not running 64bit. Currently native zfs in";
|
||||
echo " linux is only supported and tested on 64bit.";
|
||||
# should we break here? People doing this should know what they
|
||||
# do, thus i'm not breaking here.
|
||||
fi
|
||||
|
||||
# mount the filesystems
|
||||
while IFS= read -r -d $'\n' dev; do
|
||||
mdev=$(echo "$dev" | awk '{ print $1; }')
|
||||
echo -n "mounting $mdev..."
|
||||
if $ZFS mount $mdev; then
|
||||
echo -e "done";
|
||||
else
|
||||
echo -e "failed";
|
||||
fi
|
||||
done < <($ZFS list -H);
|
||||
|
||||
# export the filesystems
|
||||
echo -n "exporting ZFS filesystems..."
|
||||
if $ZFS share -a; then
|
||||
echo -e "done";
|
||||
else
|
||||
echo -e "failed";
|
||||
fi
|
||||
|
||||
|
||||
;;
|
||||
|
||||
stop) echo "$1ping ZFS filesystems"
|
||||
|
||||
if grep "zfs" /proc/modules > /dev/null; then
|
||||
# module is loaded, so we can try to umount filesystems
|
||||
while IFS= read -r -d $'\n' dev; do
|
||||
mdev=$(echo "$dev" | awk '{ print $1 }');
|
||||
echo -n "umounting $mdev...";
|
||||
if $ZFS umount $mdev; then
|
||||
echo -e "done";
|
||||
else
|
||||
echo -e "failed";
|
||||
fi
|
||||
# the next line is, because i have to reverse the
|
||||
# output, otherwise it wouldn't work as it should
|
||||
done < <($ZFS list -H | tac);
|
||||
|
||||
# and finally let's rmmod the module
|
||||
rmmod zfs
|
||||
|
||||
|
||||
else
|
||||
# module not loaded, no need to umount anything
|
||||
exit 0
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
restart) echo "$1ing ZFS filesystems"
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
*) echo "Usage: $0 {start|stop|restart}"
|
||||
;;
|
||||
|
||||
esac
|
||||
Reference in New Issue
Block a user