Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package sdbootutil for openSUSE:Factory checked in at 2023-10-20 23:16:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sdbootutil (Old) and /work/SRC/openSUSE:Factory/.sdbootutil.new.1945 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sdbootutil" Fri Oct 20 23:16:13 2023 rev:6 rq:1118843 version:1+git20231005.890f70c Changes: -------- --- /work/SRC/openSUSE:Factory/sdbootutil/sdbootutil.changes 2023-09-21 22:15:08.747657484 +0200 +++ /work/SRC/openSUSE:Factory/.sdbootutil.new.1945/sdbootutil.changes 2023-10-20 23:17:01.551086427 +0200 @@ -1,0 +2,19 @@ +Thu Oct 19 06:15:45 UTC 2023 - Fabian Vogt <fv...@suse.de> + +- Add changes from gh#openSUSE/sdbootutil#21: + * sdbootutil.spec: Add missing efibootmgr dependency + * sdbootutil.spec: Make sdbootutil-snapper a hard dependency + +------------------------------------------------------------------- +Thu Oct 12 15:02:17 UTC 2023 - lnus...@suse.de + +- Update to version 1+git20231005.890f70c: + * Add --no-reuse-initrd option + * Refactor boot descriptive entries + * feat: more descriptive bootmenu entries + * Remove stray set -x + * speed up snapper list + * Fix misleading comment + * Fix helptext + +------------------------------------------------------------------- Old: ---- sdbootutil-1+git20230817.2a3cd34.obscpio New: ---- sdbootutil-1+git20231005.890f70c.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sdbootutil.spec ++++++ --- /var/tmp/diff_new_pack.ZPY4PW/_old 2023-10-20 23:17:02.319114449 +0200 +++ /var/tmp/diff_new_pack.ZPY4PW/_new 2023-10-20 23:17:02.319114449 +0200 @@ -27,16 +27,18 @@ %define git_version %{nil} %endif Name: sdbootutil -Version: 1+git20230817.2a3cd34%{git_version} +Version: 1+git20231005.890f70c%{git_version} Release: 0 Summary: script to install shim with sd-boot License: MIT URL: https://en.opensuse.org/openSUSE:Usr_merge Source: %{name}-%{version}.tar +Requires: efibootmgr Requires: jq Requires: sed Requires: systemd-boot Supplements: (systemd-boot and shim) +Requires: (%{name}-snapper if (snapper and btrfsprogs)) %description Hook scripts to install shim along with systemd-boot @@ -47,7 +49,6 @@ Requires: btrfsprogs Requires: sdbootutil >= %{version}-%{release} Requires: snapper -Supplements: (snapper and btrfsprogs and sdbootutil) %description snapper Plugin scripts for snapper to handle BLS config files ++++++ _service ++++++ --- /var/tmp/diff_new_pack.ZPY4PW/_old 2023-10-20 23:17:02.351115617 +0200 +++ /var/tmp/diff_new_pack.ZPY4PW/_new 2023-10-20 23:17:02.355115763 +0200 @@ -5,7 +5,7 @@ <param name="revision">main</param> <param name="versionformat">1+git%cd.%h</param> <param name="changesgenerate">enable</param> - <param name="extract">sdbootutil.spec</param> +<!-- <param name="extract">sdbootutil.spec</param>--> </service> <service name="set_version" mode="manual" /> <service name="tar" mode="buildtime"/> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.ZPY4PW/_old 2023-10-20 23:17:02.379116639 +0200 +++ /var/tmp/diff_new_pack.ZPY4PW/_new 2023-10-20 23:17:02.379116639 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/lnussel/sdbootutil.git</param> - <param name="changesrevision">2a3cd34a65361917adef2023dc312362af7e970d</param></service></servicedata> + <param name="changesrevision">890f70c9550b67c48f47e6968b6ffdde0cddc1bc</param></service></servicedata> (No newline at EOF) ++++++ sdbootutil-1+git20230817.2a3cd34.obscpio -> sdbootutil-1+git20231005.890f70c.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdbootutil-1+git20230817.2a3cd34/10-sdbootutil.snapper new/sdbootutil-1+git20231005.890f70c/10-sdbootutil.snapper --- old/sdbootutil-1+git20230817.2a3cd34/10-sdbootutil.snapper 2023-08-17 14:01:37.000000000 +0200 +++ new/sdbootutil-1+git20231005.890f70c/10-sdbootutil.snapper 2023-10-05 13:58:03.000000000 +0200 @@ -3,10 +3,9 @@ shopt -s extglob nullglob set -e +# check whether it's a transactional system is_transactional() { - # don't handle this here if called within transactional-update. We have - # to run after it's done doing it's thing. [ "$(stat -f -c %T /etc)" = "overlayfs" ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sdbootutil-1+git20230817.2a3cd34/sdbootutil new/sdbootutil-1+git20231005.890f70c/sdbootutil --- old/sdbootutil-1+git20230817.2a3cd34/sdbootutil 2023-08-17 14:01:37.000000000 +0200 +++ new/sdbootutil-1+git20231005.890f70c/sdbootutil 2023-10-05 13:58:03.000000000 +0200 @@ -17,6 +17,7 @@ arg_entry_token= arg_arch= arg_no_variables= +arg_no_reuse_initrd= # for x in vmlinuz image vmlinux linux bzImage uImage Image zImage; do image=vmlinuz @@ -41,6 +42,7 @@ entryfile="$tmpdir/entries.json" snapperfile="$tmpdir/snapper.json" +title_sort_file="$tmpdir/title_sort.txt" tmpfile="$tmpdir/tmp" helpandquit() @@ -55,24 +57,24 @@ add-kernel VERSION [SUBVOL] Create boot entry for specified kernel - add-all-kernels [SUBVOL] - Create boot entries for all kernels in SUBVOL + add-all-kernels [SNAPSHOT] + Create boot entries for all kernels in SNAPSHOT remove-kernel VERSION [SUBVOL] Remove boot entry for specified kernel - remove-all-kernels [SUBVOL] - Remove boot entries for all kernels in SUBVOL + remove-all-kernels [SNAPSHOT] + Remove boot entries for all kernels in SNAPSHOT - list-kernels [SUBVOL] - List all kernels related to SUBVOL + list-kernels [SNAPSHOT] + List all kernels related to SNAPSHOT - set-default-snapshot [SUBVOL] - Make SUBVOL the default for next boot. + set-default-snapshot [SNAPSHOT] + Make SNAPSHOT the default for next boot. Also install all kernels if needed - is-bootable [SUBVOL] - Check whether SUBVOL has any kernels registered, ie + is-bootable [SNAPSHOT] + Check whether SNAPSHOT has any kernels registered, ie is potentially bootable install Install systemd-boot and shim into ESP @@ -173,6 +175,12 @@ dh_text=$((LINES-5)) } +# check whether it's a transactional system +is_transactional() +{ + [ "$(stat -f -c %T /etc)" = "overlayfs" ] +} + subvol_is_ro() { local subvol="${1:?}" @@ -233,6 +241,76 @@ log_info "installed $dst" } +update_snapper() +{ + snapper --jsonout --no-dbus list --disable-used-space > "$snapperfile" +} + +set_snapper_title_and_sortkey() +{ + snapshot="${1:?}" + local type date desc important pre_num + local snapshot_info + + update_snapper + + IFS="|" read -r type date desc important pre_num <<< \ + $(jq -r --arg snapshot "$snapshot" \ + '.["root"][]|select(.number==( $snapshot|tonumber))|[.type,.date,(.description|gsub("\\|";"_")),.userdata.important,."pre-number"//""]|join("|")'\ + < "$snapperfile") + + if [ -z "$desc" ] && [ "$type" = "post" ] && [ -n "$pre_num" ]; then + read -r desc <<< $(jq -r --arg snapshot "$pre_num" '.["root"][]|select(.number==($snapshot|tonumber))|.description' < "$snapperfile") + fi + + if [ "$important" = "yes" ]; then important="*"; else important=""; fi + [ "$type" = "single" ] && type="" + snapshot_info="$snapshot,$kernel_version,$date${type:+, $type}${desc:+, $desc}" + + # shellcheck disable=SC2154 + title="Snapper: ${important}$title ($snapshot_info)" + sort_key="snapper-$sort_key" +} + +reuse_initrd() { + local snapshot="${1:?}" + local subvol="${2:?}" + + [ -z "$arg_no_reuse_initrd" ] || return 1 + + local conf="$boot_root/loader/entries/$entry_token-$kernel_version-$snapshot.conf" + if [ -e "$conf" ]; then + local k + local v + while read -r k v; do + [ "$k" = 'initrd' ] || continue + log_info "found existing initrd $v" + dstinitrd="$v" + break + done < "$conf" + [ -z "$dstinitrd" ] || return 0 + fi + + # check if we can reuse the initrd from the parent + # to avoid expensive regeneration + detect_parent "$subvol" + local parent_conf="$boot_root/loader/entries/$entry_token-$kernel_version-$parent_snapshot.conf" + if [ -n "$parent_subvol" ] && [ -e "$parent_conf" ]; then + #subvol_is_ro "$parent_subvol" || err "Parent snapshot $parent_snapshot is not read-only, can't reuse initrd" + local k + local v + while read -r k v; do + [ "$k" = 'initrd' ] || continue + log_info "found parent initrd $v" + dstinitrd="$v" + break + done < "$parent_conf" + [ -z "$dstinitrd" ] || return 0 + fi + + return 1 +} + install_kernel() { local subvol="$1" @@ -242,10 +320,11 @@ test -e "$src" || err "Can't find $src" calc_chksum "$src" - dst="/$entry_token/$kernel_version/linux-$chksum" + local dst="/$entry_token/$kernel_version/linux-$chksum" + # XXX: fix calling with snapshot instead of subvol local snapshot="${subvol#@/.snapshots/}" - snapshot="${snapshot%/*}" + snapshot="${snapshot%/snapshot}" local initrd="${src%/*}/initrd" @@ -253,28 +332,12 @@ if [ -e "$initrd" ]; then ln -s "$initrd" "$tmpdir/initrd" - else - # check if we can reuse the initrd from the parent - # to avoid expensive regeneration - detect_parent "$subvol" - parent_conf="$boot_root/loader/entries/$entry_token-$kernel_version-$parent_snapshot.conf" - if [ -n "$parent_subvol" ] && [ -e "$parent_conf" ]; then - #subvol_is_ro "$parent_subvol" || err "Parent snapshot $parent_snapshot is not read-only, can't reuse initrd" - local k - local v - while read -r k v; do - [ "$k" = 'initrd' ] || continue - log_info "found previous initrd $v" - dstinitrd="$v" - break - done < "$parent_conf" - [ -n "$dstinitrd" ] || err "no initrd for kernel $kernel_version in parent snapshot $parent_snapshot found" - elif [ "$subvol" != "$root_subvol" ]; then + elif ! reuse_initrd "$snapshot" "$subvol"; then + if [ "$subvol" != "$root_subvol" ]; then err "Can't call dracut for snapshots that have no initrd yet" - else - log_info "generating new initrd" - run_command_live_output dracut --quiet --reproducible "$tmpdir/initrd" "$kernel_version" fi + log_info "generating new initrd" + run_command_live_output dracut --quiet --reproducible "$tmpdir/initrd" "$kernel_version" fi local boot_options= @@ -289,14 +352,22 @@ dstinitrd="${dst%/*}/initrd-$chksum" fi + title="${os_release_PRETTY_NAME:-Linux $kernel_version}" + # TW pretty name does not include the version + [ -n "$os_release_VERSION" ] || title="$title $os_release_VERSION_ID" # shellcheck disable=SC2154 sort_key="$os_release_ID" - entry_machine_id= + + if ! is_transactional && subvol_is_ro "$subvol"; then + set_snapper_title_and_sortkey "$snapshot" + fi + + local entry_machine_id= [ "$entry_token" = "$machine_id" ] && entry_machine_id="$machine_id" cat > "$tmpdir/entry.conf" <<-EOF # Boot Loader Specification type#1 entry - title ${os_release_PRETTY_NAME:-Linux $kernel_version} + title $title version $snapshot@$kernel_version${entry_machine_id:+${nl}machine-id $entry_machine_id}${sort_key:+${nl}sort-key $sort_key} options $boot_options linux $dst @@ -473,11 +544,6 @@ done } -update_snapper() -{ - snapper --jsonout list > "$snapperfile" -} - show_snapper() { if ! update_snapper 2>"$tmpfile"; then @@ -760,7 +826,6 @@ [ -e "$boot_root/loader/loader.conf" ] || echo -e "#timeout 3\n#console-mode keep\n" > "$boot_root/loader/loader.conf" - set -x # Create boot menu entry if it does not exist [ -n "$arg_no_variables" ] || efibootmgr | grep -q 'Boot.*openSUSE Boot Manager' || efibootmgr -q --create --disk "$drive" --part "$partno" --label "openSUSE Boot Manager" --loader "$entry" || true } @@ -871,7 +936,7 @@ ####### main ####### -getopttmp=$(getopt -o hc:v --long help,flicker,verbose,esp-path:,entry-token:,arch:,image:,no-variables -n "${0##*/}" -- "$@") +getopttmp=$(getopt -o hc:v --long help,flicker,verbose,esp-path:,entry-token:,arch:,image:,no-variables,no-reuse-initrd -n "${0##*/}" -- "$@") eval set -- "$getopttmp" while true ; do @@ -884,6 +949,7 @@ --entry-token) arg_entry_token="$2"; shift 2 ;; --image) image="$2"; shift 2 ;; --no-variables) arg_no_variables=1; shift ;; + --no-reuse-initrd) arg_no_reuse_initrd=1; shift ;; --) shift ; break ;; *) echo "Internal error!" ; exit 1 ;; esac ++++++ sdbootutil.obsinfo ++++++ --- /var/tmp/diff_new_pack.ZPY4PW/_old 2023-10-20 23:17:02.527122038 +0200 +++ /var/tmp/diff_new_pack.ZPY4PW/_new 2023-10-20 23:17:02.531122184 +0200 @@ -1,5 +1,5 @@ name: sdbootutil -version: 1+git20230817.2a3cd34 -mtime: 1692273697 -commit: 2a3cd34a65361917adef2023dc312362af7e970d +version: 1+git20231005.890f70c +mtime: 1696507083 +commit: 890f70c9550b67c48f47e6968b6ffdde0cddc1bc