From 681fd1999045dc69d3e7748561ac396fa9ff78a3 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 16 Feb 2006 13:12:59 +0000 Subject: Ugly ugly bug: [ test for string ] fails for too many paramters. Quote the string. --- ezjail-admin | 12 ++++++------ ezjail.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ezjail-admin b/ezjail-admin index b2f56e8..741d4cd 100755 --- a/ezjail-admin +++ b/ezjail-admin @@ -29,7 +29,7 @@ ezjail_fdescfs_enable=${ezjail_fdescfs_enable:-"YES"} exerr () { echo -e "$*"; exit 1; } # check for command -[ $1 ] || exerr "Usage: `basename -- $0` [create|delete|list|update] {params}" +[ "$1" ] || exerr "Usage: `basename -- $0` [create|delete|list|update] {params}" case "$1" in ######################## ezjail-admin CREATE ######################## @@ -61,7 +61,7 @@ create) [ -d ${ezjail_jailbase} ] || exerr "Error: base jail does not exist. Please run 'ezjail-admin update' first." # relative paths don't make sense in rc.scripts - [ ${ezjail_jaildir%%[!/]*} ] || exerr "Error: Need an absolute path in ezjail_jaildir, it currently is set to: ${ezjail_jaildir}." + [ "${ezjail_jaildir%%[!/]*}" ] || exerr "Error: Need an absolute path in ezjail_jaildir, it currently is set to: ${ezjail_jaildir}." # jail names must not irritate file systems, excluding dots from this list # was done intentionally to permit foo.com style directory names, however, @@ -77,7 +77,7 @@ create) # if jail root specified on command line is not absolute, make it absolute # inside our jail directory - [ ${newjail_root%%[!/]*} ] || newjail_root=${ezjail_jaildir}/${newjail_root} + [ "${newjail_root%%[!/]*}" ] || newjail_root=${ezjail_jaildir}/${newjail_root} # if a directory at the specified jail root already exists, refuse to # install @@ -105,7 +105,7 @@ create) fi # if a soft link is necessary, create it now - [ ${newjail_softlink} ] && ln -s ${newjail_root} ${newjail_softlink} + [ "${newjail_softlink}" ] && ln -s ${newjail_root} ${newjail_softlink} # if the automount feature is not disabled, this fstab entry for new jail # will be obeyed @@ -125,7 +125,7 @@ create) echo export jail_${newjail_nname}_fdescfs_enable=\"${ezjail_fdescfs_enable}\" >> ${ezjail_jailcfgs}/${newjail_nname} # Final steps for flavour installation - if [ ${newjail_flavour} ]; then + if [ "${newjail_flavour}" ]; then # install files and config to new jail cd ${ezjail_flavours}/${newjail_flavour} find * | cpio -p -v ${newjail_root} > /dev/null @@ -198,7 +198,7 @@ delete) [ -L ${oldjail_softlink} ] && rm ${oldjail_softlink} # if wiping the jail was requested, remove it - [ ${oldjail_wipe} ] && rm -rf ${oldjail_rootdir} + [ "${oldjail_wipe}" ] && rm -rf ${oldjail_rootdir} ;; ######################## ezjail-admin LIST ######################## diff --git a/ezjail.sh b/ezjail.sh index b82e8fc..0d0a247 100755 --- a/ezjail.sh +++ b/ezjail.sh @@ -39,7 +39,7 @@ do_cmd() echo " Warning: Jail ${jail} not found." fi done - [ ${jail_pass} ] && sh /etc/rc.d/jail one${action} ${jail_pass} + [ "${jail_pass}" ] && sh /etc/rc.d/jail one${action} ${jail_pass} } run_rc_command $* -- cgit v1.2.3