mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
Quote variables in the zfs.lsb script.
For consistency and safety, quote all variables in the zfs.lsb script. This protects in the unlikely case that any of the file names contain whitespace. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #439
This commit is contained in:
parent
c2d9c41d50
commit
660cbada0f
@ -31,14 +31,14 @@ ZPOOL="@sbindir@/zpool"
|
|||||||
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
|
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
|
||||||
|
|
||||||
# Source zfs configuration.
|
# Source zfs configuration.
|
||||||
[ -r /etc/default/zfs ] && . /etc/default/zfs
|
[ -r '/etc/default/zfs' ] && . /etc/default/zfs
|
||||||
|
|
||||||
[ -x $ZPOOL ] || exit 1
|
[ -x "$ZPOOL" ] || exit 1
|
||||||
[ -x $ZFS ] || exit 2
|
[ -x "$ZFS" ] || exit 2
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
[ -f $LOCKFILE ] && return 3
|
[ -f "$LOCKFILE" ] && return 3
|
||||||
|
|
||||||
# Requires selinux policy which has not been written.
|
# Requires selinux policy which has not been written.
|
||||||
if [ -r "/selinux/enforce" ] &&
|
if [ -r "/selinux/enforce" ] &&
|
||||||
@ -58,45 +58,45 @@ start()
|
|||||||
# This should be handled by rc.sysinit but lets be paranoid.
|
# This should be handled by rc.sysinit but lets be paranoid.
|
||||||
awk '$2 == "/" { exit 1 }' /etc/mtab
|
awk '$2 == "/" { exit 1 }' /etc/mtab
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ "$RETVAL" -eq 0 ]; then
|
||||||
/bin/mount -f /
|
/bin/mount -f /
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Import all pools described by the cache file, and then mount
|
# Import all pools described by the cache file, and then mount
|
||||||
# all filesystem based on their properties.
|
# all filesystem based on their properties.
|
||||||
if [ -f $ZPOOL_CACHE ] ; then
|
if [ -f "$ZPOOL_CACHE" ] ; then
|
||||||
log_begin_msg "Importing ZFS pools"
|
log_begin_msg "Importing ZFS pools"
|
||||||
$ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null
|
"$ZPOOL" import -c "$ZPOOL_CACHE" -aN 2>/dev/null
|
||||||
log_end_msg $?
|
log_end_msg $?
|
||||||
|
|
||||||
log_begin_msg "Mounting ZFS filesystems"
|
log_begin_msg "Mounting ZFS filesystems"
|
||||||
$ZFS mount -a
|
"$ZFS" mount -a
|
||||||
log_end_msg $?
|
log_end_msg $?
|
||||||
|
|
||||||
log_begin_msg "Exporting ZFS filesystems"
|
log_begin_msg "Exporting ZFS filesystems"
|
||||||
$ZFS share -a
|
"$ZFS" share -a
|
||||||
log_end_msg $?
|
log_end_msg $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch $LOCKFILE
|
touch "$LOCKFILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
[ ! -f $LOCKFILE ] && return 3
|
[ ! -f "$LOCKFILE" ] && return 3
|
||||||
|
|
||||||
log_begin_msg "Unmounting ZFS filesystems"
|
log_begin_msg "Unmounting ZFS filesystems"
|
||||||
$ZFS umount -a
|
"$ZFS" umount -a
|
||||||
log_end_msg $?
|
log_end_msg $?
|
||||||
|
|
||||||
rm -f $LOCKFILE
|
rm -f "$LOCKFILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
status()
|
status()
|
||||||
{
|
{
|
||||||
[ ! -f $LOCKFILE ] && return 3
|
[ ! -f "$LOCKFILE" ] && return 3
|
||||||
|
|
||||||
$ZPOOL status && echo && $ZPOOL list
|
"$ZPOOL" status && echo "" && "$ZPOOL" list
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -117,7 +117,7 @@ case "$1" in
|
|||||||
start
|
start
|
||||||
;;
|
;;
|
||||||
condrestart)
|
condrestart)
|
||||||
if [ -f $LOCKFILE ]; then
|
if [ -f "$LOCKFILE" ]; then
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user