]> arthur.barton.de Git - ax-linux.git/commitdiff
btrfs-mksnapshot: Use "@" as snapshot ID (date) delimiter
authorAlexander Barton <alex@barton.de>
Sat, 19 Apr 2014 12:59:32 +0000 (14:59 +0200)
committerAlexander Barton <alex@barton.de>
Sat, 19 Apr 2014 12:59:32 +0000 (14:59 +0200)
btrfs/mksnapshot/btrfs-mksnapshot

index d100b451b04d01b1e9101dbedbb99566364f0555..ae7fff17d823da1e78dd7c9825305720f1e19294 100755 (executable)
@@ -74,7 +74,7 @@ if [ -z "$VOLUME_NAME" ]; then
        echo "$NAME: Failed to detect btrfs subvolume name for \"$VOLUME_PATH\"!"
        exit 1
 fi
-BASE_VOLUME_NAME=`echo "$VOLUME_NAME" | cut -d'-' -f1`
+BASE_VOLUME_NAME=`echo "$VOLUME_NAME" | cut -d'@' -f1`
 
 if [ -n "$DRY_RUN" ]; then
        echo "VOLUME_NAME=$VOLUME_NAME"
@@ -100,14 +100,14 @@ i=1
 date=`date +%Y%m%d`
 while true; do
        id="$date-$i"
-       [ -e "$FS_MOUNT_PATH/$BASE_VOLUME_NAME-$id" ] || break
+       [ -e "$FS_MOUNT_PATH/$BASE_VOLUME_NAME@$id" ] || break
        if [ -n "$ONLY_ONE_PER_DAY" ]; then
-               echo "Snapshot \"$BASE_VOLUME_NAME-$id\" of \"$VOLUME_PATH\" (\"$VOLUME_NAME\") in btrfs \"$FS_NAME\" already exists."
+               echo "Snapshot \"$BASE_VOLUME_NAME@$id\" of \"$VOLUME_PATH\" (\"$VOLUME_NAME\") in btrfs \"$FS_NAME\" already exists."
                exit 0
        fi
        i=`expr $i + 1`
 done
-NEW_VOLUME_NAME="$BASE_VOLUME_NAME-$id"
+NEW_VOLUME_NAME="$BASE_VOLUME_NAME@$id"
 
 [ -z "$DRY_RUN" ] || echo "NEW_VOLUME_NAME=$NEW_VOLUME_NAME"
 
@@ -118,5 +118,5 @@ set -x
 
 cd "$FS_MOUNT_PATH"
 btrfs subvolume snapshot "$VOLUME_NAME" "$NEW_VOLUME_NAME"
-find . -maxdepth 1 -name "$BASE_VOLUME_NAME" -o -name "$BASE_VOLUME_NAME"-'*' \
- -exec ls -1d {} \; | column
+find . -maxdepth 1 \( -name "$BASE_VOLUME_NAME" -o \
+ -name "$BASE_VOLUME_NAME"@'*' \) -exec ls -1d {} \; | column