Comment # 11 on bug 1182318 from Jan Engelhardt
Just some documentation…

This is implemented now (at the very least, in TW). kernel-default contains
pre/post/posttrans scriptlets like so:

---8<---
posttrans scriptlet (using /bin/sh):
run_if_exists() { 
if [ -x "$1" ] ; then                   
  "$@"                                  
else                                    
  echo Cannot execute "$1" >&2          
fi                                      
}                                       
run_if_exists /usr/lib/module-init-tools/kernel-scriptlets/rpm-posttrans --name
"kernel-default" --version "6.11.7" ...
--->8---

and suse-module-tools-scriptlets-16.0.53-1.1.x86_64.rpm has 
/usr/lib/module-init-tools/kernel-scriptlets/rpm-script which does:

---8<---
...
    post)
        ...
        [ "$INITRD_IN_POSTTRANS" ] || update_bootloader_entry
        ...

    postun)
        ...
        [ ! "$INITRD_IN_POSTTRANS" ] || update_bootloader_entry
        ...
...
--->8---

So, posttrans updates of initrd are implemented in general.
INITRD_IN_POSTTRANS is set by
/usr/lib/module-init-tools/kernel-scriptlets/kmp-script:

---8<---
    post)
        if [ -x $wm2 ]; then
            INITRD_IN_POSTTRANS=1 run_wm2 --add-kmp "$nvr" || script_rc=$?
        fi
        ;;
--->8---

and kmp-script is invoked by kmps, e.g. `rpm -q vhba-kmp-default --scripts`:

---8<---
postinstall scriptlet (using /bin/sh):

run_if_exists() { 
if [ -x "$1" ] ; then                   
  "$@"                                  
else                                    
  echo Cannot execute "$1" >&2          
fi                                      
}                                       
run_if_exists /usr/lib/module-init-tools/kernel-scriptlets/kmp-post --name
"vhba-kmp-default" \
  --version "20240917_k6.11.7_1" --release "1.9" --kernelrelease "6.11.7-1" \
  --flavor "default" --usrmerged "1" "$@"
--->8---

Non-KMPs instead trigger it like so in .spec:

---8<---
%post
%{?regenerate_initrd_post}

%posttrans
%{?regenerate_initrd_posttrans}
--->8---

Expanded, that is:

---8<---
postinstall scriptlet (using /bin/sh):

        ! command -v mkdir >/dev/null || mkdir -p /run/regenerate-initrd/; 
        [ ! -d /run/regenerate-initrd ] || > /run/regenerate-initrd/all;
posttrans scriptlet (using /bin/sh):

        if test -x /usr/lib/module-init-tools/regenerate-initrd-posttrans; then 
                /bin/bash -c 'set +e;
/usr/lib/module-init-tools/regenerate-initrd-posttrans' 
        fi
--->8---

and so we get posttrans initrd generation.


You are receiving this mail because: