Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package sdbootutil for openSUSE:Factory 
checked in at 2024-01-24 19:04:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sdbootutil (Old)
 and      /work/SRC/openSUSE:Factory/.sdbootutil.new.16006 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sdbootutil"

Wed Jan 24 19:04:31 2024 rev:14 rq:1140775 version:1+git20240122.c0d8f76

Changes:
--------
--- /work/SRC/openSUSE:Factory/sdbootutil/sdbootutil.changes    2024-01-22 
20:31:21.306929673 +0100
+++ /work/SRC/openSUSE:Factory/.sdbootutil.new.16006/sdbootutil.changes 
2024-01-24 19:04:33.325812527 +0100
@@ -1,0 +2,13 @@
+Tue Jan 23 07:46:31 UTC 2024 - [email protected]
+
+- Update to version 1+git20240122.c0d8f76:
+  * Integrate with kernel-install
+  * Rework kernel listing a bit
+  * Add checks to list-entries
+  * List entries for current system only by default
+  * Fall back to loader.conf if setting efivar failed
+  * Runtime determine kernel image name
+  * Add list-snapshots
+  * Add list-entries command
+
+-------------------------------------------------------------------

Old:
----
  sdbootutil-1+git20240118.7e744b4.obscpio

New:
----
  sdbootutil-1+git20240122.c0d8f76.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sdbootutil.spec ++++++
--- /var/tmp/diff_new_pack.kabsRR/_old  2024-01-24 19:04:34.485854438 +0100
+++ /var/tmp/diff_new_pack.kabsRR/_new  2024-01-24 19:04:34.485854438 +0100
@@ -27,7 +27,7 @@
 %define git_version %{nil}
 %endif
 Name:           sdbootutil
-Version:        1+git20240118.7e744b4%{git_version}
+Version:        1+git20240122.c0d8f76%{git_version}
 Release:        0
 Summary:        script to install shim with sd-boot
 License:        MIT
@@ -69,6 +69,15 @@
 Scriptlets that call sdbootutil to create boot entries when
 kernels are installed or removed
 
+%package kernel-install
+Summary:        Hook script for kernel-install
+Requires:       /usr/bin/kernel-install
+Requires:       sdbootutil >= %{version}-%{release}
+
+%description kernel-install
+Plugin script for kernel-install. Note: installation of this
+package may disable other plugin scripts that are incompatible.
+
 %prep
 %setup -q
 
@@ -76,9 +85,6 @@
 
 %install
 install -D -m 755 sdbootutil %{buildroot}%{_bindir}/sdbootutil
-%ifarch aarch64
-    sed -i -e 's/^image=vmlinuz/image=Image/' %{buildroot}%{_bindir}/sdbootutil
-%endif
 
 mkdir -p %{buildroot}%{_prefix}/lib/module-init-tools/kernel-scriptlets
 for a in rpm; do
@@ -99,6 +105,19 @@
   install -m 755 $i %{buildroot}%{_prefix}/lib/snapper/plugins/$i
 done
 
+# kernel-install
+install -d -m755 %{buildroot}%{_prefix}/lib/kernel/install.d
+for i in 50-sdbootutil.install; do
+  install -m 755 $i %{buildroot}%{_prefix}/lib/kernel/install.d/$i
+done
+
+# tmpfiles
+install -d -m755 %{buildroot}%{_prefix}/lib/tmpfiles.d
+for i in kernel-install-sdbootutil.conf; do
+  install -m 755 $i %{buildroot}%{_prefix}/lib/tmpfiles.d/$i
+done
+mkdir -p %{buildroot}/etc/kernel/install.d
+
 %transfiletriggerin -- /usr/lib/systemd/boot/efi /usr/share/efi/%_build_arch
 cat > /dev/null || :
 [ "$YAST_IS_RUNNING" != 'instsys' ] || exit 0
@@ -107,6 +126,9 @@
 [ -z "$VERBOSE_FILETRIGGERS" ] || echo "%{name}-%{version}-%{release}: 
updating bootloader"
 sdbootutil update
 
