diff options
author | Turbo Fredriksson <[email protected]> | 2015-06-02 16:02:31 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-06-05 12:35:39 -0700 |
commit | 4f38c25910b445277acb9513c36de8305f9457c6 (patch) | |
tree | a7ba7a493193341503b27d57cc36440f6e753645 /etc/init.d/zfs-functions.in | |
parent | 2a34db1bdbcecf5019c4a59f2a44c92fe82010f2 (diff) |
SYSV init script fixes.
* Change the order of the function library check/load.
Redhat based system _can_ have a /lib/lsb/init-functions file (from
the redhat-lsb-core package), but it's only partially what we can use.
Instead, look for that file last, giving the script a chance to catch
the 'real' distribution file.
* Filter out dashes and dots in dataset name in read_mtab().
* Get rid of 'awk' entirely. This is usually in /usr, which might not
be availible.
* Get rid of the 'find /dev/disk/by-*' (find is on /usr, which might not
be availible). Instead use echo in a for loop.
* Rebuild scripts if any of the *.in files changed.
* Move the sed part that filters out duplicates inside the check fo
valid variable.
Signed-off-by: Turbo Fredriksson [email protected]
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #3463
Closes #3457
Diffstat (limited to 'etc/init.d/zfs-functions.in')
-rw-r--r-- | etc/init.d/zfs-functions.in | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/etc/init.d/zfs-functions.in b/etc/init.d/zfs-functions.in index 17805ebec..372bae803 100644 --- a/etc/init.d/zfs-functions.in +++ b/etc/init.d/zfs-functions.in @@ -13,15 +13,15 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin # Source function library -if [ -f /lib/lsb/init-functions ]; then - # LSB, Debian GNU/Linux and derivates - . /lib/lsb/init-functions -elif [ -f /etc/rc.d/init.d/functions ]; then +if [ -f /etc/rc.d/init.d/functions ]; then # RedHat and derivates . /etc/rc.d/init.d/functions elif [ -L /etc/init.d/functions.sh ]; then # Gentoo . /etc/init.d/functions.sh +elif [ -f /lib/lsb/init-functions ]; then + # LSB, Debian GNU/Linux and derivates + . /lib/lsb/init-functions fi # Of course the functions we need are called differently @@ -373,7 +373,8 @@ read_mtab() while read -r fs mntpnt fstype opts rest; do if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then - mntpnt=$(printf '%b\n' "$mntpnt" | sed 's,/,_,g') + mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,_,g' \ + -e 's,-,_,g' -e 's,\.,_,g') eval export MTAB_$mntpnt="$fs" fi done < /proc/mounts |