2023-10-07 16:22:18 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -xeuf -o pipefail
|
|
|
|
|
|
|
|
UNAME_R="$(</boot/.uname)"
|
|
|
|
BOOT_PART="$(grep '/ ' /etc/fstab | awk '{print $1}')"
|
|
|
|
replacewithfullver
|
|
|
|
|
2023-10-07 16:41:03 +00:00
|
|
|
if [ -x /sbin/installkernel -a -r "/boot/vmlinuz-${UNAME_R}" -a -r "/boot/System.map-${UNAME_R}" ]; then
|
|
|
|
cp "/boot/vmlinuz-${UNAME_R}" "/boot/.vmlinuz-${UNAME_R}-rpm"
|
|
|
|
cp "/boot/System.map-${UNAME_R}" "/boot/.System.map-${UNAME_R}-rpm"
|
|
|
|
rm -f "/boot/vmlinuz-${UNAME_R}" "/boot/System.map-${UNAME_R}"
|
|
|
|
/sbin/installkernel "${UNAME_R}" "/boot/.vmlinuz-${UNAME_R}-rpm" "/boot/.System.map-${UNAME_R}-rpm"
|
|
|
|
rm -f "/boot/.vmlinuz-${UNAME_R}-rpm" "/boot/.System.map-${UNAME_R}-rpm"
|
|
|
|
fi
|
|
|
|
ln "/boot/.uname-${UNAME_R}" /boot/.uname
|
|
|
|
|
|
|
|
|
2023-10-07 16:22:18 +00:00
|
|
|
cp /opt/opi5-efi/boot.cmd "/boot/efi/boot.cmd-${FULL_VER}"
|
|
|
|
cp /opt/opi5-efi/uEnv.txt "/boot/efi/uEnv.txt-${FULL_VER}"
|
|
|
|
|
|
|
|
if [ ! -f /boot/.uname ]; then
|
|
|
|
echo "ERROR: No /boot/.uname found to extract 'uname -r' from."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "/boot/initramfs-${UNAME_R}" ]; then
|
|
|
|
echo "ERROR: No initramfs found."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "rootdev=${BOOT_PART}" >> "/boot/efi/uEnv.txt-${FULL_VER}"
|
|
|
|
sed -i "s/setenvrootdev/setenv rootdev \"${BOOT_PART}\"/" "/boot/efi/boot.cmd-${FULL_VER}"
|
|
|
|
sed -i "s/setenvunamer/setenv unamer \"${UNAME_R}\"/" "/boot/efi/boot.cmd-${FULL_VER}"
|
|
|
|
|
|
|
|
mkimage -A arm -T ramdisk -C none -n uInitrd -d "/boot/initramfs-${UNAME_R}.img" "/boot/uInitrd-${UNAME_R}"
|
|
|
|
cp "/boot/uInitrd-${UNAME_R}" /boot/uInitrd
|
|
|
|
|
|
|
|
mkimage -C none -A arm -T script -d "/boot/efi/boot.cmd-${FULL_VER}" "/boot/efi/boot.scr-${FULL_VER}"
|
|
|
|
cp "/boot/efi/boot.scr-${FULL_VER}" /boot/efi/boot.scr
|
|
|
|
|
|
|
|
diff /boot/efi/boot.cmd "/boot/efi/boot.cmd-${FULL_VER}" > /boot/diff_boot_cmd
|
|
|
|
diff /boot/efi/uEnv.txt "/boot/efi/uEnv.txt-${FULL_VER}" > /boot/diff_uenv_txt
|