+%posttrans kernel-install
+%tmpfiles_create kernel-install-sdbootutil.conf
+
 %files
 %license LICENSE
 %{_bindir}/sdbootutil
@@ -120,3 +142,15 @@
 %dir %{_prefix}/lib/snapper/plugins
 %{_prefix}/lib/snapper/plugins/*
 
+%files kernel-install
+%dir %{_prefix}/lib/kernel
+%dir %{_prefix}/lib/kernel/install.d
+%{_prefix}/lib/kernel/install.d/*
+%{_prefix}/lib/tmpfiles.d/kernel-install-sdbootutil.conf
+%dir /etc/kernel
+%dir /etc/kernel/install.d
+%ghost %config(noreplace,missingok) /etc/kernel/install.d/50-depmod.install
+%ghost %config(noreplace,missingok) /etc/kernel/install.d/50-dracut.install
+%ghost %config(noreplace,missingok) 
/etc/kernel/install.d/51-dracut-rescue.install
+%ghost %config(noreplace,missingok) 
/etc/kernel/install.d/90-loaderentry.install
+

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.kabsRR/_old  2024-01-24 19:04:34.525855883 +0100
+++ /var/tmp/diff_new_pack.kabsRR/_new  2024-01-24 19:04:34.529856028 +0100
@@ -3,6 +3,6 @@
                 <param 
name="url">https://github.com/lnussel/sdbootutil.git</param>
               <param 
name="changesrevision">8a4e6e9bb0bbaa9c5a5463cdeb21bb9cf8777b48</param></service><service
 name="tar_scm">
                 <param 
name="url">https://github.com/openSUSE/sdbootutil.git</param>
-              <param 
name="changesrevision">7e744b4b8ecda1b49d5f296572204a850c4fe01b</param></service></servicedata>
+              <param 
name="changesrevision">c0d8f7643bf6a68cdaa578016edb7affaa38dd91</param></service></servicedata>
 (No newline at EOF)
 

++++++ sdbootutil-1+git20240118.7e744b4.obscpio -> 
sdbootutil-1+git20240122.c0d8f76.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sdbootutil-1+git20240118.7e744b4/50-sdbootutil.install 
new/sdbootutil-1+git20240122.c0d8f76/50-sdbootutil.install
--- old/sdbootutil-1+git20240118.7e744b4/50-sdbootutil.install  1970-01-01 
01:00:00.000000000 +0100
+++ new/sdbootutil-1+git20240122.c0d8f76/50-sdbootutil.install  2024-01-22 
18:33:40.000000000 +0100
@@ -0,0 +1,36 @@
+#!/bin/bash
+# SPDX-License-Identifier: MIT
+# SPDX-FileCopyrightText: Copyright 2024 SUSE LLC
+
+set -e
+
+COMMAND="${1:?}"
+KERNEL_VERSION="${2:?}"
+# shellcheck disable=SC2034
+ENTRY_DIR_ABS="${3:?}"
+# shellcheck disable=SC2034
+KERNEL_IMAGE="$4"
+
+[ "$KERNEL_INSTALL_LAYOUT" = "bls" ] || exit 0
+
+MACHINE_ID="${KERNEL_INSTALL_MACHINE_ID:?}"
+
+args=()
+[ "$KERNEL_INSTALL_VERBOSE" -lt 1 ] || args+=("-v")
+args+=("--esp-path=$KERNEL_INSTALL_BOOT_ROOT" 
"--entry-token=$KERNEL_INSTALL_ENTRY_TOKEN")
+
+case "$COMMAND" in
+       remove)
+               exec /usr/bin/sdbootutil "${args[@]}" remove-kernel 
"$KERNEL_VERSION"
+               ;;
+       add)
+               if [ "${KERNEL_IMAGE#/usr/lib/modules/$KERNEL_VERSION}" = 
"$KERNEL_IMAGE" ]; then
+                       echo "Unupported kernel location $KERNEL_IMAGE" >&2
+                       exit 1
+               fi
+               exec /usr/bin/sdbootutil "${args[@]}" 'add-kernel' 
"$KERNEL_VERSION"
+               ;;
+       *)
+               exit 0
+               ;;
+esac
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/sdbootutil-1+git20240118.7e744b4/kernel-install-sdbootutil.conf 
new/sdbootutil-1+git20240122.c0d8f76/kernel-install-sdbootutil.conf
--- old/sdbootutil-1+git20240118.7e744b4/kernel-install-sdbootutil.conf 
1970-01-01 01:00:00.000000000 +0100
+++ new/sdbootutil-1+git20240122.c0d8f76/kernel-install-sdbootutil.conf 
2024-01-22 18:33:40.000000000 +0100
@@ -0,0 +1,7 @@
+# disable all kernel-install scripts that are known incompatible
+# with sdbootutil. TODO: should be in in /run:
+# https://github.com/systemd/systemd/pull/30480
+L /etc/kernel/install.d/50-depmod.install - - - - /dev/null
+L /etc/kernel/install.d/50-dracut.install - - - - /dev/null
+L /etc/kernel/install.d/51-dracut-rescue.install - - - - /dev/null
+L /etc/kernel/install.d/90-loaderentry.install - - - - /dev/null
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sdbootutil-1+git20240118.7e744b4/sdbootutil 
new/sdbootutil-1+git20240122.c0d8f76/sdbootutil
--- old/sdbootutil-1+git20240118.7e744b4/sdbootutil     2024-01-18 
09:08:21.000000000 +0100
+++ new/sdbootutil-1+git20240122.c0d8f76/sdbootutil     2024-01-22 
18:33:40.000000000 +0100
@@ -16,10 +16,11 @@
 arg_esp_path="$SYSTEMD_ESP_PATH"
 arg_entry_token=
 arg_arch=
+arg_all_entries=
 arg_no_variables=
 arg_no_reuse_initrd=
 # for x in vmlinuz image vmlinux linux bzImage uImage Image zImage; do
-image=vmlinuz
+image=
 
 update_predictions=
 
@@ -77,6 +78,12 @@
                list-kernels [SNAPSHOT]
                           List all kernels related to SNAPSHOT
 
+               list-entries [SNAPSHOT]
+                          List all entries related to SNAPSHOT
+
+               list-snapshots
+                          List all snapshots
+
                set-default-snapshot [SNAPSHOT]
                           Make SNAPSHOT the default for next boot.
                           Also install all kernels if needed
@@ -483,19 +490,73 @@
        update_entries jq 
"[.[]|select(has(\"options\"))|select(.options|match(\"root=UUID=$root_uuid 
.*rootflags=subvol=$subvol\"))]"
 }
 
-
-
 update_entries_for_snapshot()
 {
        local n="$1"
        update_entries_for_subvol "@/.snapshots/$n/snapshot"
 }
 
+update_entries_for_this_system()
+{
+       update_entries jq 
"[.[]|select(has(\"options\"))|select(.options|match(\"root=UUID=$root_uuid\"))]"
+}
+
+
+list_entries()
+{
+       if [ ! -s "$entryfile" ]; then
+               if [ -n "$1" ]; then
+                       update_entries_for_snapshot "$1"
+               elif [ -n "$arg_all_entries" ]; then
+                       update_entries
+               else
+                       update_entries_for_this_system
+               fi
+       fi
+
+       local isdefault isreported type id root conf title
+       while read -r isdefault isreported type id root conf title; do
+               color=
+               if [ "$isdefault" = "true" ]; then
+                       color="\e[1;4m"
+               fi
+               if [ "$isreported" = "false" ]; then
+                       color="$color\e[32m"
+               fi
+               if [ "$type" = "loader" ]; then
+                       color="$color\e[33m"
+               fi
+               local errors=()
+               if [ -n "$verbose" ] && [ -n "$conf" ] && [  -e "$conf" ]; then
+                       local k
+                       local v
+                       while read -r k v; do
+                               if [ "$k" = 'linux' ] || [ "$k" = 'initrd' ] ; 
then
+                                       if [ ! -e "$root$v" ]; then
+                                               errors+=("$root/$v does not 
exist")
+                                       fi
+                               fi
+                               if [ "$k" = 'options' ]; then
+                                       local snapshot
+                                       read -r snapshot <<<"$(echo "$v" | sed 
-e 's,.*rootflags=subvol=@/.snapshots/\([0-9]\+\)/snapshot.*,\1,')"
+                                       if [ ! -d 
"/.snapshots/$snapshot/snapshot" ]; then
+                                               
errors+=("/.snapshot/$snapshot/snapshot does not exist")
+                                       fi
+                               fi
+                       done < "$conf"
+               fi
+               if [ -n "$errors" ]; then
+                       echo -e "  \e[31m${errors[*]}\e[m" >&2
+               fi
+               echo -e "$color$id${verbose:+: $title}\e[m"
+       done < <(jq '.[]|[.isDefault, if has("isReported") then .isReported 
else 0 end, if has("type") then .type else "unknown" end, .id, .root, .path, 
.showTitle]|join(" ")' -r < "$entryfile")
+}
+
 show_entries()
 {
        local dialogtitle="${1:-Entries}"
 
-       [ -s "$entryfile" ] || update_entries
+       [ -s "$entryfile" ] || update_entries_for_this_system
 
        while true; do
                local list=()
@@ -520,7 +581,16 @@
                        d --msgbox "No entries" 0 0
                        return 0
                fi
-               d --no-hot-list --colors --ok-label "Options" --cancel-label 
"Back" --menu "$dialogtitle" 0 0 "$(menuheight ${#list[@]})" "${list[@]}" || 
return 0
+               local d_args=(--no-hot-list --colors --ok-label "Options" 
--cancel-label "Back")
+               [ -n "$arg_all_entries" ] || d_args+=(--extra-button 
--extra-label "All")
+               d "${d_args[@]}" --menu "$dialogtitle" 0 0 "$(menuheight 
${#list[@]})" "${list[@]}"  || {
+                       if [ "$?" = 3 ]; then
+                               arg_all_entries=1
+                               update_entries cat
+                               continue
+                       fi
+                       return 0
+               }
                n="$result"
 
                show_entry ".[$n]"
@@ -584,8 +654,7 @@
                                ;;
                        set-default)
                                read -r id < <(jq -r "$filter|.id" < 
"$entryfile")
-                               bootctl set-default "$id" > "$tmpfile" 2>&1
-                               [ -s "$tmpfile" ] && d --textbox "$tmpfile" 0 0
+                               set_default_entry "$id"
                                update_entries
                                break
                                ;;
@@ -600,6 +669,23 @@
        done
 }
 
+list_snapshots()
+{
+       update_snapper 2>"$tmpfile" || err "$(cat "$tmpfile")"
+
+       local n=0
+       while read -r n isdefault title; do
+               [ "$n" != "0" ] || continue
+               local id="$n"
+               if [ "$isdefault" = "true" ]; then
+                       id="\e[1;4m$id\e[m"
+               fi
+               update_kernels "@/.snapshots/$n/snapshot"
+               [ "$is_bootable" = 1 ] || id="!$id"
+               echo -e "$id $title"
+       done < <(jq '.root|.[]|[.number, .default, .description]|join(" ")' -r 
< "$snapperfile")
+}
+
 show_snapper()
 {
        if ! update_snapper 2>"$tmpfile"; then
@@ -666,6 +752,7 @@
 find_kernels()
 {
        local subvol="${1:?}"
+       local fn kv
        found_kernels=()
 
        for fn in "${subvol#@}"/usr/lib/modules/*/"$image"; do
