public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stoiko Ivanov <s.ivanov@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-kernel-meta 4/5] proxmox-boot: add kernel next-boot command
Date: Tue, 1 Feb 2022 10:56:21 +0100	[thread overview]
Message-ID: <5288e11a-22c1-c752-38c2-29639faec4be@proxmox.com> (raw)
In-Reply-To: <20220131175918.2099575-5-s.ivanov@proxmox.com>

One small nit at the end:

On 1/31/22 18:59, Stoiko Ivanov wrote:
> by pinning the desired version and touching a flag file, which is used
> by the systemd service as condition for unpinning and refreshing upon
> reboot
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
>   bin/proxmox-boot-tool                     |  9 +++++++--
>   debian/pve-kernel-helper.install          |  1 +
>   debian/rules                              |  3 +++
>   proxmox-boot/Makefile                     |  4 ++++
>   proxmox-boot/functions                    |  1 +
>   proxmox-boot/proxmox-boot-cleanup.service | 15 +++++++++++++++
>   6 files changed, 31 insertions(+), 2 deletions(-)
>   create mode 100644 proxmox-boot/proxmox-boot-cleanup.service
> 
> diff --git a/bin/proxmox-boot-tool b/bin/proxmox-boot-tool
> index 75eea0e..005109a 100755
> --- a/bin/proxmox-boot-tool
> +++ b/bin/proxmox-boot-tool
> @@ -302,7 +302,7 @@ usage() {
>   	warn "       $0 init <partition>"
>   	warn "       $0 clean [--dry-run]"
>   	warn "       $0 refresh [--hook <name>]"
> -	warn "       $0 kernel <add|remove|pin> <kernel-version>"
> +	warn "       $0 kernel <add|remove|pin|next-boot> <kernel-version>"
>   	warn "       $0 kernel <list|unpin>"
>   	warn "       $0 status [--quiet]"
>   	warn "       $0 help"
> @@ -325,7 +325,7 @@ help() {
>   	echo ""
>   	echo "    refresh all configured EFI system partitions. Use --hook to only run the specified hook, omit to run all."
>   	echo ""
> -	echo "USAGE: $0 kernel <add|remove|pin> <kernel-version>"
> +	echo "USAGE: $0 kernel <add|remove|pin|next-boot> <kernel-version>"
>   	echo ""
>   	echo "    add/remove pve-kernel with ABI <kernel-version> 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"
> @@ -499,6 +499,11 @@ case "$1" in
>   				unpin_kernel "$2"
>   				exit 0
>   			;;
> +			'next-boot')
> +				pin_kernel "$2"
> +				touch "${PMX_NEXT_BOOT_FILE}"
> +				exit 0
> +			;;
>   			*)
>   				warn "E: invalid 'kernel' subcommand '$cmd'."
>   				warn ""
> diff --git a/debian/pve-kernel-helper.install b/debian/pve-kernel-helper.install
> index 5f264aa..33170fb 100644
> --- a/debian/pve-kernel-helper.install
> +++ b/debian/pve-kernel-helper.install
> @@ -2,6 +2,7 @@ etc/grub.d/000_proxmox_boot_header
>   etc/kernel/postinst.d/*
>   etc/kernel/postrm.d/*
>   etc/initramfs/post-update.d/proxmox-boot-sync
> +lib/systemd/system/proxmox-boot-cleanup.service
>   usr/sbin/proxmox-boot-tool
>   usr/sbin/grub-install
>   usr/share/pve-kernel-helper/scripts/functions
> diff --git a/debian/rules b/debian/rules
> index 58f7f7d..3dd1bc8 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -12,5 +12,8 @@ debian/control: $(wildcard debian/*.in)
>   %:
>   	dh $@
>   
> +override_dh_installsystemd:
> +	dh_installsystemd --no-start
> +
>   .PHONY: build clean
>   build clean:
> diff --git a/proxmox-boot/Makefile b/proxmox-boot/Makefile
> index effd726..2b0685d 100644
> --- a/proxmox-boot/Makefile
> +++ b/proxmox-boot/Makefile
> @@ -2,12 +2,14 @@ KERNEL_HOOKSCRIPTS = proxmox-auto-removal zz-proxmox-boot
>   INITRAMFS_HOOKSCRIPTS = proxmox-boot-sync
>   SHARE_FILES = functions
>   GRUB_CFG_SNIPPET = 000_proxmox_boot_header
> +SYSTEMD_SERVICES = proxmox-boot-cleanup.service
>   
>   POSTINSTHOOKDIR = ${DESTDIR}/etc/kernel/postinst.d
>   POSTRMHOOKDIR = ${DESTDIR}/etc/kernel/postrm.d
>   POSTINITRAMFSHOOKDIR = ${DESTDIR}/etc/initramfs/post-update.d
>   SHARE_SCRIPTDIR = ${DESTDIR}/usr/share/pve-kernel-helper/scripts
>   GRUB_CFG_DIR = ${DESTDIR}/etc/grub.d
> +SERVICE_DIR = ${DESTDIR}/lib/systemd/system
>   
>   .PHONY: all
>   all:
> @@ -23,6 +25,8 @@ install:
>   	install -m 0755 ${SHARE_FILES} ${SHARE_SCRIPTDIR}
>   	install -d ${GRUB_CFG_DIR}
>   	install -m 0755 ${GRUB_CFG_SNIPPET} ${GRUB_CFG_DIR}
> +	install -d ${SERVICE_DIR}
> +	install -m 0644 ${SYSTEMD_SERVICES} ${SERVICE_DIR}
>   
>   .PHONY: clean distclean
>   distclean:
> diff --git a/proxmox-boot/functions b/proxmox-boot/functions
> index 9fa29ca..3bea421 100755
> --- a/proxmox-boot/functions
> +++ b/proxmox-boot/functions
> @@ -6,6 +6,7 @@ ESPTYPE='c12a7328-f81f-11d2-ba4b-00a0c93ec93b'
>   
>   MANUAL_KERNEL_LIST="/etc/kernel/pve-efiboot-manual-kernels"
>   PINNED_KERNEL_CONF="/etc/kernel/proxmox-boot-pin"
> +PMX_NEXT_BOOT_FILE="/etc/kernel/next-boot-active"
>   
>   MOUNTROOT="${TMPDIR:-/var/tmp}/espmounts"
>   # relative to the ESP mountpoint
> diff --git a/proxmox-boot/proxmox-boot-cleanup.service b/proxmox-boot/proxmox-boot-cleanup.service
> new file mode 100644
> index 0000000..3c390de
> --- /dev/null
> +++ b/proxmox-boot/proxmox-boot-cleanup.service
> @@ -0,0 +1,15 @@
> +[Unit]
> +Description=Clean up bootloader next-boot setting
> +After=systemd-remount-fs.service
> +ConditionPathExists=/etc/kernel/next-boot-active
> +
> +[Service]
> +Type=oneshot
> +RemainAfterExit=yes
> +ExecStart=/usr/sbin/proxmox-boot-tool kernel unpin
> +ExecStart=/usr/sbin/proxmox-boot-tool refresh
> +ExecStart=/bin/rm -f /etc/kernel/next-boot-active
> +
> +[Install]
> +WantedBy=multi-user.target
> +

Do we want a newline here at the end of the unit file?




  reply	other threads:[~2022-02-01  9:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 17:59 [pve-devel] [PATCH pve-kernel-meta 0/5] proxmox-boot: add kernel pinning functionality (#3761) Stoiko Ivanov
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 1/5] proxmox-boot: drop unused potential_esps function Stoiko Ivanov
2022-02-04 16:47   ` [pve-devel] applied: " Thomas Lamprecht
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 2/5] proxmox-boot: add get_first_line_from_file helper and use it Stoiko Ivanov
2022-02-04 16:47   ` [pve-devel] applied: " Thomas Lamprecht
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 3/5] proxmox-boot: fix #3671 add pin/unpin for kernel-version Stoiko Ivanov
     [not found]   ` <<20220131175918.2099575-4-s.ivanov@proxmox.com>
2022-02-01 11:35     ` Fabian Grünbichler
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 4/5] proxmox-boot: add kernel next-boot command Stoiko Ivanov
2022-02-01  9:56   ` Aaron Lauterer [this message]
     [not found]   ` <<20220131175918.2099575-5-s.ivanov@proxmox.com>
2022-02-01 11:34     ` Fabian Grünbichler
2022-01-31 17:59 ` [pve-devel] [PATCH pve-kernel-meta 5/5] proxmox-boot: add pin/unpin functionality for non-p-b-t systems Stoiko Ivanov
2022-02-01  9:58 ` [pve-devel] [PATCH pve-kernel-meta 0/5] proxmox-boot: add kernel pinning functionality (#3761) Aaron Lauterer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5288e11a-22c1-c752-38c2-29639faec4be@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.ivanov@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal