fixed a bug when btrfs subvol is / (second try)
This commit is contained in:
parent
24af09986f
commit
5feb7e6727
|
@ -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]"
|
||||
|
|
Loading…
Reference in New Issue