From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 8072960710 for ; Wed, 16 Feb 2022 12:32:36 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 942EA36ED for ; Wed, 16 Feb 2022 12:32:35 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 59D2C36DF for ; Wed, 16 Feb 2022 12:32:34 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 30F2A46173 for ; Wed, 16 Feb 2022 12:32:34 +0100 (CET) Date: Wed, 16 Feb 2022 12:32:27 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20220214155737.1444136-1-s.ivanov@proxmox.com> <20220214155737.1444136-6-s.ivanov@proxmox.com> In-Reply-To: <<20220214155737.1444136-6-s.ivanov@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1645009992.5z1ctnkhlr.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.189 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH pve-kernel-meta 5/5] proxmox-boot: allow to manually specify bootloader X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2022 11:32:36 -0000 On February 14, 2022 4:57 pm, Stoiko Ivanov wrote: > this commit adds the optional [--legacy|--uefi] arguments to > `p-b-t init`. If provided the respective boot-loader is installed > (regardless of what is found on the esp, and of the boot-mode) would IMHO also make sense for `reinit` to do it for all configured=20 ESPs? granted, it's likely that people will switch from 'not managed by=20 p-b-t' to 'managed by p-b-t', and not so likely that they have to switch=20 from 'managed by p-b-t, UEFI' to 'managed by p-b-t, legacy' or=20 vice-versa, but it's basically free and you never know ;) >=20 > This should make switching the boot-mode possible without the need > to boot into a live CD, chrooting and manually running the necessary > p-b-t commands. >=20 > Signed-off-by: Stoiko Ivanov > --- > bin/proxmox-boot-tool | 47 ++++++++++++++++++++++++++++--------------- > 1 file changed, 31 insertions(+), 16 deletions(-) >=20 > diff --git a/bin/proxmox-boot-tool b/bin/proxmox-boot-tool > index c697f64..68401ee 100755 > --- a/bin/proxmox-boot-tool > +++ b/bin/proxmox-boot-tool > @@ -126,6 +126,7 @@ format() { > =20 > init_bootloader() { > part=3D"$1" > + mode=3D"$2" > =20 > install_sd_boot=3D"" > install_grub=3D"" > @@ -153,17 +154,25 @@ init_bootloader() { > echo "Mounting '$part' on '$esp_mp'." > mount -t vfat "$part" "$esp_mp" > =20 > - if [ -e "${esp_mp}/$PMX_LOADER_CONF" ]; then > - install_sd_boot=3D1 > - fi > - if [ -d "${esp_mp}/grub" ]; then > - install_grub=3D1 > - fi > - # always init for the current boot-mode > - if [ -d /sys/firmware/efi ]; then > - install_sd_boot=3D1 > + if [ -n "$mode" ]; then > + if [ "$mode" =3D "--uefi" ]; then > + install_sd_boot=3D1 > + elif [ "$mode" =3D "--legacy" ]; then > + install_grub=3D1 > + fi > else > - install_grub=3D1 > + if [ -e "${esp_mp}/$PMX_LOADER_CONF" ]; then > + install_sd_boot=3D1 > + fi > + if [ -d "${esp_mp}/grub" ]; then > + install_grub=3D1 > + fi > + # always init for the current boot-mode > + if [ -d /sys/firmware/efi ]; then > + install_sd_boot=3D1 > + else > + install_grub=3D1 > + fi > fi > =20 > if [ -n "$install_sd_boot" ]; then > @@ -192,7 +201,6 @@ init_bootloader() { > fi > echo "Unmounting '$part'." > umount "$part" > - > echo "Adding '$part' to list of synced ESPs.." > _add_entry_to_list_file "$ESP_LIST" "$UUID" > =20 > @@ -339,7 +347,7 @@ usage() { > warn "USAGE: $0 [ARGS]" > warn "" > warn " $0 format [--force]" > - warn " $0 init " > + warn " $0 init [--legacy|--uefi]" > warn " $0 reinit" > warn " $0 clean [--dry-run]" > warn " $0 refresh [--hook ]" > @@ -530,10 +538,17 @@ case "$1" in > usage > exit 1 > fi > - init_bootloader "$@" > - echo "Refreshing kernels and initrds.." > - refresh > - exit 0 > + if [ -z "$2" ] || [ "$2" =3D "--legacy" ] || [ "$2" =3D "--uefi" ]; th= en > + init_bootloader "$@" > + echo "Refreshing kernels and initrds.." > + refresh > + exit 0 > + else > + warn "E: invalid 'init' mode '$2'." > + warn "" > + usage > + exit 1 > + fi > ;; > 'reinit') > reexec_in_mountns "$@" > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20