Skip to content

Commit 868d4a2

Browse files
Update shrink-backup
Minor UI edits and variable name change.
1 parent 1ccbf71 commit 868d4a2

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

shrink-backup

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function pause() {
179179
read -p "$*"
180180
}
181181
# Uncomment the following line to enable the pause function
182-
#pause 'Press [Enter] key to continue...'
182+
#pause 'Press [any] key to continue...'
183183

184184

185185

@@ -748,8 +748,8 @@ function btrfs_variables() {
748748
debug 'DEBUG' "Filtering out subvolume: $subvol"
749749

750750
# Fix path if nested subvolume is in other location than root subvolume
751-
top_subvols="$(echo ${LOCAL_TOP_SUBVOLUMES[@]} | sed 's/ /|/g')" # convert spaces into |
752-
if echo "$subvol" | grep -qE "$top_subvols"; then
751+
top_subvolumes="$(echo ${LOCAL_TOP_SUBVOLUMES[@]} | sed 's/ /|/g')" # convert spaces into |
752+
if echo "$subvol" | grep -qE "$top_subvolumes"; then
753753
debug 'INFO' 'Nested volume not under root, fixing path'
754754
for top_subvol in ${LOCAL_TOP_SUBVOLUMES[@]}; do
755755
if echo "$subvol" | grep -qw "$top_subvol"; then
@@ -768,7 +768,7 @@ function btrfs_variables() {
768768
fi
769769
done
770770
if [ -n "$SUBVOLUME_EXCLUDE_PATHS" ]; then
771-
SUBVOLUME_EXCLUDE_PATHS=",$(echo ${SUBVOLUME_EXCLUDE_PATHS[@]} | sed 's/ /,/g')"
771+
SUBVOLUME_EXCLUDE_PATHS="$(echo ${SUBVOLUME_EXCLUDE_PATHS[@]} | sed 's/ /,/g')"
772772
debug 'DEBUG' "SUBVOLUME_EXCLUDE_PATHS=$SUBVOLUME_EXCLUDE_PATHS)"
773773
fi
774774
debug 'DEBUG' "After filtering: LOCAL_NESTED_SUBVOLUMES=$(echo ${LOCAL_NESTED_SUBVOLUMES[@]})"
@@ -1201,8 +1201,8 @@ function do_mount() {
12011201
echo -e "${White}## ${IWhite}Creating nested subvolume: ${Green}$subvol"
12021202
$SLEEPING
12031203
# Fix path if nested subvolume is in other location than root subvolume
1204-
top_subvols="$(echo ${LOCAL_TOP_SUBVOLUMES[@]} | sed 's/ /|/g')" # convert spaces into |
1205-
if echo "$subvol" | grep -qE "$top_subvols"; then
1204+
top_subvolumes="$(echo ${LOCAL_TOP_SUBVOLUMES[@]} | sed 's/ /|/g')" # convert spaces into |
1205+
if echo "$subvol" | grep -qE "$top_subvolumes"; then
12061206
debug 'INFO' 'Nested volume not under root, fixing path'
12071207
for top_subvol in ${LOCAL_TOP_SUBVOLUMES[@]}; do
12081208
if echo "$subvol" | grep -qw "$top_subvol"; then
@@ -1235,8 +1235,8 @@ function do_mount() {
12351235
echo -e "${White}## ${IWhite}Deleting nested subvolume: ${Green}$subvol"
12361236
$SLEEPING
12371237
# Fix path if nested subvolume is in other location than root subvolume
1238-
top_subvols="$(echo ${LOCAL_TOP_SUBVOLUMES[@]} | sed 's/ /|/g')" # convert spaces into |
1239-
if echo "$subvol" | grep -qE "$top_subvols"; then
1238+
top_subvolumes="$(echo ${LOCAL_TOP_SUBVOLUMES[@]} | sed 's/ /|/g')" # convert spaces into |
1239+
if echo "$subvol" | grep -qE "$top_subvolumes"; then
12401240
debug 'INFO' 'Nested volume not under root, fixing path'
12411241
for top_subvol in ${LOCAL_TOP_SUBVOLUMES[@]}; do
12421242
if echo "$subvol" | grep -qw "$top_subvol"; then
@@ -1310,7 +1310,7 @@ function do_e2fsck() {
13101310
$SLEEPING
13111311

13121312
# Remounting if autoexpansion is requested
1313-
if [[ ( "$AUTOEXPAND" == true && "$OS" != unknown ) || ( "$AUTOEXPAND" == false && "$OS" == ubuntu ) ]]; then
1313+
if [[ ( "$AUTOEXPAND" = true && "$OS" != 'unknown' ) || ( "$AUTOEXPAND" = false && "$OS" == 'ubuntu' ) ]]; then
13141314
echo -e "${White}## ${IWhite}Remounting for autoexpansion..."
13151315
debug 'INFO' 'Remounting for autoexpansion function'
13161316
debug 'INFO' 'Running function: do_mount'
@@ -1365,7 +1365,7 @@ function do_resize() {
13651365
# Expanding
13661366
if [ "$*" = 'expand' ]; then
13671367

1368-
echo -e "${White}## ${IWhite}Expanding img filesystem..."
1368+
echo -e "${White}## ${Yellow}Expanding img filesystem..."
13691369
$SLEEPING
13701370

13711371
# Removing loop for truncate to take effect
@@ -1375,7 +1375,7 @@ function do_resize() {
13751375
debug 'DEBUG' "Running: losetup -d $LOOP"
13761376
losetup -d "$LOOP"
13771377

1378-
echo -e "${White}## ${IWhite}Resizing image file..."
1378+
echo -e "${White}## ${Yellow}Expanding image file..."
13791379
$SLEEPING
13801380
debug 'INFO' "Using truncate to resize img file to $(( TRUNCATE_TOTAL / 1024 / 1024 ))MiB"
13811381
debug 'DEBUG' "Running: truncate --size=$TRUNCATE_TOTAL $IMG_FILE"
@@ -1421,7 +1421,7 @@ function do_resize() {
14211421
exit 3
14221422
fi
14231423

1424-
echo -e "${White}## ${IWhite}Resizing filesystem..."
1424+
echo -e "${White}## ${Yellow}Expanding filesystem..."
14251425
$SLEEPING
14261426
debug 'INFO' 'Using resize2fs to expand filesystem'
14271427
debug 'BREAK'
@@ -1444,7 +1444,7 @@ function do_resize() {
14441444
# Shrinking
14451445
elif [ "$*" = 'shrink' ]; then
14461446

1447-
echo -e "${White}## ${IWhite}Shrinking filesystem..."
1447+
echo -e "${White}## ${Yellow}Shrinking filesystem..."
14481448
$SLEEPING
14491449
debug 'INFO' 'Using resize2fs to shrink filesystem'
14501450
debug 'BREAK'
@@ -1457,7 +1457,7 @@ function do_resize() {
14571457
fi
14581458
debug 'DEBUG' "$output\n-------------------------------------------------------------------------------------"
14591459

1460-
echo -e "${White}## ${IWhite}Shrinking partition..."
1460+
echo -e "${White}## ${Yellow}Shrinking partition..."
14611461
$SLEEPING
14621462
debug 'INFO' 'Using parted to shrink partition'
14631463
debug 'BREAK'
@@ -1473,7 +1473,7 @@ function do_resize() {
14731473
fi
14741474
debug 'DEBUG' "$output\n-------------------------------------------------------------------------------------"
14751475

1476-
echo -e "${White}## ${IWhite}Shrinking img file..."
1476+
echo -e "${White}## ${Yellow}Shrinking img file..."
14771477
$SLEEPING
14781478
debug 'INFO' "Using truncate to shrink img file to $(( TRUNCATE_TOTAL / 1024 / 1024 ))MiB"
14791479
debug 'DEBUG' "Running: truncate --size=$TRUNCATE_TOTAL $IMG_FILE"

0 commit comments

Comments
 (0)