mirror of
https://github.com/krizsipeti/custom_blfs_packages.git
synced 2025-01-23 05:52:22 +08:00
Use root=PARTUUID in grub.cfg
This commit is contained in:
parent
5c106f010f
commit
ba65ace7d0
@ -266,10 +266,11 @@ GRUB_SCRIPT=$(find "$DIR_COMMANDS" -type f -iname "1*-grub")
|
||||
if [ -n "$GRUB_SCRIPT" ] ; then
|
||||
sed -i "/^cat /i grub-install $(lsblk -l -o MOUNTPOINT,PATH,NAME,PKNAME | grep "^$1 " | awk '{gsub($3,$4,$2); print $2}')\n" "$GRUB_SCRIPT"
|
||||
KERNEL_NAME=$(grep "$GRUB_SCRIPT" -e vmlinuz | awk '{gsub("/boot/","",$2); print $2}')
|
||||
sed -i "/menuentry/a\ set opts=\"net.ifnames=0\ nvidia_drm.modeset=1\"\n set lnx_root=\"$(lsblk -l -o MOUNTPOINT,UUID | grep "^$1 " | awk '{print $2}')\"\n set knl_name=\"/$KERNEL_NAME\"" "$GRUB_SCRIPT"
|
||||
sed -i "/menuentry/a\ set opts=\"net.ifnames=0\ nvidia_drm.modeset=1\"\n set lnx_root=\"$(lsblk -l -o MOUNTPOINT,PARTUUID | grep "^$1 " | awk '{print $2}')\"\n set knl_name=\"/$KERNEL_NAME\"" "$GRUB_SCRIPT"
|
||||
if [ -z "$(lsblk -l -o MOUNTPOINT,PATH | grep "^$1/boot " | awk '{print $2}')" ] ; then
|
||||
sed -i 's/knl_name="/knl_name="\/boot/g' "$GRUB_SCRIPT"
|
||||
fi
|
||||
sed -i "/set root=/d;/^ .*linux /c\ linux \${knl_name} root=UUID=\${lnx_root} ro \${opts}" "$GRUB_SCRIPT"
|
||||
sed -i "/set root=/c\search --set=root --fs-uuid $(lsblk -l -o MOUNTPOINT,UUID | grep "^$1 " | awk '{print $2}')" "$GRUB_SCRIPT"
|
||||
sed -i "/^ .*linux /c\ linux \${knl_name} root=PARTUUID=\${lnx_root} ro \${opts}" "$GRUB_SCRIPT"
|
||||
sed -i '/set timeout/a set color_normal=white/black\nset color_highlight=yellow/black\nset menu_color_normal=light-blue/black\nset menu_color_highlight=yellow/blue' "$GRUB_SCRIPT"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user