]> gitweb.fluxo.info Git - hydra.git/commitdiff
Check for folder and key at backup-restore-master
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 8 Mar 2014 22:35:10 +0000 (19:35 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 8 Mar 2014 22:35:10 +0000 (19:35 -0300)
share/hydractl/backup-restore-master

index ecbb64c6b876211b1108874625352c24a467011a..bb394c14a1883a8951d6aa0fca84c43bb9360897 100755 (executable)
@@ -27,7 +27,17 @@ BASENAME="`basename $0`"
 HOST="$1"
 DOMAIN="`facter domain`"
 
-# TODO: check if keys and files exist
+# Check for a backup key
+if ! gpg --list-secret-keys root@$BACKUP.$DOMAIN &> /dev/null; then
+  echo "fatal: secret key for root@$BACKUP.$DOMAIN not available"
+  exit 1
+fi
+
+# Check base restore folder
+if [ ! -d "/var/backups/remote/$BACKUP.$DOMAIN/restore/" ]; then
+  echo "fatal: restore folder /var/backups/remote/$BACKUP.$DOMAIN/restore/ not available"
+  exit 1
+fi
 
 hydractl backup-restore          $HOST rsync
 hydractl backup-restore-git      $HOST
@@ -40,4 +50,4 @@ hydractl backup-restore-munin    $HOST
 # Teardown
 echo "Now check the restoration process and cleanup keys and files by running:"
 echo "rm -rf /var/backups/remote/$BACKUP.$DOMAIN/restore/"
-echo "gpg --delete-secret-and-public-keys root@$BACKUO.$DOMAIN"
+echo "gpg --delete-secret-and-public-keys root@$BACKUP.$DOMAIN"