mirror of
https://github.com/Le0xFF/VoidLinuxInstaller.git
synced 2024-11-23 04:08:24 +03:00
Integrate custom keyboard layout in grubx64.efi
If GRUB2 is choosen as bootloader, after selecting a keyboard layout it's possible to integrate it in the efi file through a script located in /etc/kernel.d/post-install/
This commit is contained in:
parent
ed5a5b22d1
commit
03a279a510
108
vli.sh
108
vli.sh
@ -108,11 +108,13 @@ function create_chroot_script {
|
|||||||
rm -f "$HOME"/chroot.sh
|
rm -f "$HOME"/chroot.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat >> "$HOME"/chroot.sh << 'EndOfScript'
|
cat >> "$HOME"/chroot.sh << 'EndOfChrootScript'
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
|
||||||
|
bootloader_id=''
|
||||||
|
bootloader=''
|
||||||
newuser_yn=''
|
newuser_yn=''
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
@ -233,7 +235,7 @@ function install_bootloader {
|
|||||||
if [[ "$hdd_ssd" == "ssd" ]] ; then
|
if [[ "$hdd_ssd" == "ssd" ]] ; then
|
||||||
sed -i "/OPTIONS=/s/\"$/ rd.luks.allow-discards=$LUKS_UUID&/" /etc/default/efibootmgr-kernel-hook
|
sed -i "/OPTIONS=/s/\"$/ rd.luks.allow-discards=$LUKS_UUID&/" /etc/default/efibootmgr-kernel-hook
|
||||||
fi
|
fi
|
||||||
elif { [[ "$encryption_yn" == "n" ]] || [[ "$encryption_yn" == "N" ]]; } && { [[ "$lvm" == "y" ]] || [[ "$lvm_yn" == "Y" ]]; } ; then
|
elif { [[ "$encryption_yn" == "n" ]] || [[ "$encryption_yn" == "N" ]]; } && { [[ "$lvm_yn" == "y" ]] || [[ "$lvm_yn" == "Y" ]]; } ; then
|
||||||
sed -i "/# OPTIONS=/s/.*/OPTIONS=\"loglevel=4 rd.auto=1\"/" /etc/default/efibootmgr-kernel-hook
|
sed -i "/# OPTIONS=/s/.*/OPTIONS=\"loglevel=4 rd.auto=1\"/" /etc/default/efibootmgr-kernel-hook
|
||||||
else
|
else
|
||||||
sed -i "/# OPTIONS=/s/.*/OPTIONS=\"loglevel=4\"/" /etc/default/efibootmgr-kernel-hook
|
sed -i "/# OPTIONS=/s/.*/OPTIONS=\"loglevel=4\"/" /etc/default/efibootmgr-kernel-hook
|
||||||
@ -258,7 +260,7 @@ function install_bootloader {
|
|||||||
if [[ "$hdd_ssd" == "ssd" ]] ; then
|
if [[ "$hdd_ssd" == "ssd" ]] ; then
|
||||||
sed -i "/GRUB_CMDLINE_LINUX_DEFAULT=/s/\"$/ rd.luks.allow-discards=$LUKS_UUID&/" /etc/default/grub
|
sed -i "/GRUB_CMDLINE_LINUX_DEFAULT=/s/\"$/ rd.luks.allow-discards=$LUKS_UUID&/" /etc/default/grub
|
||||||
fi
|
fi
|
||||||
elif { [[ "$encryption_yn" == "n" ]] || [[ "$encryption_yn" == "N" ]]; } && { [[ "$lvm" == "y" ]] || [[ "$lvm_yn" == "Y" ]]; } ; then
|
elif { [[ "$encryption_yn" == "n" ]] || [[ "$encryption_yn" == "N" ]]; } && { [[ "$lvm_yn" == "y" ]] || [[ "$lvm_yn" == "Y" ]]; } ; then
|
||||||
sed -i "/GRUB_CMDLINE_LINUX_DEFAULT=/s/\"$/ rd.auto=1&/" /etc/default/grub
|
sed -i "/GRUB_CMDLINE_LINUX_DEFAULT=/s/\"$/ rd.auto=1&/" /etc/default/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1000,6 +1002,100 @@ function finish_chroot {
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$bootloader" == "GRUB2" ]] || [[ "$bootloader" == "grub2" ]] ; then
|
||||||
|
while true ; do
|
||||||
|
header_fc
|
||||||
|
echo -e -n "\nDo you want to set the same keyboard layout in GRUB2? (y/n): "
|
||||||
|
read -n 1 -r yn
|
||||||
|
if [[ "$yn" == "y" ]] || [[ "$yn" == "Y" ]] ; then
|
||||||
|
if [[ "$lvm_yn" == "y" ]] || [[ "$lvm_yn" == "Y" ]] ; then
|
||||||
|
if [[ "$encryption_yn" == "y" ]] || [[ "$encryption_yn" == "Y" ]] ; then
|
||||||
|
root_line=$(echo -e -n "cryptomount -u ${LUKS_UUID//-/}\nset root=(lvm/$vg_name-$lv_root_name)\n")
|
||||||
|
else
|
||||||
|
root_line="set root=(lvm/$vg_name-$lv_root_name)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "$encryption_yn" == "y" ]] || [[ "$encryption_yn" == "Y" ]] ; then
|
||||||
|
root_line=$(echo -e -n "cryptomount -u ${LUKS_UUID//-/}\nset root=(cryptouuid/${LUKS_UUID//-/})\n")
|
||||||
|
else
|
||||||
|
disk=$(blkid -s UUID -o value $final_drive)
|
||||||
|
root_line=$(echo -e -n "search --no-floppy --fs-uuid $disk --set pre_root\nset root=(\\\$pre_root)\n")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e -n "\n\nCreating /etc/kernel.d/post-install/51-grub_ckb...\n"
|
||||||
|
|
||||||
|
cat << End >> /etc/kernel.d/post-install/51-grub_ckb
|
||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# Create grubx64.efi containing custom keyboard layout
|
||||||
|
# Requires: ckbcomp, grub2, xkeyboard-config
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ ! -f /boot/efi/EFI/$bootloader_id/ORIG_grubx64.efi_ORIG ] ; then
|
||||||
|
if [ ! -f /boot/efi/EFI/$bootloader_id/grubx64.efi ] ; then
|
||||||
|
echo -e -n "\nFIle /boot/efi/EFI/$bootloader_id/grubx64.efi not found, install GRUB2 first!\n"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
mv /boot/efi/EFI/$bootloader_id/grubx64.efi /boot/efi/EFI/$bootloader_id/ORIG_grubx64.efi_ORIG
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
for file in $user_keyboard_layout.gkb early-grub.cfg grubx64_ckb.efi memdisk_ckb.tar ; do
|
||||||
|
if [ -f /boot/grub/\$file ] ; then
|
||||||
|
rm -f /boot/grub/\$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
grub-kbdcomp --output=/boot/grub/$user_keyboard_layout.gkb $user_keyboard_layout 2> /dev/null
|
||||||
|
|
||||||
|
tar --create --file=/boot/grub/memdisk_ckb.tar --directory=/boot/grub/ $user_keyboard_layout.gkb 2> /dev/null
|
||||||
|
|
||||||
|
cat << EndOfGrubConf >> /boot/grub/early-grub.cfg
|
||||||
|
set gfxpayload=keep
|
||||||
|
loadfont=unicode
|
||||||
|
terminal_output gfxterm
|
||||||
|
terminal_input at_keyboard
|
||||||
|
keymap (memdisk)/$user_keyboard_layout.gkb
|
||||||
|
|
||||||
|
${root_line}/@
|
||||||
|
set prefix=\\\$root/boot/grub
|
||||||
|
|
||||||
|
configfile \\\$prefix/grub.cfg
|
||||||
|
EndOfGrubConf
|
||||||
|
|
||||||
|
grub-mkimage --config=/boot/grub/early-grub.cfg --output=/boot/grub/grubx64_ckb.efi --format=x86_64-efi --memdisk=/boot/grub/memdisk_ckb.tar diskfilter gcry_rijndael gcry_sha256 ext2 memdisk tar at_keyboard keylayouts configfile gzio part_gpt all_video efi_gop efi_uga video_bochs video_cirrus echo linux font gfxterm gettext gfxmenu help reboot terminal test search search_fs_file search_fs_uuid search_label cryptodisk luks lvm btrfs
|
||||||
|
|
||||||
|
if [ -f /boot/efi/EFI/$bootloader_id/grubx64.efi ] ; then
|
||||||
|
rm -f /boot/efi/EFI/$bootloader_id/grubx64.efi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp /boot/grub/grubx64_ckb.efi /boot/efi/EFI/$bootloader_id/grubx64.efi
|
||||||
|
End
|
||||||
|
|
||||||
|
chmod +x /etc/kernel.d/post-install/51-grub_ckb
|
||||||
|
echo -e -n "\nReconfiguring kernel...\n\n"
|
||||||
|
kernelver_pre=$(ls /lib/modules/)
|
||||||
|
kernelver="${kernelver_pre%.*}"
|
||||||
|
xbps-reconfigure -f linux"$kernelver"
|
||||||
|
echo
|
||||||
|
read -n 1 -r -p "[Press any key to continue...]" key
|
||||||
|
clear
|
||||||
|
break
|
||||||
|
|
||||||
|
elif [[ "$yn" == "n" ]] || [[ "$yn" == "N" ]] ; then
|
||||||
|
echo -e -n "\n\nNo changes were made.\n\n"
|
||||||
|
read -n 1 -r -p "[Press any key to continue...]" key
|
||||||
|
clear
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo -e -n "\nPlease answer y or n.\n\n"
|
||||||
|
read -n 1 -r -p "[Press any key to continue...]" key
|
||||||
|
clear
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$ARCH" == "x86_64" ]] ; then
|
if [[ "$ARCH" == "x86_64" ]] ; then
|
||||||
header_fc
|
header_fc
|
||||||
echo -e -n "\nSetting the ${BLUE_LIGHT}locale${NORMAL} in /etc/default/libc-locales.\n\nPress any key to print all the available locales.\n\nKeep in mind the ${BLUE_LIGHT}one line number${NORMAL} you need because that line will be uncommented.\n\nMove with arrow keys and press \"q\" to exit the list."
|
echo -e -n "\nSetting the ${BLUE_LIGHT}locale${NORMAL} in /etc/default/libc-locales.\n\nPress any key to print all the available locales.\n\nKeep in mind the ${BLUE_LIGHT}one line number${NORMAL} you need because that line will be uncommented.\n\nMove with arrow keys and press \"q\" to exit the list."
|
||||||
@ -1144,7 +1240,7 @@ create_user
|
|||||||
void_packages
|
void_packages
|
||||||
finish_chroot
|
finish_chroot
|
||||||
exit 0
|
exit 0
|
||||||
EndOfScript
|
EndOfChrootScript
|
||||||
|
|
||||||
if [[ ! -f "$HOME"/chroot.sh ]] ; then
|
if [[ ! -f "$HOME"/chroot.sh ]] ; then
|
||||||
echo -e -n "Please run this script again to be sure that $HOME/chroot.sh script is created too."
|
echo -e -n "Please run this script again to be sure that $HOME/chroot.sh script is created too."
|
||||||
@ -2298,7 +2394,7 @@ function disk_encryption {
|
|||||||
echo -e -n "\nWhich LUKS version do you want to use? (1/2 and [ENTER]): "
|
echo -e -n "\nWhich LUKS version do you want to use? (1/2 and [ENTER]): "
|
||||||
read -r luks_ot
|
read -r luks_ot
|
||||||
if [[ "$luks_ot" == "1" ]] || [[ "$luks_ot" == "2" ]] ; then
|
if [[ "$luks_ot" == "1" ]] || [[ "$luks_ot" == "2" ]] ; then
|
||||||
echo -e -n "\nUsing LUKS version ${BLUE_LIGHT}$luks_ot${NORMAL}.\n\n"
|
echo -e -n "\nUsing LUKS version ${BLUE_LIGHT}$luks_ot${NORMAL}.\n"
|
||||||
while true ; do
|
while true ; do
|
||||||
echo
|
echo
|
||||||
cryptsetup luksFormat --type=luks"$luks_ot" "$encrypted_partition"
|
cryptsetup luksFormat --type=luks"$luks_ot" "$encrypted_partition"
|
||||||
@ -2821,7 +2917,7 @@ function install_base_system_and_chroot {
|
|||||||
read -n 1 -r -p "[Press any key to continue...]" key
|
read -n 1 -r -p "[Press any key to continue...]" key
|
||||||
echo
|
echo
|
||||||
XBPS_ARCH="$ARCH" xbps-install -Suvy xbps
|
XBPS_ARCH="$ARCH" xbps-install -Suvy xbps
|
||||||
XBPS_ARCH="$ARCH" xbps-install -Suvy -r /mnt -R "$REPO" base-system btrfs-progs cryptsetup grub-x86_64-efi efibootmgr lvm2 grub-btrfs grub-btrfs-runit NetworkManager bash-completion nano gcc apparmor git curl util-linux tar coreutils binutils xtools fzf plocate ictree void-repo-multilib void-repo-nonfree void-repo-multilib-nonfree
|
XBPS_ARCH="$ARCH" xbps-install -Suvy -r /mnt -R "$REPO" base-system btrfs-progs cryptsetup grub-x86_64-efi efibootmgr lvm2 grub-btrfs grub-btrfs-runit NetworkManager bash-completion nano gcc apparmor git curl util-linux tar coreutils binutils xtools fzf plocate ictree xkeyboard-config ckbcomp void-repo-multilib void-repo-nonfree void-repo-multilib-nonfree
|
||||||
XBPS_ARCH="$ARCH" xbps-install -Suvy -r /mnt -R "$REPO"
|
XBPS_ARCH="$ARCH" xbps-install -Suvy -r /mnt -R "$REPO"
|
||||||
if grep -m 1 "model name" /proc/cpuinfo | grep --ignore-case "intel" &> /dev/null ; then
|
if grep -m 1 "model name" /proc/cpuinfo | grep --ignore-case "intel" &> /dev/null ; then
|
||||||
XBPS_ARCH="$ARCH" xbps-install -Suvy -r /mnt -R "$REPO" intel-ucode
|
XBPS_ARCH="$ARCH" xbps-install -Suvy -r /mnt -R "$REPO" intel-ucode
|
||||||
|
Loading…
Reference in New Issue
Block a user