@@ -677,31 +764,33 @@
        done
 }
 
-# map that uses expected path on the ESP for each kernel. The value indicates
-# whether that kernel is installed, stale or missing in the ESP
-declare -A known_kernels
+# map that uses expected path on the ESP for each installed kernel as key. The
+# value is the entry id if an entry exists.
+declare -A installed_kernels
+# map of ESP path to id of kernels that are not in the subvol
+declare -A stale_kernels
 is_bootable=
-has_stale=
 update_kernels()
 {
        local subvol="${1:?}"
-       known_kernels=()
+       local path id
+       installed_kernels=()
+       stale_kernels=()
        is_bootable=
-       has_stale=
        find_kernels "$subvol"
        for kv in "${!found_kernels[@]}"; do
-               
known_kernels["/$entry_token/$kv/linux-${found_kernels[$kv]}"]=missing
+               
installed_kernels["/$entry_token/$kv/linux-${found_kernels[$kv]}"]=''
        done
        update_entries_for_subvol "$subvol"
 
-       while read -r k id; do
-               # kernel in ESP that is not installed
-               if [ -z "${known_kernels[$k]}" ]; then
-                       known_kernels["$k"]="!$id"
-                       has_stale=1
-               elif [ "${known_kernels[$k]}" = missing ]; then
-                       known_kernels["$k"]="$id"
+       # XXX: maybe we should parse the actual path in the entry
+       while read -r path id; do
+               if [ "${installed_kernels[$path]+none}" = 'none' ]; then
+                       installed_kernels["$path"]="$id"
                        is_bootable=1
+               else
+                       # kernel in ESP that is not installed
+                       stale_kernels["$path"]="$id"
                fi
        done < <(jq -r '.[]|select(has("linux"))|[.linux,.id]|join(" ")'< 
"$entryfile")
 }
