+ZPOOL=zpool
+ZFS=zfs
+servicename=zfs
+LOCKFILE=/var/lock/subsys/$servicename
+
+# functions
+zfs_installed() {
+ modinfo zfs > /dev/null 2>&1 || return 5
+ $ZPOOL > /dev/null 2>&1
+ [ $? == 127 ] && return 5
+ $ZFS > /dev/null 2>&1
+ [ $? == 127 ] && return 5
+ return 0
+}
+
+reregister_mounts() {
+ cat /etc/mtab | while read -r fs mntpnt fstype opts rest ; do
+ fs=`printf '%b\n' "$fs"`
+ mntpnt=`printf '%b\n' "$mntpnt"`
+ if [ "$fstype" == "zfs" ] ; then
+ if [ "$mntpnt" == "/" ] ; then
+ mount -f -o zfsutil -t zfs --move / /removethismountpointhoweverpossible
+ umount --fake /removethismountpointhoweverpossible
+ else
+ umount --fake "$mntpnt"
+ fi
+ elif echo "$fs" | grep -q "^/dev/zd" ; then
+ if [ "$mntpnt" == "/" ] ; then
+ mount -f -t "$fstype" --move / /removethismountpointhoweverpossible
+ umount --fake /removethismountpointhoweverpossible
+ else
+ umount --fake "$mntpnt"
+ fi
+ fi
+ done
+ cat /proc/mounts | while read -r fs mntpnt fstype opts rest ; do
+ fs=`printf '%b\n' "$fs"`
+ mntpnt=`printf '%b\n' "$mntpnt"`
+ if [ "$fstype" == "zfs" ] ; then
+ mount -f -t zfs -o zfsutil "$fs" "$mntpnt"
+ elif echo "$fs" | grep -q "^/dev/zd" ; then
+ mount -f -t "$fstype" -o "$opts" "$fs" "$mntpnt"
+ fi
+ done
+}
+
+# i need a bash guru to simplify this, since this is copy and paste, but donno how
+# to correctly dereference variable names in bash, or how to do this right