1
1
Fork 0

fixed a bug when btrfs subvol is / (second try)

This commit is contained in:
david 2023-10-30 15:09:51 +01:00
parent 24af09986f
commit 5feb7e6727
1 changed files with 2 additions and 6 deletions

View File

@ -158,11 +158,7 @@ if [[ -z "$1" ]]; then
exit 0
else
if is_subvolume "$1"; then
if [[ "$1" == "/" ]]; then
SNAP_FOLDER="/$SNAP_FOLDER"
else
SNAP_FOLDER="${1%/}/$SNAP_FOLDER"
fi
SNAP_FOLDER="${1%/}/$SNAP_FOLDER"
# Create $SNAP_FOLDER if it does not exist
if [[ ! -d "$SNAP_FOLDER" ]]; then
lib_print "?Creating snapshot folder because it does not yet exist [$SNAP_FOLDER]"
@ -173,7 +169,7 @@ else
else
# Take the snapshot
#TODO: handle failed snapshot creations
if $($BTRFS_COMMAND subvolume snapshot -r "${1%/}" "$SNAP_FOLDER/$SNAP_NAME"); then
if $($BTRFS_COMMAND subvolume snapshot -r "$1" "$SNAP_FOLDER/$SNAP_NAME"); then
lib_print "Created new snapshot [$SNAP_FOLDER/$SNAP_NAME]"
else
lib_print "!Error occured while creating new snapshot [$SNAP_FOLDER/$SNAP_NAME]"