@@ -710,10 +799,21 @@
 {
        subvol="@/.snapshots/${1:?}/snapshot"
        update_kernels "$subvol"
-       local kernelfiles=("${!known_kernels[@]}")
+       local kernelfiles=("${!installed_kernels[@]}")
        for k in "${kernelfiles[@]}"; do
-               state="${known_kernels[$k]}"
-               printf "%-10s %s\n" "$state" "$k"
+               local id="${installed_kernels[$k]}"
+               local kv="${k%/*}"
+               kv="${kv##*/}"
+               if [ -z "$id" ]; then
+                       echo -e "\e[33mmissing /lib/modules/$kv/$image\e[m"
+               else
+                       echo "ok /lib/modules/$kv/$image -> $id"
+               fi
+       done
+       kernelfiles=("${!stale_kernels[@]}")
+       for k in "${kernelfiles[@]}"; do
+               local id="${stale_kernels[$k]}"
+               printf "\e[31mstale %s\e[m\n" "$id"
        done
 }
 
@@ -734,18 +834,22 @@
                local list=()
                local n=0
                local default=
-               local kernelfiles=("${!known_kernels[@]}")
-               local states=()
+               local id
+               local kernelfiles=("${!installed_kernels[@]}" 
"${!stale_kernels[@]}")
+               local ids=()
                for k in "${kernelfiles[@]}"; do
