update kernel version in boot partition for arch

This commit is contained in:
maxime 2024-02-05 10:37:43 +01:00
parent e146caaa63
commit d27ebf06c0
Signed by untrusted user who does not match committer: masq
GPG Key ID: A6BA8DA755BB4490
1 changed files with 30 additions and 0 deletions

30
arch_post_update_update_boot.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
set -xe
AURA_BIN=/usr/bin/aura
CURRENT_VERSION=`${AURA_BIN} -Qi linux | sed -n '/^Version *:/p' | grep -o '[^ ]*$'`
BOOT_BLK=/dev/vg1/boot
BOOT_ORIG=/boot
BOOT_DST=/mnt/boot
ARCH_BOOT_DST=$BOOT_DST/arch
ARCH_BOOT_DST_CURRENT_VERSION=$ARCH_BOOT_DST/$CURRENT_VERSION
ARCH_INITRAMFS=initramfs-linux.img
ARCH_INITRAMFS_FALLBACK=initramfs-linux-fallback.img
ARCH_VMLINUZ=vmlinuz-linux
mount $BOOT_BLK $BOOT_DST;
test -d $ARCH_BOOT_DST_CURRENT_VERSION && echo "Linux version already up to date ($CURRENT_VERSION)" && exit 0;
mkdir $ARCH_BOOT_DST_CURRENT_VERSION;
(
cd $BOOT_ORIG;
cp -t $ARCH_BOOT_DST_CURRENT_VERSION $ARCH_INITRAMFS $ARCH_INITRAMFS_FALLBACK $ARCH_VMLINUZ;
)
(
cd $ARCH_BOOT_DST;
rm current && ln -s $CURRENT_VERSION current;
)
echo "Linux version updated to $CURRENT_VERSION"
exit 0;