mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 13:05:00 +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()
|
print_error()
|
||||||
{
|
{
|
||||||
local arg="$@"
|
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"
|
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 ;
|
printf "${arg}\n${nothing_to_do}" >&2 ;
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,14 +254,14 @@ snapshot_list()
|
|||||||
type snapper >/dev/null 2>&1
|
type snapper >/dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
if [ -s "/etc/snapper/configs/$snapper_config" ]; 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_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))
|
local snapper_types=($(snapper --no-dbus -t 0 -c "$snapper_config" list --disable-used-space | tail -n +3 | cut -d'|' -f 2))
|
||||||
|
|
||||||
IFS=$'\n'
|
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))
|
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
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ boot_bounded()
|
|||||||
name_microcode=("${list_ucode[@]##*"/"}")
|
name_microcode=("${list_ucode[@]##*"/"}")
|
||||||
# show snapshot found during run "grub-mkconfig"
|
# show snapshot found during run "grub-mkconfig"
|
||||||
if [[ "${show_snap_found}" = "true" ]]; then
|
if [[ "${show_snap_found}" = "true" ]]; then
|
||||||
printf $"# Found snapshot: %s\n" "$item" >&2 ;
|
printf $"Found snapshot: %s\n" "$item" >&2 ;
|
||||||
fi
|
fi
|
||||||
# Show full path snapshot or only name
|
# Show full path snapshot or only name
|
||||||
path_snapshot
|
path_snapshot
|
||||||
@@ -506,7 +506,7 @@ boot_separate()
|
|||||||
snap_date_time="$(trim "$snap_date_time")"
|
snap_date_time="$(trim "$snap_date_time")"
|
||||||
# show snapshot found during run "grub-mkconfig"
|
# show snapshot found during run "grub-mkconfig"
|
||||||
if [[ "${show_snap_found}" = "true" ]]; then
|
if [[ "${show_snap_found}" = "true" ]]; then
|
||||||
printf $"# Found snapshot: %s\n" "$item" >&2 ;
|
printf $"Found snapshot: %s\n" "$item" >&2 ;
|
||||||
fi
|
fi
|
||||||
# Show full path snapshot or only name
|
# Show full path snapshot or only name
|
||||||
path_snapshot
|
path_snapshot
|
||||||
@@ -524,7 +524,7 @@ boot_separate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
### Start ###
|
### Start ###
|
||||||
printf "###### - Grub-btrfs: Snapshot detection started - ######\n" >&2 ;
|
printf "Detecting snapshots ...\n" >&2 ;
|
||||||
# if btrfs prog isn't installed, exit
|
# if btrfs prog isn't installed, exit
|
||||||
test_btrfs
|
test_btrfs
|
||||||
# Delete existing config
|
# Delete existing config
|
||||||
@@ -541,25 +541,25 @@ count_limit_snap=0
|
|||||||
check_uuid_required
|
check_uuid_required
|
||||||
# Detects if /boot is a separate partition
|
# Detects if /boot is a separate partition
|
||||||
if [[ "$override_boot_partition_detection" == "true" ]]; then
|
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
|
boot_separate
|
||||||
else
|
else
|
||||||
if [[ "$root_uuid" != "$boot_uuid" ]]; then
|
if [[ "$root_uuid" != "$boot_uuid" ]]; then
|
||||||
printf "# Info: Separate boot partition detected \n" >&2 ;
|
printf "Info: Separate boot partition detected \n" >&2 ;
|
||||||
boot_separate
|
boot_separate
|
||||||
else
|
else
|
||||||
printf "# Info: Separate boot partition not detected \n" >&2 ;
|
printf "Info: Separate boot partition not detected \n" >&2 ;
|
||||||
boot_bounded
|
boot_bounded
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# unmounting mount point
|
# unmounting mount point
|
||||||
umount $gbgmp
|
umount $gbgmp
|
||||||
# Show warn, menuentries exceeds 250 entries
|
# 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 ;
|
[[ $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 ;
|
# printf "menuentries = $count_warning_menuentries \n" >&2 ;
|
||||||
# Show total found snapshots
|
# Show total found snapshots
|
||||||
if [[ "${show_total_snap_found}" = "true" && ! -z "${count_limit_snap}" && "${count_limit_snap}" != "0" ]]; then
|
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
|
fi
|
||||||
# if no snapshot found, exit
|
# if no snapshot found, exit
|
||||||
if [[ "${count_limit_snap}" = "0" || -z "${count_limit_snap}" ]]; then
|
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"
|
configfile "\${prefix}/grub-btrfs.cfg"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
printf "###### - Grub-btrfs: Snapshot detection ended - ######\n" >&2 ;
|
|
||||||
### End ###
|
### End ###
|
||||||
|
|||||||
Reference in New Issue
Block a user