X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=bin%2Fproxmox-boot-tool;fp=bin%2Fproxmox-boot-tool;h=90c4f5d9879ff913a653f5a42e2a2bd949586f62;hb=d5a182ad1de73543afcf3021b81f58e9afd0cd58;hp=329df4219c1b595518df8b46a501d94a4c4c4092;hpb=83a41a1a034c1eab62afe4e5eed27b7f9a3f90f8;p=pve-kernel-meta.git diff --git a/bin/proxmox-boot-tool b/bin/proxmox-boot-tool index 329df42..90c4f5d 100755 --- a/bin/proxmox-boot-tool +++ b/bin/proxmox-boot-tool @@ -288,11 +288,17 @@ list_kernels() { echo "$boot_kernels" pinned_kernel="$(get_first_line "$PINNED_KERNEL_CONF")" + nextboot_kernel="$(get_first_line "$NEXT_BOOT_PIN")" if [ -n "$pinned_kernel" ]; then echo "" echo "Pinned kernel:" echo "${pinned_kernel}" fi + if [ -n "$nextboot_kernel" ]; then + echo "" + echo "Kernel pinned on next-boot:" + echo "${nextboot_kernel}" + fi } usage() { @@ -303,8 +309,8 @@ usage() { warn " $0 clean [--dry-run]" warn " $0 refresh [--hook ]" warn " $0 kernel " - warn " $0 kernel pin " - warn " $0 kernel unpin" + warn " $0 kernel pin [--next-boot]" + warn " $0 kernel unpin [--next-boot]" warn " $0 kernel list" warn " $0 status [--quiet]" warn " $0 help" @@ -332,14 +338,16 @@ help() { echo " add/remove pve-kernel with ABI to list of synced kernels, in addition to automatically selected ones." echo " NOTE: you need to manually run 'refresh' once you're finished with adding/removing kernels from the list" echo "" - echo "USAGE: $0 kernel pin " + echo "USAGE: $0 kernel pin [--next-boot]" echo "" echo " pin pve-kernel with ABI as the default entry to be booted." + echo " with --next-boot sets only for the next boot." echo " NOTE: you need to manually run 'refresh' once you're finished with pinning kernels" echo "" - echo "USAGE: $0 kernel unpin" + echo "USAGE: $0 kernel unpin [--next-boot]" echo "" - echo " unpin sets the latest kernel as the default entry (undoes a previous pin)" + echo " unpin removes pinned and next-boot kernel settings." + echo " with --next-boot only removes the pin for the next boot." echo "" echo "USAGE: $0 kernel list" echo "" @@ -412,6 +420,7 @@ status() { pin_kernel() { ver="$1" + pin_file="$2" if [ -z "$ver" ]; then warn "E: is mandatory" @@ -419,17 +428,25 @@ pin_kernel() { exit 1 fi + if [ -z "$pin_file" ]; then + pin_file="$PINNED_KERNEL_CONF" + fi + if [ ! -e "/boot/vmlinuz-$ver" ]; then warn "E: no kernel image found in /boot for '$ver', not setting default." exit 1 fi - echo "$ver" > "$PINNED_KERNEL_CONF" - echo "Set kernel '$ver' $PINNED_KERNEL_CONF. Use the 'refresh' command to update the ESPs." + echo "$ver" > "$pin_file" + echo "Set kernel '$ver' in $pin_file. Use the 'refresh' command to update the ESPs." } unpin_kernel() { - rm -f "$PINNED_KERNEL_CONF" - echo "Removed $PINNED_KERNEL_CONF. Use the 'refresh' command to update the ESPs." + rm -f "$NEXT_BOOT_PIN" + echo "Removed $NEXT_BOOT_PIN. Use the 'refresh' command to update the ESPs." + if [ -z "$1" ]; then + rm -f "$PINNED_KERNEL_CONF" + echo "Removed $PINNED_KERNEL_CONF. Use the 'refresh' command to update the ESPs." + fi } if [ -z "$1" ]; then @@ -501,11 +518,25 @@ case "$1" in exit 0 ;; 'pin') - pin_kernel "$2" + if [ "$#" -eq 3 ] && [ "$3" = '--next-boot' ]; then + pin_kernel "$2" "${NEXT_BOOT_PIN}" + elif [ "$#" -eq 2 ]; then + pin_kernel "$2" + else + usage + exit 1 + fi exit 0 ;; 'unpin') - unpin_kernel "$2" + if [ "$#" -eq 2 ] && [ "$2" = '--next-boot' ]; then + unpin_kernel "$2" + elif [ "$#" -eq 1 ]; then + unpin_kernel + else + usage + exit 1 + fi exit 0 ;; *)