quote variables
This commit is contained in:
parent
09587f0ea4
commit
1dadcf3b9f
@ -79,7 +79,7 @@ do
|
||||
if [[ "$REMOUNT" == "true" ]]
|
||||
then
|
||||
# attempt to remount the RW mount point as RW; else abort
|
||||
$MOUNT -o remount,rw $MOUNT_DEVICE $SNAPSHOT_RW ;
|
||||
$MOUNT -o remount,rw "$MOUNT_DEVICE" "$SNAPSHOT_RW" ;
|
||||
if (( $? ))
|
||||
then
|
||||
$ECHO "snapshot: could not remount $SNAPSHOT_RW readwrite"
|
||||
@ -95,26 +95,26 @@ do
|
||||
# rotating snapshots of /home (fixme: this should be more general)
|
||||
|
||||
# step 1: delete the oldest snapshot, if it exists:
|
||||
if [ -d $SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE} ]
|
||||
if [ -d "$SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}" ]
|
||||
then
|
||||
$RM -rf $SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}
|
||||
$RM -rf "$SNAPSHOT_RW/$NAME/daily.${MAX_ROTATE}"
|
||||
fi
|
||||
|
||||
# step 2: shift the middle snapshots(s) back by one, if they exist
|
||||
for backup_number in $(seq $((${MAX_ROTATE}-1)) -1 1)
|
||||
for backup_number in $(seq $(("${MAX_ROTATE}"-1)) -1 1)
|
||||
do
|
||||
if [ -d $SNAPSHOT_RW/$NAME/daily.${backup_number} ]
|
||||
if [ -d "$SNAPSHOT_RW/$NAME/daily.${backup_number}" ]
|
||||
then
|
||||
$MV $SNAPSHOT_RW/$NAME/daily.${backup_number} \
|
||||
$SNAPSHOT_RW/$NAME/daily.$((${backup_number}+1))
|
||||
$MV "$SNAPSHOT_RW/$NAME/daily.${backup_number}" \
|
||||
"$SNAPSHOT_RW/$NAME/daily.$((${backup_number}+1))"
|
||||
fi
|
||||
done
|
||||
|
||||
# step 3: make a hard-link-only (except for dirs) copy of the latest snapshot,
|
||||
# if that exists
|
||||
if [ -d $SNAPSHOT_RW/$NAME/daily.0 ]
|
||||
if [ -d "$SNAPSHOT_RW/$NAME/daily.0" ]
|
||||
then
|
||||
$CP -al $SNAPSHOT_RW/$NAME/daily.0 $SNAPSHOT_RW/$NAME/daily.1
|
||||
$CP -al "$SNAPSHOT_RW/$NAME/daily.0" "$SNAPSHOT_RW/$NAME/daily.1"
|
||||
fi
|
||||
|
||||
# step 4: rsync from the system into the latest snapshot (notice that
|
||||
@ -126,19 +126,19 @@ do
|
||||
--delete \
|
||||
--delete-excluded \
|
||||
--exclude-from="$EXCLUDES" \
|
||||
--bwlimit=$BWLIMIT \
|
||||
${REMOTE_LOCATION} \
|
||||
$SNAPSHOT_RW/$NAME/daily.0
|
||||
--bwlimit="$BWLIMIT" \
|
||||
"${REMOTE_LOCATION}" \
|
||||
"$SNAPSHOT_RW/$NAME/daily.0"
|
||||
|
||||
# step 5: update the mtime of daily.0 to reflect the snapshot time
|
||||
$TOUCH $SNAPSHOT_RW/$NAME/daily.0
|
||||
$TOUCH "$SNAPSHOT_RW/$NAME/daily.0"
|
||||
|
||||
# and thats it for home.
|
||||
|
||||
# now remount the RW snapshot mountpoint as readonly
|
||||
if [[ "$REMOUNT" == "true" ]]
|
||||
then
|
||||
$MOUNT -o remount,ro $MOUNT_DEVICE $SNAPSHOT_RW
|
||||
$MOUNT -o remount,ro "$MOUNT_DEVICE" "$SNAPSHOT_RW"
|
||||
if (( $? ))
|
||||
then
|
||||
$ECHO "snapshot: could not remount $SNAPSHOT_RW readonly"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user