]> gitweb.fluxo.info Git - hydra.git/commitdiff
Minor cleanup at backup-site
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 6 Mar 2012 13:52:20 +0000 (10:52 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 6 Mar 2012 13:52:20 +0000 (10:52 -0300)
share/hydractl/backup-site

index 2c448c0aad8a0e31e91fce4896ff81d57051c629..70baf3d1b85cea9fd6d917ba27792940e76f6881 100755 (executable)
@@ -26,7 +26,8 @@ SITE="$1"
 PACK="$1.tar.bz2"
 DATE="`date +%Y%m%d`"
 DEST_BASE="$SITES/backups"
-DEST="$DEST_BASE/site/$SITE/`facter hostname`/$DATE"
+DEST_BASE_SITE="$DEST_BASE/site/$SITE"
+DEST="$DEST_BASE_SITE/`facter hostname`/$DATE"
 
 # Syntax check.
 if [ -z "$SITE" ]; then
@@ -70,18 +71,18 @@ mkdir -p $DEST
 cd $DEST
 
 # Password setup
-if [ ! -e "$SITES/backups/site/$SITE/.htpasswd" ]; then
-  touch $SITES/backups/site/$SITE/.htpasswd
-  chmod 640 $SITES/backups/site/$SITE/.htpasswd
-  chown root.$BACKUPS_GROUP $SITES/backups/site/$SITE/.htpasswd
+if [ ! -e "$DEST_BASE_SITE/.htpasswd" ]; then
+  touch $DEST_BASE_SITE/.htpasswd
+  chmod 640 $DEST_BASE_SITE/.htpasswd
+  chown root.$BACKUPS_GROUP $DEST_BASE_SITE/.htpasswd
 fi
 
 # Access setup
-if [ ! -e "$SITES/backups/site/$SITE/.htaccess" ]; then
-  cat > $SITES/backups/site/$SITE/.htaccess <<-EOF
+if [ ! -e "$DEST_BASE_SITE/.htaccess" ]; then
+  cat > $DEST_BASE_SITE/.htaccess <<-EOF
 AuthType Basic
 AuthName "Backup $SITE"
-AuthUserFile $SITES/backups/site/$SITE/.htpasswd
+AuthUserFile $DEST_BASE_SITE/.htpasswd
 Require valid-user
 EOF
 fi