mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 12:56:29 +08:00
Update script output (#104)
Script output is now the same as other grub-mkconfig output
This commit is contained in:
@@ -151,8 +151,8 @@ fi
|
||||
print_error()
|
||||
{
|
||||
local arg="$@"
|
||||
local nothing_to_do="If you think an error has occurred , please file a bug report at \" https://github.com/Antynea/grub-btrfs \"\n# Nothing to do. Abort.\n###### - Grub-btrfs: Snapshot detection ended - ######\n"
|
||||
printf "# ${arg}\n# ${nothing_to_do}" >&2 ;
|
||||
local nothing_to_do="If you think an error has occurred , please file a bug report at \" https://github.com/Antynea/grub-btrfs \"\nNothing to do. Abort.\n"
|
||||
printf "${arg}\n${nothing_to_do}" >&2 ;
|
||||
exit 0
|
||||
}
|
||||
|
||||
@@ -254,14 +254,14 @@ snapshot_list()
|
||||
type snapper >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ -s "/etc/snapper/configs/$snapper_config" ]; then
|
||||
printf "# Info: snapper detected, using config '$snapper_config'\n" >&2
|
||||
printf "Info: snapper detected, using config '$snapper_config'\n" >&2
|
||||
local snapper_ids=($(snapper --no-dbus -t 0 -c "$snapper_config" list --disable-used-space | tail -n +3 | cut -d'|' -f 1))
|
||||
local snapper_types=($(snapper --no-dbus -t 0 -c "$snapper_config" list --disable-used-space | tail -n +3 | cut -d'|' -f 2))
|
||||
|
||||
IFS=$'\n'
|
||||
local snapper_descriptions=($(snapper --no-dbus -t 0 -c "$snapper_config" list --disable-used-space | tail -n +3 | rev | cut -d'|' -f 2 | rev))
|
||||
else
|
||||
printf "# Warning: snapper detected but config '$snapper_config' does not exist\n" >&2
|
||||
printf "Warning: snapper detected but config '$snapper_config' does not exist\n" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -455,7 +455,7 @@ boot_bounded()
|
||||
name_microcode=("${list_ucode[@]##*"/"}")
|
||||
# show snapshot found during run "grub-mkconfig"
|
||||
if [[ "${show_snap_found}" = "true" ]]; then
|
||||
printf $"# Found snapshot: %s\n" "$item" >&2 ;
|
||||
printf $"Found snapshot: %s\n" "$item" >&2 ;
|
||||
fi
|
||||
# Show full path snapshot or only name
|
||||
path_snapshot
|
||||
@@ -506,7 +506,7 @@ boot_separate()
|
||||
snap_date_time="$(trim "$snap_date_time")"
|
||||
# show snapshot found during run "grub-mkconfig"
|
||||
if [[ "${show_snap_found}" = "true" ]]; then
|
||||
printf $"# Found snapshot: %s\n" "$item" >&2 ;
|
||||
printf $"Found snapshot: %s\n" "$item" >&2 ;
|
||||
fi
|
||||
# Show full path snapshot or only name
|
||||
path_snapshot
|
||||
@@ -524,7 +524,7 @@ boot_separate()
|
||||
}
|
||||
|
||||
### Start ###
|
||||
printf "###### - Grub-btrfs: Snapshot detection started - ######\n" >&2 ;
|
||||
printf "Detecting snapshots ...\n" >&2 ;
|
||||
# if btrfs prog isn't installed, exit
|
||||
test_btrfs
|
||||
# Delete existing config
|
||||
@@ -541,25 +541,25 @@ count_limit_snap=0
|
||||
check_uuid_required
|
||||
# Detects if /boot is a separate partition
|
||||
if [[ "$override_boot_partition_detection" == "true" ]]; then
|
||||
printf "# Info: Override boot partition detection : enable \n" >&2 ;
|
||||
printf "Info: Override boot partition detection : enable \n" >&2 ;
|
||||
boot_separate
|
||||
else
|
||||
if [[ "$root_uuid" != "$boot_uuid" ]]; then
|
||||
printf "# Info: Separate boot partition detected \n" >&2 ;
|
||||
printf "Info: Separate boot partition detected \n" >&2 ;
|
||||
boot_separate
|
||||
else
|
||||
printf "# Info: Separate boot partition not detected \n" >&2 ;
|
||||
printf "Info: Separate boot partition not detected \n" >&2 ;
|
||||
boot_bounded
|
||||
fi
|
||||
fi
|
||||
# unmounting mount point
|
||||
umount $gbgmp
|
||||
# Show warn, menuentries exceeds 250 entries
|
||||
[[ $count_warning_menuentries -ge 250 ]] && printf "# Generated ${count_warning_menuentries} total GRUB entries. You might experience issues loading snapshots menu in GRUB.\n" >&2 ;
|
||||
# printf "# menuentries = $count_warning_menuentries \n" >&2 ;
|
||||
[[ $count_warning_menuentries -ge 250 ]] && printf "Generated ${count_warning_menuentries} total GRUB entries. You might experience issues loading snapshots menu in GRUB.\n" >&2 ;
|
||||
# printf "menuentries = $count_warning_menuentries \n" >&2 ;
|
||||
# Show total found snapshots
|
||||
if [[ "${show_total_snap_found}" = "true" && ! -z "${count_limit_snap}" && "${count_limit_snap}" != "0" ]]; then
|
||||
printf "# Found ${count_limit_snap} snapshot(s)\n" >&2 ;
|
||||
printf "Found ${count_limit_snap} snapshot(s)\n" >&2 ;
|
||||
fi
|
||||
# if no snapshot found, exit
|
||||
if [[ "${count_limit_snap}" = "0" || -z "${count_limit_snap}" ]]; then
|
||||
@@ -572,5 +572,4 @@ submenu '${submenuname}' ${protection_authorized_users}${unrestricted_access_sub
|
||||
configfile "\${prefix}/grub-btrfs.cfg"
|
||||
}
|
||||
EOF
|
||||
printf "###### - Grub-btrfs: Snapshot detection ended - ######\n" >&2 ;
|
||||
### End ###
|
||||
|
||||
Reference in New Issue
Block a user