From e567b44c474c2b3c633b0aac97d8b14d6b02d7d1 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 23 Nov 2009 15:28:22 +0100 Subject: [PATCH] remount optional --- remote-backup | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/remote-backup b/remote-backup index e7a2c1c..0821fd0 100755 --- a/remote-backup +++ b/remote-backup @@ -65,17 +65,22 @@ source /etc/remote-backup.conf # ------------- the script itself -------------------------------------- # make sure we're running as root -if (( `$ID -u` != 0 )); then { $ECHO "Sorry, must be root. Exiting..."; exit; } fi - -# attempt to remount the RW mount point as RW; else abort -$MOUNT -o remount,rw $MOUNT_DEVICE $SNAPSHOT_RW ; -if (( $? )); then -{ - $ECHO "snapshot: could not remount $SNAPSHOT_RW readwrite"; - exit; -} -fi; +if [ ! $UID -eq 0 ] +then + $ECHO "Sorry, must be root. Exiting..." + exit +fi +if [[ "$REMOUNT" == "true" ]] +then + # attempt to remount the RW mount point as RW; else abort + $MOUNT -o remount,rw $MOUNT_DEVICE $SNAPSHOT_RW ; + if (( $? )) + then + $ECHO "snapshot: could not remount $SNAPSHOT_RW readwrite" + exit + fi +fi # rotating snapshots of /home (fixme: this should be more general)