1#!/bin/bash 2#* Copyright (c) 2020-2022 Intel Corporation. 3# postinst script for acrn kernel 4filename="/etc/grub.d/40_custom" 5menu=$(grep ACRN_deb_multiboot2 ${filename}) || true 6type=$(findmnt / |awk '$1 == "/" {print $2}') 7str=$(blkid |grep ${type}) 8uuid=$(echo $str |cut -d " " -f 2|cut -d "=" -f 2) 9str=$(blkid |grep ${type}) 10partuuid=$(echo ${str##*PARTUUID=}) 11if [ -z "$menu" ] 12then 13cat>"${filename}"<<EOF 14 #!/bin/sh 15 exec tail -n +3 \$0 16 menuentry 'ACRN multiboot2 ' --id ACRN_deb_multiboot2 { 17 load_video 18 insmod gzio 19 insmod part_gpt 20 insmod ext2 21 search --no-floppy --fs-uuid --set $uuid 22 multiboot2 /boot/acrn.bin root=PARTUUID=$partuuid 23 24 } 25 26EOF 27 fi 28 29 sed -i '/module/d' ${filename} || true 30 bzImage=$(cat /boot/version.txt) 31 sed -i '/multiboot2 \/boot/a\module2 /boot/'${bzImage}' Linux_bzImage' ${filename} 32 33sync 34update-grub 35