]> gitweb.fluxo.info Git - hydra.git/commitdiff
Check volume name and if it is mounted at sync-backups
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 3 Aug 2017 12:18:39 +0000 (09:18 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 3 Aug 2017 12:18:39 +0000 (09:18 -0300)
share/hydractl/sync-backups

index c04fa2fabef27cda21cc45d69ff956e78db459f1..b218b5c25395220144a4261877b1f509e88d9b18 100755 (executable)
@@ -64,6 +64,18 @@ else
   shift
 fi
 
+# Check volume name
+if [ "$VOLUME" == "`hostname -f`" ];
+  echo "volume is the hostname, cannot sync to myself"
+  exit 1
+fi
+
+# Check if it is mounted
+if ! mount | grep -q $MEDIA; then
+  echo "volume $MEDIA is not mounted"
+  exit 1
+fi
+
 # Detect if removable media is a system or a regular storage volume
 if [ -d "$MEDIA/var/backups/remote" ]; then
   MEDIA="$MEDIA/var/backups/remote"