mirror of
https://git.proxmox.com/git/pve-kernel-meta
synced 2025-05-02 22:53:38 +00:00
proxmox-boot: add reinit subcommand
to iterate over all configured ESPs and refresh the boot-loader installations. the init function was changed to not run refresh directly - to prevent refresh from running once for each ESP currently reinit does not imply refresh Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
bcd5fb47f0
commit
ccfbe44f75
@ -2,22 +2,6 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. /usr/share/pve-kernel-helper/scripts/functions
|
|
||||||
|
|
||||||
init_boot_disks() {
|
|
||||||
if ! (echo "${curr_uuid}" | grep -qE '[0-9a-fA-F]{4}-[0-9a-fA-F]{4}'); then
|
|
||||||
warn "WARN: ${curr_uuid} read from ${ESP_LIST} does not look like a VFAT-UUID - skipping"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
path="/dev/disk/by-uuid/$curr_uuid"
|
|
||||||
if [ ! -e "${path}" ]; then
|
|
||||||
warn "WARN: ${path} does not exist - clean '${ESP_LIST}'! - skipping"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
proxmox-boot-tool init "$path"
|
|
||||||
}
|
|
||||||
|
|
||||||
if proxmox-boot-tool status --quiet; then
|
if proxmox-boot-tool status --quiet; then
|
||||||
# detect when being called by dpkg (e.g. grub-pc.postinst
|
# detect when being called by dpkg (e.g. grub-pc.postinst
|
||||||
if [ -n "$DPKG_RUNNING_VERSION" ] && echo "$DPKG_MAINTSCRIPT_PACKAGE" | grep -sq "^grub-"; then
|
if [ -n "$DPKG_RUNNING_VERSION" ] && echo "$DPKG_MAINTSCRIPT_PACKAGE" | grep -sq "^grub-"; then
|
||||||
@ -28,7 +12,8 @@ if proxmox-boot-tool status --quiet; then
|
|||||||
MARKER_FILE="/tmp/proxmox-boot-tool.dpkg.marker"
|
MARKER_FILE="/tmp/proxmox-boot-tool.dpkg.marker"
|
||||||
if [ ! -e "$MARKER_FILE" ]; then
|
if [ ! -e "$MARKER_FILE" ]; then
|
||||||
warn "This system is booted via proxmox-boot-tool, running proxmox-boot-tool init for all configured bootdisks"
|
warn "This system is booted via proxmox-boot-tool, running proxmox-boot-tool init for all configured bootdisks"
|
||||||
loop_esp_list init_boot_disks
|
proxmox-boot-tool reinit
|
||||||
|
proxmox-boot-tool refresh
|
||||||
touch "$MARKER_FILE"
|
touch "$MARKER_FILE"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
|
@ -124,7 +124,7 @@ format() {
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init_bootloader() {
|
||||||
part="$1"
|
part="$1"
|
||||||
|
|
||||||
_get_partition_info "$part"
|
_get_partition_info "$part"
|
||||||
@ -174,8 +174,20 @@ init() {
|
|||||||
echo "Adding '$part' to list of synced ESPs.."
|
echo "Adding '$part' to list of synced ESPs.."
|
||||||
_add_entry_to_list_file "$ESP_LIST" "$UUID"
|
_add_entry_to_list_file "$ESP_LIST" "$UUID"
|
||||||
|
|
||||||
echo "Refreshing kernels and initrds.."
|
}
|
||||||
refresh
|
|
||||||
|
reinit() {
|
||||||
|
if ! (echo "${curr_uuid}" | grep -qE '[0-9a-fA-F]{4}-[0-9a-fA-F]{4}'); then
|
||||||
|
warn "WARN: ${curr_uuid} read from ${ESP_LIST} does not look like a VFAT-UUID - skipping"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
path="/dev/disk/by-uuid/$curr_uuid"
|
||||||
|
if [ ! -e "${path}" ]; then
|
||||||
|
warn "WARN: ${path} does not exist - clean '${ESP_LIST}'! - skipping"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
init_bootloader "$path"
|
||||||
}
|
}
|
||||||
|
|
||||||
_clean_impl() {
|
_clean_impl() {
|
||||||
@ -313,6 +325,9 @@ usage() {
|
|||||||
if [ -z "$subcmd" ] || [ "$subcmd" = "init" ]; then
|
if [ -z "$subcmd" ] || [ "$subcmd" = "init" ]; then
|
||||||
warn " $0 init <partition>"
|
warn " $0 init <partition>"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$subcmd" ] || [ "$subcmd" = "reinit" ]; then
|
||||||
|
warn " $0 reinit"
|
||||||
|
fi
|
||||||
if [ -z "$subcmd" ] || [ "$subcmd" = "clean" ]; then
|
if [ -z "$subcmd" ] || [ "$subcmd" = "clean" ]; then
|
||||||
warn " $0 clean [--dry-run]"
|
warn " $0 clean [--dry-run]"
|
||||||
fi
|
fi
|
||||||
@ -342,6 +357,10 @@ help() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo " initialize EFI system partition at <partition> for automatic synchronization of pve-kernels and their associated initrds."
|
echo " initialize EFI system partition at <partition> for automatic synchronization of pve-kernels and their associated initrds."
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "USAGE: $0 reinit"
|
||||||
|
echo ""
|
||||||
|
echo " reinitialize all configured EFI system partitions from $ESP_LIST."
|
||||||
|
echo ""
|
||||||
echo "USAGE: $0 clean [--dry-run]"
|
echo "USAGE: $0 clean [--dry-run]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " remove no longer existing EFI system partition UUIDs from $ESP_LIST. Use --dry-run to only print outdated entries instead of removing them."
|
echo " remove no longer existing EFI system partition UUIDs from $ESP_LIST. Use --dry-run to only print outdated entries instead of removing them."
|
||||||
@ -546,7 +565,21 @@ case "$1" in
|
|||||||
usage "init"
|
usage "init"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
init "$@"
|
init_bootloader "$@"
|
||||||
|
echo "Refreshing kernels and initrds.."
|
||||||
|
refresh
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
'reinit')
|
||||||
|
reexec_in_mountns "$@"
|
||||||
|
shift
|
||||||
|
if [ "$#" -eq 1 ]; then
|
||||||
|
warn "E: no arguments allowed."
|
||||||
|
warn ""
|
||||||
|
usage "reinit"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
loop_esp_list reinit "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
'clean')
|
'clean')
|
||||||
|
Loading…
Reference in New Issue
Block a user