scripts/arch_post_update_update_boo...

31 lines
814 B
Bash
Executable File

#!/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;