Merge Yellow's RAUC post-install hook with the install hook (#3678)

As stated in the docs [1], post-install hook is not executed if the slot
already has an install hook defined. Merge the post-install hook with the
install hook to fix CM5 migration for Yellow.

[1] https://rauc.readthedocs.io/en/latest/using.html#slot-hooks
This commit is contained in:
Jan Čermák 2024-11-18 12:51:58 +01:00 committed by GitHub
parent b9e66fbfd0
commit 78cdaab597
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 23 deletions

View File

@ -11,11 +11,7 @@ hooks=install-check;
[image.boot]
filename=boot.vfat
{{- if eq (env "ota_compatible") "haos-yellow" }}
hooks=install;post-install;
{{- else }}
hooks=install;
{{- end }}
[image.kernel]
filename=kernel.img

View File

@ -42,6 +42,16 @@ install_boot() {
cp -f "${BOOT_TMP}"/*.txt "${BOOT_MNT}/" || true
cp -f "${BOOT_TMP}"/grubenv "${BOOT_MNT}"/EFI/BOOT/ || true
fi
# Add CM5 support for Yellow. Can be removed in HAOS 15.
if [ "$RAUC_SYSTEM_COMPATIBLE" = "haos-yellow" ]; then
if ! grep -q "\[cm5\]" "${BOOT_MNT}/config.txt"; then
echo "Adding CM5 config to config.txt"
# Remove old single device_tree config and add CM-specific ones
sed -i '/device_tree=bcm2711-rpi-cm4-ha-yellow.dtb/d; s/\[all\]/\[cm4\]\ndevice_tree=bcm2711-rpi-cm4-ha-yellow.dtb\n\n\[cm5\]\ndevice_tree=bcm2712-rpi-cm5-ha-yellow.dtb\n\n\[all\]/' "${BOOT_MNT}/config.txt"
fi
fi
}
install_spl() {
@ -88,25 +98,6 @@ check_grubenv() {
fi
}
post_install_boot() {
BOOT_MNT=/mnt/boot
# Add CM5 support for Yellow. Can be removed in HAOS 15. Make sure manifest.raucm.gtpl is updated.
if [ "$RAUC_SYSTEM_COMPATIBLE" = "haos-yellow" ]; then
# Mount boot
if ! systemctl -q is-active mnt-boot.mount; then
systemctl start mnt-boot.mount
fi
if ! grep -q "\[cm5\]" "${BOOT_MNT}/config.txt"; then
echo "Adding CM5 config to config.txt"
# Remove old single device_tree config and add CM-specific ones
sed -i '/device_tree=bcm2711-rpi-cm4-ha-yellow.dtb/d; s/\[all\]/\[cm4\]\ndevice_tree=bcm2711-rpi-cm4-ha-yellow.dtb\n\n\[cm5\]\ndevice_tree=bcm2712-rpi-cm5-ha-yellow.dtb\n\n\[all\]/' "${BOOT_MNT}/config.txt"
fi
fi
}
post_install_kernel() {
BOOT_MNT=/mnt/boot