diff --git a/debian/changelog b/debian/changelog index b4f3c28..3baa874 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,8 @@ xen-tools (4.4~dev-1) UNRELEASED; urgency=low * xen-list-images now displays a unit after the memory size * Drop support for memory size in kilobytes in xen-create-image, neither xt-create-xen-config nor xm support it. + * Refactoring: Replace all occurrences of "! -z" by "-n" in hooks and + bash completion. -- Axel Beckert Fri, 23 Aug 2013 21:13:07 +0200 diff --git a/hooks/centos-5/25-setup-kernel b/hooks/centos-5/25-setup-kernel index c65979e..268ef9f 100755 --- a/hooks/centos-5/25-setup-kernel +++ b/hooks/centos-5/25-setup-kernel @@ -41,7 +41,7 @@ EOF for i in `seq 1 $NUMPARTITIONS`; do echo -n "/dev/xvde$i " >> ${prefix}/etc/fstab eval part=\$PARTITION$i - if [ ! -z "`echo $part | grep swap`" ]; then + if [ -n "`echo $part | grep swap`" ]; then echo "none swap ws 0 0" >> ${prefix}/etc/fstab else echo $part | awk -F: '{print $4,$3,$5,0,1}' >> ${prefix}/etc/fstab diff --git a/hooks/centos-6/25-setup-kernel b/hooks/centos-6/25-setup-kernel index 2c99703..972ae21 100755 --- a/hooks/centos-6/25-setup-kernel +++ b/hooks/centos-6/25-setup-kernel @@ -41,7 +41,7 @@ EOF for i in `seq 1 $NUMPARTITIONS`; do echo -n "/dev/sda$i " >> ${prefix}/etc/fstab eval part=\$PARTITION$i - if [ ! -z "`echo $part | grep swap`" ]; then + if [ -n "`echo $part | grep swap`" ]; then echo "none swap ws 0 0" >> ${prefix}/etc/fstab else echo $part | awk -F: '{print $4,$3,$5,0,1}' >> ${prefix}/etc/fstab diff --git a/hooks/common.sh b/hooks/common.sh index d6893cb..7b571a7 100755 --- a/hooks/common.sh +++ b/hooks/common.sh @@ -24,7 +24,7 @@ logMessage () { message="$*" - if [ ! -z "${verbose}" ]; then + if [ -n "${verbose}" ]; then echo $message fi } diff --git a/hooks/common/30-disable-gettys b/hooks/common/30-disable-gettys index 6edc80b..db4707a 100755 --- a/hooks/common/30-disable-gettys +++ b/hooks/common/30-disable-gettys @@ -49,7 +49,7 @@ rm -f ${prefix}/etc/event.d/tty[!1] # # Are we using an alternative serial device? # -if [ ! -z "${serial_device}" ]; then +if [ -n "${serial_device}" ]; then serial_device=`basename ${serial_device}` diff --git a/hooks/common/40-setup-networking-deb b/hooks/common/40-setup-networking-deb index d8785ae..4cbc83c 100755 --- a/hooks/common/40-setup-networking-deb +++ b/hooks/common/40-setup-networking-deb @@ -71,7 +71,7 @@ setupStaticNetworking () # if $p2p is set then add a "pointopoint" setting. # point=''; - if [ ! -z "${p2p}" ]; then + if [ -n "${p2p}" ]; then point="pointopoint ${p2p}" else point='' @@ -81,7 +81,7 @@ setupStaticNetworking () # broadcast address? # bcast=''; - if [ ! -z "${broadcast}" ]; then + if [ -n "${broadcast}" ]; then bcast=" broadcast ${broadcast}" fi diff --git a/hooks/common/90-make-fstab b/hooks/common/90-make-fstab index 1f6757e..79be1ea 100755 --- a/hooks/common/90-make-fstab +++ b/hooks/common/90-make-fstab @@ -48,7 +48,7 @@ if [ "${ide}" ]; then elif [ "${scsi}" ]; then device=sda else - if [ ! -z "${disk_device}" ]; then + if [ -n "${disk_device}" ]; then device=`basename $disk_device` fi fi diff --git a/hooks/gentoo/40-setup-networking b/hooks/gentoo/40-setup-networking index bbb99ca..2c96654 100755 --- a/hooks/gentoo/40-setup-networking +++ b/hooks/gentoo/40-setup-networking @@ -61,7 +61,7 @@ setupStaticNetworking () # if $p2p is set then add a "pointopoint" setting. # point=''; - if [ ! -z "${p2p}" ]; then + if [ -n "${p2p}" ]; then point="pointopoint ${p2p}" else point='' diff --git a/misc/xen-tools.bash-completion b/misc/xen-tools.bash-completion index 0a15e87..ac6fd53 100644 --- a/misc/xen-tools.bash-completion +++ b/misc/xen-tools.bash-completion @@ -31,7 +31,7 @@ function _find_xen_images for i in /etc/xen/*.cfg ; do name=`grep ^name $i 2>/dev/null | awk -F\' '{print $2}'` - if [ ! -z "${name}" ] ; then + if [ -n "${name}" ] ; then names="${names} ${name}" fi done