-                       state="${known_kernels[$k]}"
-                       if [ "$state" != 'missing' ]; then
-                               if [ "${state:0:1}" = '!' ]; then
-                                       state="stale"
+                       if [  "${installed_kernels[$k]+yup}" = yup ]; then
+                               id="${installed_kernels[$k]}"
+                               if [ -z "$id" ]; then
+                                       state="missing"
                                else
                                        state="ok"
                                fi
+                       else
+                               id="${stale_kernels[$k]}"
+                               state='stale'
                        fi
-                       states+=("$state")
+                       ids+=("$id")
                        s="${k#/*/}"
                        list+=("$n" "$(printf "%-10s %s" "$state" "$s")")
                        n=$((++n))
@@ -757,12 +861,11 @@
                d --no-tags --no-hot-list --colors --ok-label "Options" 
--cancel-label "Back" --menu "Kernels associated with $subvol" 0 0 
"$(menuheight ${#list[@]})" "${list[@]}" || return 0
                n="$result"
 
-               local id="${known_kernels[${kernelfiles[$n]}]}"
                list=()
-               if [ "$id" = "missing" ]; then
+               id="${ids[$n]}"
+               if [ -z "$id" ]; then
                        list+=(install "Install")
                else
-                       [ "${id:0:1}" = '!' ] && id="${id:1}" # stale
                        list+=(show "Entry")
                fi
                list+=(entries "Other Entries")
@@ -966,6 +1069,23 @@
        d --aspect 60 --msgbox "Installed into $boot_root" 0 0
 }
 
