Commit 48c298da authored by Ophélie Gagnard's avatar Ophélie Gagnard

installation/install.sh: Fix a bug: handle automatically initramfs image's name changes.

parent 5161d627
......@@ -9,6 +9,13 @@ if [ ! -d dracut.module ]; then
fi
PROJECT_DIR=`pwd`
SOURCE_EFI_DIR=/boot/efi/EFI/
TARGET_EFI_DIR=/EFI/
SOURCE_EFI_DIR=`realpath -m $SOURCE_EFI_DIR`
TARGET_EFI_DIR=`realpath -m $TARGET_EFI_DIR`
SOURCE_IMAGE_DIR=$SOURCE_EFI_DIR/Linux/
TARGET_IMAGE_DIR=$TARGET_EFI_DIR/Linux/
dracut_output_file=dracut-output
# This script assumes to be run by the root user (with /sbin in the path).
......@@ -43,10 +50,16 @@ e2label $TARGET_ROOT_PARTITION ROOT
efibootmgr -b 0 -B || true
# Create an initramfs image
dracut -c ./dracut.module/dracut.conf --force
rm -f $dracut_output_file
dracut -c ./dracut.module/dracut.conf --force |& tee -a $dracut_output_file
# the next line parses dracut output and extracts the path of the newly generated image
uefi_image_name=`grep "Creating image file" $dracut_output_file | sed -E "s|.*$SOURCE_IMAGE_DIR(.*)'.*|\1|g"`
# Why? The boot manager seems to forget the boot option if this is not done.
cp -r /boot/efi/EFI /EFI
mkdir -p $TARGET_EFI_DIR
cp -rv $SOURCE_EFI_DIR/* $TARGET_EFI_DIR
# Set the image as a boot option
efibootmgr --create --disk $TARGET_EFI_PARTITION --label "test_deploy" --loader /EFI/Linux/linux-5.10.0-11-amd64-7148af38f67e4d3d98495ccf849b82f4.efi
efibootmgr --create --disk $TARGET_EFI_PARTITION --label "test_deploy" --loader $TARGET_IMAGE_DIR/$uefi_image_name
echo "New initramfs image: "$TARGET_IMAGE_DIR/$uefi_image_name
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment