| #!/bin/bash
|
|
|
| DRIVE=${DRIVE:-/dev/sda}
|
| pttype=$(lsblk -n -o PTTYPE $DRIVE | head -1)
|
|
|
| if [[ $pttype == "dos" ]]; then
|
| SWAP=$(blkid ${DRIVE}1 | awk '{print $2}' | sed 's/"//g')
|
| ROOT=$(blkid ${DRIVE}2 | awk '{print $2}' | sed 's/"//g')
|
| ROOTPART=$(blkid ${DRIVE}2 | awk '{print $4}' | sed 's/"//g')
|
| else
|
| UEFI=$(blkid ${DRIVE}1 | awk '{print $2}' | sed 's/"//g')
|
| SWAP=$(blkid ${DRIVE}2 | awk '{print $2}' | sed 's/"//g')
|
| ROOT=$(blkid ${DRIVE}3 | awk '{print $2}' | sed 's/"//g')
|
| ROOTPART=$(blkid ${DRIVE}3 | awk '{print $4}' | sed 's/"//g')
|
| UEFI_MNT="$UEFI /boot/efi vfat noauto,codepage=437,iocharset=iso8859-1 0 1"
|
| fi
|
|
|
| cat > /etc/fstab <<EOF
|
| # Begin /etc/fstab
|
|
|
| # file system mount-point type options dump fsck
|
| # order
|
|
|
| $ROOT / ext4 defaults 1 1
|
| $SWAP swap swap pri=1 0 0
|
| $UEFI_MNT
|
|
|
| # End /etc/fstab
|
| EOF
|
| [ -f /etc/fstab ] && printf "\n Created: /etc/fstab \n"
|
|
|
| install -v -m755 -d /etc/modprobe.d
|
| cat > /etc/modprobe.d/usb.conf << "EOF"
|
| # Begin /etc/modprobe.d/usb.conf
|
|
|
| install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
|
| install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
|
|
|
| # End /etc/modprobe.d/usb.conf
|
| EOF
|
| [ -f /etc/modprobe.d/usb.conf ] && printf "\n Created: /etc/modprobe.d/usb.conf \n"
|
|
|
| mkdir -pv /boot/grub
|
| cat > /boot/grub/grub.cfg <<EOF
|
| # Begin /boot/grub/grub.cfg
|
| set default=0
|
| set timeout=5
|
|
|
| insmod part_gpt
|
| insmod ext2
|
| #set root=(hd0,2)
|
| search --no-floppy --fs-uuid --set=root $ROOT
|
| set gfxpayload=1024x768x32
|
|
|
| menuentry "GNU/Linux, Linux-6.6.99-zirconium" {
|
| linux /boot/vmlinuz-6.6.99-zirconium root=$ROOTPART ro
|
| # linux /boot/vmlinuz-6.6.99-zirconium root=/dev/sda2 ro
|
| }
|
| EOF
|
| [ -f /boot/grub/grub.cfg ] && printf "\n Created: /boot/grub/grub.cfg \n"
|
|
|
| if [[ $pttype == "dos" ]]; then
|
| grub-install /dev/sda
|
| else
|
| echo "* mounting efi partition ${DRIVE}1 *"
|
| #mkfs.vfat /dev/sdb1
|
| mount --mkdir -v -t vfat ${DRIVE}1 -o codepage=437,iocharset=iso8859-1 /boot/efi
|
| echo " Updating UEFI Boot"
|
| grub-install --target=x86_64-efi --removable
|
| mountpoint /sys/firmware/efi/efivars || mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars
|
| grub-install --bootloader-id=LFS --recheck
|
| efibootmgr | cut -f 1
|
| fi
|