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
|
exit 0
|
||||||
else
|
else
|
||||||
if is_subvolume "$1"; then
|
if is_subvolume "$1"; then
|
||||||
if [[ "$1" == "/" ]]; then
|
SNAP_FOLDER="${1%/}/$SNAP_FOLDER"
|
||||||
SNAP_FOLDER="/$SNAP_FOLDER"
|
|
||||||
else
|
|
||||||
SNAP_FOLDER="${1%/}/$SNAP_FOLDER"
|
|
||||||
fi
|
|
||||||
# Create $SNAP_FOLDER if it does not exist
|
# Create $SNAP_FOLDER if it does not exist
|
||||||
if [[ ! -d "$SNAP_FOLDER" ]]; then
|
if [[ ! -d "$SNAP_FOLDER" ]]; then
|
||||||
lib_print "?Creating snapshot folder because it does not yet exist [$SNAP_FOLDER]"
|
lib_print "?Creating snapshot folder because it does not yet exist [$SNAP_FOLDER]"
|
||||||
|
@ -173,7 +169,7 @@ else
|
||||||
else
|
else
|
||||||
# Take the snapshot
|
# Take the snapshot
|
||||||
#TODO: handle failed snapshot creations
|
#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]"
|
lib_print "Created new snapshot [$SNAP_FOLDER/$SNAP_NAME]"
|
||||||
else
|
else
|
||||||
lib_print "!Error occured while creating new snapshot [$SNAP_FOLDER/$SNAP_NAME]"
|
lib_print "!Error occured while creating new snapshot [$SNAP_FOLDER/$SNAP_NAME]"
|
||||||
|
|
Loading…
Reference in New Issue