scripts/arch_post_update_update_boo...

31 lines
819 B
Bash
Raw Normal View History

#!/bin/sh
set -xe
AURA_BIN=/usr/bin/aura
CURRENT_VERSION=`${AURA_BIN} -Qi linux | sed -n '/^Version *:/p' | grep -o '[^ ]*$'`
2024-09-22 09:22:28 +02:00
BOOT_BLK=/dev/vg0/boot
BOOT_ORIG=/boot
BOOT_DST=/mnt/boot
2024-09-22 09:22:28 +02:00
ARCH_BOOT_DST=$BOOT_DST/archlinux
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;