aboutsummaryrefslogtreecommitdiff
path: root/system/zfs-on-linux/rc.zfs
diff options
context:
space:
mode:
authorKevin Paulus <goarilla@gmail.com>2015-09-20 09:47:32 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2015-09-20 09:47:32 +0700
commit98d5bc70a2128fecb8dbd5a64416a0bfe8aaa9aa (patch)
treef7c21a49153da776571f36a03d3b4d3773fed660 /system/zfs-on-linux/rc.zfs
parente5c3ca2812991b6546b369f27289471e99cad85d (diff)
system/zfs-on-linux: Updated for version 0.6.5.1.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/zfs-on-linux/rc.zfs')
-rw-r--r--system/zfs-on-linux/rc.zfs122
1 files changed, 61 insertions, 61 deletions
diff --git a/system/zfs-on-linux/rc.zfs b/system/zfs-on-linux/rc.zfs
index a42922b1244ed..7d818279cec1c 100644
--- a/system/zfs-on-linux/rc.zfs
+++ b/system/zfs-on-linux/rc.zfs
@@ -28,7 +28,7 @@
LOCKFILE=/var/lock/zfs/zfs
ZFS="/sbin/zfs"
ZPOOL="/sbin/zpool"
-ZPOOL_CACHE="/etc/zfs/zpool.cache"
+UDEVD="/dev/disk/by-id/"
# Source zfs configuration.
[ -r '/etc/default/zfs' ] && . /etc/default/zfs
@@ -38,89 +38,89 @@ ZPOOL_CACHE="/etc/zfs/zpool.cache"
start()
{
- [ -f "$LOCKFILE" ] && return 3
+ [ -f "$LOCKFILE" ] && return 3
- # Requires selinux policy which has not been written.
- if [ -r "/selinux/enforce" ] &&
- [ "$(cat /selinux/enforce)" = "1" ]; then
+ # Requires selinux policy which has not been written.
+ if [ -r "/selinux/enforce" ] &&
+ [ "$(cat /selinux/enforce)" = "1" ]; then
- echo "SELinux ZFS policy required"
- return 4
- fi
+ echo "SELinux ZFS policy required"
+ return 4
+ fi
- # Delay until all required block devices are present.
- udevadm settle
+ # Delay until all required block devices are present.
+ udevadm settle
- # Load the zfs module stack
- /sbin/modprobe zfs
+ # Load the zfs module stack
+ /sbin/modprobe zfs
- # Ensure / exists in /etc/mtab, if not update mtab accordingly.
- # This should be handled by rc.sysinit but lets be paranoid.
- awk '$2 == "/" { exit 1 }' /etc/mtab
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- /bin/mount -f /
- fi
+ # Ensure / exists in /etc/mtab, if not update mtab accordingly.
+ # This should be handled by rc.sysinit but lets be paranoid.
+ awk '$2 == "/" { exit 1 }' /etc/mtab
+ RETVAL=$?
+ if [ "$RETVAL" -eq 0 ]; then
+ /bin/mount -f /
+ fi
- # Import all pools described by the cache file, and then mount
- # all filesystem based on their properties.
- if [ -f "$ZPOOL_CACHE" ] ; then
- echo "Importing ZFS pools"
- "$ZPOOL" import -fc "$ZPOOL_CACHE" -aN 2>/dev/null
+ # Import all pools, and then mount
+ # all filesystem based on their properties.
+ echo "Importing ZFS pools"
+ "$ZPOOL" import -d "$UDEVD" -f -aN 2>/dev/null
- echo "Mounting ZFS filesystems"
- "$ZFS" mount -a
+ echo "Mounting ZFS filesystems"
+ "$ZFS" mount -a
- echo "Exporting ZFS filesystems"
- "$ZFS" share -a
- fi
+ echo "Exporting ZFS filesystems"
+ "$ZFS" share -a
- touch "$LOCKFILE"
+ touch "$LOCKFILE"
}
stop()
{
- [ ! -f "$LOCKFILE" ] && return 3
+ [ ! -f "$LOCKFILE" ] && return 3
- echo "Unmounting ZFS filesystems"
- "$ZFS" umount -a
+ echo "Unmounting ZFS filesystems"
+ "$ZFS" umount -a
- rm -f "$LOCKFILE"
+ rm -f "$LOCKFILE"
}
status()
{
- [ ! -f "$LOCKFILE" ] && return 3
+ [ ! -f "$LOCKFILE" ] && return 3
- "$ZPOOL" status && echo "" && "$ZPOOL" list
+ "$ZPOOL" status && echo "" && "$ZPOOL" list
}
case "$1" in
- start)
- start
- RETVAL=$?
- ;;
- stop)
- stop
- RETVAL=$?
- ;;
- status)
- status
- RETVAL=$?
- ;;
- restart)
- stop
- start
- ;;
- condrestart)
- if [ -f "$LOCKFILE" ]; then
- stop
- start
- fi
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- ;;
+ start)
+ start
+ RETVAL=$?
+ ;;
+ stop)
+ stop
+ RETVAL=$?
+ ;;
+ status)
+ status
+ RETVAL=$?
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ condrestart)
+ if [ -f "$LOCKFILE" ]; then
+ stop
+ start
+ fi
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart}"
+ ;;
esac
exit $RETVAL
+
+# vim: set ts=4 sts=4 sw=4 expandtab textwidth=78: