From 1fdf1adeab11b1b08c5c69dda6175de61f53770d Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 16 Apr 2009 15:18:47 +0200 Subject: [PATCH] vserver: Cleanup vserver-hashify-all script. This adds proper quoting and uses absolute paths. --- usr/local/bin/vserver-hashify-all | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr/local/bin/vserver-hashify-all b/usr/local/bin/vserver-hashify-all index 7c038c1..d1a2190 100755 --- a/usr/local/bin/vserver-hashify-all +++ b/usr/local/bin/vserver-hashify-all @@ -1,25 +1,25 @@ #!/bin/sh # The dir containing vserver configuration -VSERVERS_CONF=/etc/vservers +VSERVERS_CONF="/etc/vservers" -cd $VSERVERS_CONF -for NAME in *; do +for VDIR in $VSERVERS_CONF/*; do + NAME=`basename $VDIR` # Check if its config dir exists - if [ ! -d $NAME ]; then + if [ ! -d "$VDIR" ]; then continue; fi echo "Hashifying vserver $NAME..." - sudo vserver $NAME hashify + sudo vserver "$NAME" hashify done # Change to /tmp, to minimize the chance for an error to damage the root fs cd /tmp echo "Cleaning up unused hashed files..." -for HASH_DIR in $VSERVERS_CONF/.defaults/apps/vunify/hash/*; do - if [ -L $HASH_DIR ]; then +for HASH_DIR in "$VSERVERS_CONF"/.defaults/apps/vunify/hash/*; do + if [ -L "$HASH_DIR" ]; then # All symbolic links - sudo find -H $HASH_DIR -type f -links 1 -print0 | sudo xargs -0 rm + sudo find -H "$HASH_DIR" -type f -links 1 -print0 | sudo xargs -0 rm fi done -- 2.30.2