+set_default_entry()
+{
+       local id="${1:?}"
+       log_info "setting default entry ${id}"
+       if ! bootctl set-default "$id" > "$tmpfile" 2>&1; then
+               if grep -q "Failed to update EFI variable 
.*LoaderEntryDefault.* Read-only file system" "$tmpfile"; then
+                       if grep -q "^default " "$boot_root/loader/loader.conf"; 
then
+                               sed -i -e "s/^default .*/default $id/" 
"$boot_root/loader/loader.conf"
+                       else
+                               echo "default $id" >> 
"$boot_root/loader/loader.conf"
+                       fi
+               else
+                       err "$(cat "$tmpfile")"
+               fi
+       fi
+}
+
 set_default_snapshot()
 {
        local num="${1:?}"
@@ -983,8 +1103,7 @@
                        err "snapshot $num has no kernels"
                fi
        fi
-       log_info "setting default entry ${configs[0]}"
-       bootctl set-default "${configs[0]}"
+       set_default_entry "${configs[0]}"
 }
 
 # TODO: Maybe share this code outside
@@ -1055,7 +1174,7 @@
 
 ####### main #######
 
-getopttmp=$(getopt -o hc:v --long 
help,flicker,verbose,esp-path:,entry-token:,arch:,image:,no-variables,no-reuse-initrd
 -n "${0##*/}" -- "$@")
+getopttmp=$(getopt -o hc:v --long 
help,flicker,verbose,esp-path:,entry-token:,arch:,image:,no-variables,no-reuse-initrd,all
 -n "${0##*/}" -- "$@")
 eval set -- "$getopttmp"
 
 while true ; do
@@ -1069,13 +1188,14 @@
                --image) image="$2"; shift 2 ;;
                --no-variables) arg_no_variables=1; shift ;;
                --no-reuse-initrd) arg_no_reuse_initrd=1; shift ;;
+               --all) arg_all_entries=1; shift ;;
                 --) shift ; break ;;
                 *) echo "Internal error!" ; exit 1 ;;
         esac
 done
 
 case "$1" in
-       
install|needs-update|update|force-update|add-kernel|remove-kernel|set-default-snapshot|add-all-kernels|remove-all-kernels|is-installed|list-kernels|is-bootable|update-predictions)
 ;;
+       
install|needs-update|update|force-update|add-kernel|remove-kernel|set-default-snapshot|add-all-kernels|remove-all-kernels|is-installed|list-snapshots|list-entries|list-kernels|is-bootable|update-predictions)
 ;;
        kernels|snapshots|entries|"") stty_size; interactive=1 ;;
        *) err "unknown command $1" ;;
 esac
@@ -1105,6 +1225,11 @@
 [ -n "$root_subvol" ] || err "Can't determine root subvolume"
 [ -n "$entry_token" ] || err "No entry token. sd-boot not installed?"
 [ -n "$firmware_arch" ] || err "Can't determine firmware arch"
+case "$firmware_arch" in
+       x64) image=vmlinuz ;;
+       aa64) image=Image ;;
+       *) err "Unsupported architecture $firmware_arch" ;;
+esac
 
 root_snapshot="${root_subvol#@/.snapshots/}"
 root_snapshot="${root_snapshot%/snapshot}"
@@ -1137,6 +1262,10 @@
        fi
 elif [ "$1" = "list-kernels" ]; then
        list_kernels "${2:-$root_snapshot}"
+elif [ "$1" = "list-entries" ]; then
+       list_entries "${2:-}"
+elif [ "$1" = "list-snapshots" ]; then
+       list_snapshots
 elif [ "$1" = "is-bootable" ]; then
        is_bootable "${2:-$root_snapshot}"
 elif [ "$1" = "update-predictions" ]; then
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sdbootutil-1+git20240118.7e744b4/sdbootutil.spec 
new/sdbootutil-1+git20240122.c0d8f76/sdbootutil.spec
--- old/sdbootutil-1+git20240118.7e744b4/sdbootutil.spec        2024-01-18 
09:08:21.000000000 +0100
+++ new/sdbootutil-1+git20240122.c0d8f76/sdbootutil.spec        2024-01-22 
18:33:40.000000000 +0100
@@ -27,7 +27,7 @@
 %define git_version %{nil}
 %endif
 Name:           sdbootutil
