Turn the init.d scripts into autoconf config files
[zfs.git] / etc / init.d / zfs.lunar.in
similarity index 89%
rename from etc/init.d/zfs.lunar
rename to etc/init.d/zfs.lunar.in
index bdc461a..97384dc 100644 (file)
 #              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"
 
@@ -35,16 +39,16 @@ case $1 in
     while IFS= read -r -d $'\n' dev; do
       mdev=$(echo "$dev" | awk '{ print $1; }')
       echo -n "mounting $mdev..."
-      if zfs mount $mdev; then
+      if $ZFS mount $mdev; then
         echo -e "done";
       else
         echo -e "failed";
       fi
-    done < <(zfs list -H);
+    done < <($ZFS list -H);
 
     # export the filesystems
     echo -n "exporting ZFS filesystems..."
-    if zfs share -a; then
+    if $ZFS share -a; then
       echo -e "done";
     else
       echo -e "failed";
@@ -60,14 +64,14 @@ case $1 in
       while IFS= read -r -d $'\n' dev; do
         mdev=$(echo "$dev" | awk '{ print $1 }');
         echo -n "umounting $mdev...";
-        if zfs umount $mdev; then
+        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);
+      done < <($ZFS list -H | tac);
 
       # and finally let's rmmod the module
       rmmod zfs