41
41
sysconfdir=" /etc"
42
42
grub_btrfs_config=" ${sysconfdir} /default/grub-btrfs/config"
43
43
44
- [[ -f " $grub_btrfs_config " ] ] && . " $grub_btrfs_config "
45
- [[ -f " ${sysconfdir} /default/grub" ] ] && . " ${sysconfdir} /default/grub"
44
+ [ -f " $grub_btrfs_config " ] && . " $grub_btrfs_config "
45
+ [ -f " ${sysconfdir} /default/grub" ] && . " ${sysconfdir} /default/grub"
46
46
47
47
# # Error Handling
48
48
print_error ()
@@ -75,15 +75,15 @@ while getopts :V-: opt; do
75
75
done
76
76
77
77
# # Exit the script, if:
78
- [[ " ${ GRUB_BTRFS_DISABLE,,} " == " true" ] ] && print_error " GRUB_BTRFS_DISABLE is set to true (default=false)"
78
+ [ " $( echo " $ GRUB_BTRFS_DISABLE" | tr ' [:upper:] ' ' [:lower:] ' ) " = ' true' ] && print_error " GRUB_BTRFS_DISABLE is set to true (default=false)"
79
79
if ! type btrfs > /dev/null 2>&1 ; then print_error " btrfs-progs isn't installed" ; fi
80
- [[ -f " ${GRUB_BTRFS_MKCONFIG_LIB:-/ usr/ share/ grub/ grub-mkconfig_lib} " ] ] && . " ${GRUB_BTRFS_MKCONFIG_LIB:-/ usr/ share/ grub/ grub-mkconfig_lib} " || print_error " grub-mkconfig_lib couldn't be found"
80
+ [ -f " ${GRUB_BTRFS_MKCONFIG_LIB:-/ usr/ share/ grub/ grub-mkconfig_lib} " ] && . " ${GRUB_BTRFS_MKCONFIG_LIB:-/ usr/ share/ grub/ grub-mkconfig_lib} " || print_error " grub-mkconfig_lib couldn't be found"
81
81
[[ " $( btrfs filesystem df / 2>&1 ) " == * " not a btrfs filesystem" * ]] && print_error " Root filesystem isn't btrfs"
82
82
83
83
printf " Detecting snapshots ...\n" >&2 ;
84
84
85
85
# # Submenu name
86
- distro=$( awk -F " =" ' /^NAME=/ {gsub(/"/, "", $2); print $2}' /etc/os-release)
86
+ distro=$( awk -F " =" ' /^NAME=/ {gsub(/"/, "", $2); print $2}' /etc/os-release) # escape '
87
87
submenuname=${GRUB_BTRFS_SUBMENUNAME:- " ${distro:- Linux} snapshots" }
88
88
# # Limit snapshots to show in the Grub menu (default=50)
89
89
limit_snap_show=" ${GRUB_BTRFS_LIMIT:- 50} "
@@ -99,7 +99,7 @@ grub_btrfs_directory=${GRUB_BTRFS_GBTRFS_DIRNAME:-${grub_directory}}
99
99
grub_btrfs_search_directory=${GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME:- " \$ {prefix}" }
100
100
# # Password protection management for submenu
101
101
# Protection support for submenu (--unrestricted)
102
- case " ${ GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU,,} " in
102
+ case " $( echo " $ GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU" | tr ' [:upper:] ' ' [:lower:] ' ) " in
103
103
true) unrestricted_access_submenu=" --unrestricted " ;;
104
104
* ) unrestricted_access_submenu=" "
105
105
esac
111
111
# # Probe information of Root and Boot devices
112
112
# Probe info "Root partition"
113
113
root_device=$( ${grub_probe} --target=device /) # Root device
114
- root_uuid=$( ${grub_probe} --device ${root_device} --target=" fs_uuid" 2> /dev/null) # UUID of the root device
114
+ root_uuid=$( ${grub_probe} --device " ${root_device} " --target=" fs_uuid" 2> /dev/null) # UUID of the root device
115
115
root_uuid_subvolume=$( btrfs subvolume show / 2> /dev/null) || print_error " UUID of the root subvolume is not available" ; # If UUID of root subvolume is not available, then exit
116
- root_uuid_subvolume=$( awk -F" :" ' match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< " $root_uuid_subvolume" ) # UUID of the root subvolume
116
+ root_uuid_subvolume=$( awk -F" :" ' match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< " $root_uuid_subvolume" ) # UUID of the root subvolume '
117
117
# Probe info "Boot partition"
118
- boot_device=$( ${grub_probe} --target=device ${boot_directory} ) # Boot device
119
- boot_uuid=$( ${grub_probe} --device ${boot_device} --target=" fs_uuid" 2> /dev/null) # UUID of the boot device
118
+ boot_device=$( ${grub_probe} --target=device " ${boot_directory} " ) # Boot device
119
+ boot_uuid=$( ${grub_probe} --device " ${boot_device} " --target=" fs_uuid" 2> /dev/null) # UUID of the boot device
120
120
boot_uuid_subvolume=$( btrfs subvolume show " $boot_directory " 2> /dev/null) || boot_uuid_subvolume=" UUID: $root_uuid_subvolume " ; # If boot folder isn't a subvolume, then UUID=root_uuid_subvolume
121
- boot_uuid_subvolume=$( awk -F" :" ' match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< " $boot_uuid_subvolume" ) # UUID of the boot subvolume
122
- boot_hs=$( ${grub_probe} --device ${boot_device} --target=" hints_string" 2> /dev/null) # hints string
123
- boot_fs=$( ${grub_probe} --device ${boot_device} --target=" fs" 2> /dev/null) # Type filesystem of boot device
121
+ boot_uuid_subvolume=$( awk -F" :" ' match($1, /(^[ \t]+UUID)/) {sub(/^[ \t]+/, "", $2); print $2}' <<< " $boot_uuid_subvolume" ) # UUID of the boot subvolume '
122
+ boot_hs=$( ${grub_probe} --device " ${boot_device} " --target=" hints_string" 2> /dev/null) # hints string
123
+ boot_fs=$( ${grub_probe} --device " ${boot_device} " --target=" fs" 2> /dev/null) # Type filesystem of boot device
124
124
125
125
# # Parameters passed to the kernel
126
126
kernel_parameters=" $GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT $GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS "
@@ -150,7 +150,7 @@ detect_rootflags()
150
150
151
151
unmount_grub_btrfs_mount_point ()
152
152
{
153
- if [[ -d " $grub_btrfs_mount_point " ] ]; then
153
+ if [ -d " $grub_btrfs_mount_point " ]; then
154
154
local wait=true
155
155
local wait_max=0
156
156
printf " Unmount %s .." " $grub_btrfs_mount_point " >&2 ;
@@ -160,7 +160,7 @@ if [[ -d "$grub_btrfs_mount_point" ]]; then
160
160
if umount " $grub_btrfs_mount_point " > /dev/null 2>&1 ; then
161
161
wait=false # umount successful
162
162
printf " Success\n" >&2 ;
163
- elif [[ $wait_max = 10 ] ]; then
163
+ elif [ $wait_max -eq 10 ]; then
164
164
printf " \nWarning: Unable to unmount %s in %s\n" " $root_device " " $grub_btrfs_mount_point " >&2 ;
165
165
break ;
166
166
else
@@ -172,7 +172,7 @@ if [[ -d "$grub_btrfs_mount_point" ]]; then
172
172
printf " Success\n" >&2 ;
173
173
fi
174
174
done
175
- if [[ " $wait " != true ] ]; then
175
+ if [ " $wait " != true ]; then
176
176
if ! rm -d " $grub_btrfs_mount_point " > /dev/null 2>&1 ; then
177
177
printf " Unable to delete %s: Device or resource is busy\n" " $grub_btrfs_mount_point " >&2 ;
178
178
fi
@@ -193,10 +193,10 @@ make_menu_entries()
193
193
entry " submenu '${title_menu} ' {
194
194
submenu '${title_submenu} ' { echo }"
195
195
for k in " ${name_kernel[@]} " ; do
196
- [[ ! -f " ${boot_dir} " /" ${k} " ] ] && continue ;
196
+ [ ! -f " ${boot_dir} " /" ${k} " ] && continue ;
197
197
kversion=${k#* " -" }
198
198
for i in " ${name_initramfs[@]} " ; do
199
- if [[ " ${name_initramfs} " != " x" ] ] ; then
199
+ if [ " ${name_initramfs} " != " x" ] ; then
200
200
# prefix_i=${i%%"-"*}
201
201
suffix_i=${i#* " -" }
202
202
# alt_suffix_i=${i##*"-"}
@@ -207,7 +207,7 @@ make_menu_entries()
207
207
else continue ;
208
208
fi
209
209
for u in " ${name_microcode[@]} " ; do
210
- if [[ " ${name_microcode} " != " x" ] ] ; then
210
+ if [ " ${name_microcode} " != " x" ] ; then
211
211
entry "
212
212
menuentry ' " ${k} " & " ${i} " & " ${u} " ' ${CLASS} " \$ menuentry_id_option" 'gnulinux-snapshots-$boot_uuid ' {"
213
213
else
@@ -228,7 +228,7 @@ make_menu_entries()
228
228
echo 'Loading Snapshot: " ${snap_date_trim} " " ${snap_dir_name_trim} " '
229
229
echo 'Loading Kernel: " ${k} " ...'
230
230
linux \" ${boot_dir_root_grub} /" ${k} " \" root=" ${LINUX_ROOT_DEVICE} " ${kernel_parameters} ${rootflags} subvol=\" " ${snap_dir_name_trim} " \" "
231
- if [[ " ${name_microcode} " != " x" ] ] ; then
231
+ if [ " ${name_microcode} " != " x" ] ; then
232
232
entry " \
233
233
echo 'Loading Microcode & Initramfs: " ${u} " " ${i} " ...'
234
234
initrd \" ${boot_dir_root_grub} /" ${u} " \" \" ${boot_dir_root_grub} /" ${i} " \" "
@@ -242,7 +242,7 @@ make_menu_entries()
242
242
done
243
243
else
244
244
for u in " ${name_microcode[@]} " ; do
245
- if [[ " ${name_microcode} " != " x" ] ] ; then
245
+ if [ " ${name_microcode} " != " x" ] ; then
246
246
entry "
247
247
menuentry ' " ${k} " & " ${u} " ' ${CLASS} " \$ menuentry_id_option" 'gnulinux-snapshots-$boot_uuid ' {"
248
248
else
@@ -263,7 +263,7 @@ make_menu_entries()
263
263
echo 'Loading Snapshot: " ${snap_date_trim} " " ${snap_dir_name_trim} " '
264
264
echo 'Loading Kernel: " ${k} " ...'
265
265
linux \" ${boot_dir_root_grub} /" ${k} " \" root=" ${LINUX_ROOT_DEVICE} " ${kernel_parameters} ${rootflags} subvol=\" " ${snap_dir_name_trim} " \" "
266
- if [[ " ${name_microcode} " != " x" ] ] ; then
266
+ if [ " ${name_microcode} " != " x" ] ; then
267
267
entry " \
268
268
echo 'Loading Microcode: " ${u} " ...'
269
269
initrd \" ${boot_dir_root_grub} /" ${u} " \" "
@@ -305,15 +305,15 @@ snapshot_list()
305
305
# ignore specific path during run "grub-mkconfig"
306
306
if [ -n " ${GRUB_BTRFS_IGNORE_SPECIFIC_PATH} " ] ; then
307
307
for isp in " ${GRUB_BTRFS_IGNORE_SPECIFIC_PATH[@]} " ; do
308
- [[ " ${path_snapshot} " == " ${isp} " ] ] && continue 2;
308
+ [ " ${path_snapshot} " = " ${isp} " ] && continue 2;
309
309
done
310
310
fi
311
311
if [ -n " ${GRUB_BTRFS_IGNORE_PREFIX_PATH} " ] ; then
312
312
for isp in " ${GRUB_BTRFS_IGNORE_PREFIX_PATH[@]} " ; do
313
313
[[ " ${path_snapshot} " == " ${isp} " /* ]] && continue 2;
314
314
done
315
315
fi
316
- [[ ! -d " $grub_btrfs_mount_point /$path_snapshot /boot" ] ] && continue ; # Discard snapshots without /boot folder
316
+ [ ! -d " $grub_btrfs_mount_point /$path_snapshot /boot" ] && continue ; # Discard snapshots without /boot folder
317
317
318
318
# Parse Snapper & timeshift information
319
319
local type_snapshot=" N/A"
@@ -323,20 +323,20 @@ snapshot_list()
323
323
description_snapshot=$( awk -F" <|>" ' match($2, /^description/) {print $3}' " $grub_btrfs_mount_point /${path_snapshot% " /" * } /$snapper_info " ) # search matching string beginning "description"
324
324
elif [[ -s " $grub_btrfs_mount_point /${path_snapshot% " /" * } /$timeshift_info " ]] ; then
325
325
type_snapshot=$( awk -F" : " ' match($1, /^[ \t]+"tags"/) {gsub(/"|,/,"");print $2}' " $grub_btrfs_mount_point /${path_snapshot% " /" * } /$timeshift_info " ) # search matching string beginning "tags"
326
- description_snapshot=$( awk -F" : " ' match($1, /^[ \t]+"comments"/) {gsub(/"|,/,"");print $2}' " $grub_btrfs_mount_point /${path_snapshot% " /" * } /$timeshift_info " ) # search matching string beginning "comments"
326
+ description_snapshot=$( awk -F" : " ' match($1, /^[ \t]+"comments"/) {gsub(/"|,/,"");print $2}' " $grub_btrfs_mount_point /${path_snapshot% " /" * } /$timeshift_info " ) # search matching string beginning "comments" fix '
327
327
fi
328
- [[ -z " $type_snapshot " ] ] && type_snapshot=(" N/A" )
329
- [[ -z " $description_snapshot " ] ] && description_snapshot=(" N/A" )
328
+ [ -z " $type_snapshot " ] && type_snapshot=(" N/A" )
329
+ [ -z " $description_snapshot " ] && description_snapshot=(" N/A" )
330
330
331
331
# ignore specific {type,tag,description} of snapshot during run "grub-mkconfig"
332
332
if [ -n " ${GRUB_BTRFS_IGNORE_SNAPSHOT_TYPE} " ] ; then
333
333
for ist in " ${GRUB_BTRFS_IGNORE_SNAPSHOT_TYPE[@]} " ; do
334
- [[ " ${type_snapshot} " == " ${ist} " ] ] && continue 2;
334
+ [ " ${type_snapshot} " = " ${ist} " ] && continue 2;
335
335
done
336
336
fi
337
337
if [ -n " ${GRUB_BTRFS_IGNORE_SNAPSHOT_DESCRIPTION} " ] ; then
338
338
for isd in " ${GRUB_BTRFS_IGNORE_SNAPSHOT_DESCRIPTION[@]} " ; do
339
- [[ " ${description_snapshot} " == " ${isd} " ] ] && continue 2;
339
+ [ " ${description_snapshot} " = " ${isd} " ] && continue 2;
340
340
done
341
341
fi
342
342
@@ -351,21 +351,21 @@ snapshot_list()
351
351
local max_date_length=0
352
352
for i in " ${date_snapshots[@]} " ; do
353
353
local length=" ${# i} "
354
- [[ " $length " -gt " $max_date_length " ] ] && max_date_length=$length
354
+ [ " $length " -gt " $max_date_length " ] && max_date_length=$length
355
355
done
356
356
357
357
# Find max length of a snapshot name, needed for pretty formatting
358
358
local max_path_length=0
359
359
for i in " ${path_snapshots[@]} " ; do
360
360
local length=" ${# i} "
361
- [[ " $length " -gt " $max_path_length " ] ] && max_path_length=$length
361
+ [ " $length " -gt " $max_path_length " ] && max_path_length=$length
362
362
done
363
363
364
364
# Find max length of a snapshot type, needed for pretty formatting
365
365
local max_type_length=0
366
366
for i in " ${type_snapshots[@]} " ; do
367
367
local length=" ${# i} "
368
- [[ " $length " -gt " $max_type_length " ] ] && max_type_length=$length
368
+ [ " $length " -gt " $max_type_length " ] && max_type_length=$length
369
369
done
370
370
371
371
# Find max length of a snapshot description, needed for pretty formatting
@@ -406,14 +406,14 @@ detect_kernel()
406
406
for okernel in " ${boot_dir} " /vmlinuz-* \
407
407
" ${boot_dir} " /vmlinux-* \
408
408
" ${boot_dir} " /kernel-* ; do
409
- [[ ! -f " ${okernel} " ] ] && continue ;
409
+ [ ! -f " ${okernel} " ] && continue ;
410
410
list_kernel+=(" $okernel " )
411
411
done
412
412
413
413
# Custom name kernel in "GRUB_BTRFS_NKERNEL"
414
414
if [ -n " ${GRUB_BTRFS_NKERNEL} " ] ; then
415
415
for ckernel in " ${boot_dir} /${GRUB_BTRFS_NKERNEL[@]} " ; do
416
- [[ ! -f " ${ckernel} " ] ] && continue ;
416
+ [ ! -f " ${ckernel} " ] && continue ;
417
417
list_kernel+=(" $ckernel " )
418
418
done
419
419
fi
@@ -427,14 +427,14 @@ detect_initramfs()
427
427
for oinitramfs in " ${boot_dir} " /initrd.img-* \
428
428
" ${boot_dir} " /initramfs-* \
429
429
" ${boot_dir} " /initrd-* ; do
430
- [[ ! -f " ${oinitramfs} " ] ] && continue ;
430
+ [ ! -f " ${oinitramfs} " ] && continue ;
431
431
list_initramfs+=(" $oinitramfs " )
432
432
done
433
433
434
434
# Custom name initramfs in "GRUB_BTRFS_NINIT"
435
435
if [ -n " ${GRUB_BTRFS_NINIT} " ] ; then
436
436
for cinitramfs in " ${boot_dir} /${GRUB_BTRFS_NINIT[@]} " ; do
437
- [[ ! -f " ${cinitramfs} " ] ] && continue ;
437
+ [ ! -f " ${cinitramfs} " ] && continue ;
438
438
list_initramfs+=(" $cinitramfs " )
439
439
done
440
440
fi
@@ -453,7 +453,7 @@ detect_microcode()
453
453
" ${boot_dir} " /amd-ucode.img \
454
454
" ${boot_dir} " /early_ucode.cpio \
455
455
" ${boot_dir} " /microcode.cpio; do
456
- [[ ! -f " ${oiucode} " ] ] && continue ;
456
+ [ ! -f " ${oiucode} " ] && continue ;
457
457
list_ucode+=(" $oiucode " )
458
458
done
459
459
@@ -509,7 +509,7 @@ boot_bounded()
509
509
# Initialize menu entries
510
510
IFS=$' \n '
511
511
for item in $( snapshot_list) ; do
512
- [[ ${limit_snap_show} -le 0 ] ] && break ; # fix: limit_snap_show=0
512
+ [ " ${limit_snap_show} " -le 0 ] && break ; # fix: limit_snap_show=0
513
513
IFS=$oldIFS
514
514
parse_snapshot_list
515
515
boot_dir=" $grub_btrfs_mount_point /$snap_dir_name_trim$boot_directory "
@@ -525,12 +525,12 @@ boot_bounded()
525
525
boot_dir_root_grub=" $( make_system_path_relative_to_its_root " ${boot_dir} " ) " # convert "boot_directory" to root of GRUB (e.g /boot become /)
526
526
make_menu_entries
527
527
# show snapshot found during run "grub-mkconfig"
528
- if [[ " ${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:- " true" } " = " true" ] ]; then
528
+ if [ " ${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:- " true" } " = " true" ]; then
529
529
printf " Found snapshot: %s\n" " $item " >&2 ;
530
530
fi
531
531
# Limit snapshots found during run "grub-mkconfig"
532
532
count_limit_snap=$(( 1 + count_limit_snap))
533
- [[ $count_limit_snap -ge $limit_snap_show ] ] && break ;
533
+ [ " $count_limit_snap " -ge " $limit_snap_show " ] && break ;
534
534
done
535
535
IFS=$oldIFS
536
536
}
@@ -550,19 +550,19 @@ boot_separate()
550
550
# Initialize menu entries
551
551
IFS=$' \n '
552
552
for item in $( snapshot_list) ; do
553
- [[ ${limit_snap_show} -le 0 ] ] && break ; # fix: limit_snap_show=0
553
+ [ " ${limit_snap_show} " -le 0 ] && break ; # fix: limit_snap_show=0
554
554
IFS=$oldIFS
555
555
parse_snapshot_list
556
556
detect_rootflags
557
557
title_format
558
558
make_menu_entries
559
559
# show snapshot found during run "grub-mkconfig"
560
- if [[ " ${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:- " true" } " = " true" ] ]; then
560
+ if [ " ${GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND:- " true" } " = " true" ]; then
561
561
printf " Found snapshot: %s\n" " $item " >&2 ;
562
562
fi
563
563
# Limit snapshots found during run "grub-mkconfig"
564
564
count_limit_snap=$(( 1 + count_limit_snap))
565
- [[ $count_limit_snap -ge $limit_snap_show ] ] && break ;
565
+ [ " $count_limit_snap " -ge " $limit_snap_show " ] && break ;
566
566
done
567
567
IFS=$oldIFS
568
568
}
@@ -574,15 +574,15 @@ if [ -e "$grub_btrfs_directory/grub-btrfs.cfg" ]; then
574
574
mv -f " $grub_btrfs_directory /grub-btrfs.cfg" " $grub_btrfs_directory /grub-btrfs.cfg.bkp"
575
575
fi
576
576
# Create mount point then mounting
577
- [[ ! -d $grub_btrfs_mount_point ] ] && mkdir -p " $grub_btrfs_mount_point "
577
+ [ ! -d " $grub_btrfs_mount_point " ] && mkdir -p " $grub_btrfs_mount_point "
578
578
mount -o ro,subvolid=5 /dev/disk/by-uuid/" $root_uuid " " $grub_btrfs_mount_point /" > /dev/null
579
579
trap " unmount_grub_btrfs_mount_point" EXIT # unmounting mount point on EXIT signal
580
580
count_warning_menuentries=0 # Count menuentries
581
581
count_limit_snap=0 # Count snapshots
582
582
check_uuid_required
583
583
# Detects if /boot is a separate partition
584
- [[ " ${ GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION,, } " == " true" ] ] && printf " Override boot partition detection : enable \n" >&2 && boot_separate;
585
- if [[ " $root_uuid " != " $boot_uuid " ]] || [[ " $root_uuid_subvolume " != " $boot_uuid_subvolume " ] ]; then boot_separate ; else boot_bounded ; fi
584
+ [ " $( echo " $ GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION }" | tr ' [:upper:] ' ' [:lower:] ' ) " = " true" ] && printf " Override boot partition detection : enable \n" >&2 && boot_separate;
585
+ if [ " $root_uuid " != " $boot_uuid " ] || [ " $root_uuid_subvolume " != " $boot_uuid_subvolume " ]; then boot_separate ; else boot_bounded ; fi
586
586
# Make a submenu in GRUB (grub.cfg)
587
587
cat << EOF
588
588
if [ ! -e "${grub_btrfs_search_directory} /grub-btrfs.cfg" ]; then
@@ -594,13 +594,13 @@ submenu '${submenuname}' ${protection_authorized_users}${unrestricted_access_sub
594
594
fi
595
595
EOF
596
596
# Show warn, menuentries exceeds 250 entries
597
- [[ $count_warning_menuentries -ge 250 ] ] && printf " Generated %s total GRUB entries. You might experience issues loading snapshots menu in GRUB.\n" " ${count_warning_menuentries} " >&2 ;
597
+ [ $count_warning_menuentries -ge 250 ] && printf " Generated %s total GRUB entries. You might experience issues loading snapshots menu in GRUB.\n" " ${count_warning_menuentries} " >&2 ;
598
598
# Show total found snapshots
599
- if [[ " ${GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND:- " true" } " = " true" && -n " ${count_limit_snap} " && " ${count_limit_snap} " != " 0" ] ]; then
599
+ if [ " ${GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND:- " true" } " = " true" ] && [ -n " ${count_limit_snap} " ] && [ " ${count_limit_snap} " != " 0" ]; then
600
600
printf " Found %s snapshot(s)\n" " ${count_limit_snap} " >&2 ;
601
601
fi
602
602
# if no snapshot found, delete the "$grub_btrfs_directory/grub-btrfs.new" file and the "$grub_btrfs_directory/grub-btrfs.cfg.bkp" file and exit
603
- if [[ " ${count_limit_snap} " = " 0" || -z " ${count_limit_snap} " ] ]; then
603
+ if [ " ${count_limit_snap} " = " 0" ] || [ -z " ${count_limit_snap} " ]; then
604
604
rm -f " $grub_btrfs_directory /grub-btrfs.new" " $grub_btrfs_directory /grub-btrfs.cfg.bkp"
605
605
print_error " No snapshots found."
606
606
fi
0 commit comments