-Version:        0%{git_version}
+Version:        1%{git_version}
 Release:        0
 Summary:        script to install shim with sd-boot
 License:        MIT
@@ -69,6 +69,15 @@
 Scriptlets that call sdbootutil to create boot entries when
 kernels are installed or removed
 
+%package kernel-install
+Summary:        Hook script for kernel-install
+Requires:       sdbootutil >= %{version}-%{release}
+Requires:       /usr/bin/kernel-install
+
+%description kernel-install
+Plugin script for kernel-install. Note: installation of this
+package may disable other plugin scripts that are incompatible.
+
 %prep
 %setup -q
 
@@ -76,9 +85,6 @@
 
 %install
 install -D -m 755 sdbootutil %{buildroot}%{_bindir}/sdbootutil
-%ifarch aarch64
-    sed -i -e 's/^image=vmlinuz/image=Image/' %{buildroot}%{_bindir}/sdbootutil
-%endif
 
 mkdir -p %{buildroot}%{_prefix}/lib/module-init-tools/kernel-scriptlets
 for a in rpm; do
@@ -99,6 +105,19 @@
   install -m 755 $i %{buildroot}%{_prefix}/lib/snapper/plugins/$i
 done
 
+# kernel-install
+install -d -m755 %{buildroot}%{_prefix}/lib/kernel/install.d
+for i in 50-sdbootutil.install; do
+  install -m 755 $i %{buildroot}%{_prefix}/lib/kernel/install.d/$i
+done
+
+# tmpfiles
+install -d -m755 %{buildroot}%{_prefix}/lib/tmpfiles.d
+for i in kernel-install-sdbootutil.conf; do
+  install -m 755 $i %{buildroot}%{_prefix}/lib/tmpfiles.d/$i
+done
+mkdir -p %{buildroot}/etc/kernel/install.d
+
 %transfiletriggerin -- /usr/lib/systemd/boot/efi /usr/share/efi/%_build_arch
 cat > /dev/null || :
 [ "$YAST_IS_RUNNING" != 'instsys' ] || exit 0
@@ -107,6 +126,9 @@
 [ -z "$VERBOSE_FILETRIGGERS" ] || echo "%{name}-%{version}-%{release}: 
updating bootloader"
 sdbootutil update
 
+%posttrans kernel-install
+%tmpfiles_create kernel-install-sdbootutil.conf
+
 %files
 %license LICENSE
 %{_bindir}/sdbootutil
@@ -120,4 +142,16 @@
 %dir %{_prefix}/lib/snapper/plugins
 %{_prefix}/lib/snapper/plugins/*
 
+%files kernel-install
+%dir %{_prefix}/lib/kernel
+%dir %{_prefix}/lib/kernel/install.d
+%{_prefix}/lib/kernel/install.d/*
+%{_prefix}/lib/tmpfiles.d/kernel-install-sdbootutil.conf
+%dir /etc/kernel
+%dir /etc/kernel/install.d
+%ghost %config(noreplace,missingok) /etc/kernel/install.d/50-depmod.install
+%ghost %config(noreplace,missingok) /etc/kernel/install.d/50-dracut.install
+%ghost %config(noreplace,missingok) 
/etc/kernel/install.d/51-dracut-rescue.install
+%ghost %config(noreplace,missingok) 
/etc/kernel/install.d/90-loaderentry.install
+
 %changelog

++++++ sdbootutil.obsinfo ++++++
--- /var/tmp/diff_new_pack.kabsRR/_old  2024-01-24 19:04:34.649860363 +0100
+++ /var/tmp/diff_new_pack.kabsRR/_new  2024-01-24 19:04:34.653860507 +0100
@@ -1,5 +1,5 @@
 name: sdbootutil
-version: 1+git20240118.7e744b4
-mtime: 1705565301
-commit: 7e744b4b8ecda1b49d5f296572204a850c4fe01b
+version: 1+git20240122.c0d8f76
+mtime: 1705944820
+commit: c0d8f7643bf6a68cdaa578016edb7affaa38dd91
 

Reply via email to