feat: UKI

This commit is contained in:
ange 2024-10-02 12:40:34 +07:00
parent bfbd034ce3
commit dd265819a0
Signed by: ange
GPG key ID: 9E0C4157BB7BEB1D
26 changed files with 55 additions and 56 deletions

View file

@ -0,0 +1,40 @@
#!/bin/bash
#shellcheck disable=SC2154
sgdisk -Z \
-n '0:0:+512M' -t '0:ef00' -c '0:esp' \
-n '0:0:0' -t '0:8300' -c '0:root' \
"$disk"
esp=/dev/disk/by-partlabel/esp
root=/dev/disk/by-partlabel/root
[ -n "$disk_passwd" ] && {
echo -n "$disk_passwd" | cryptsetup luksFormat "$root" -
cryptsetup open "$root" cryptroot - <<< "$disk_passwd"
root=/dev/mapper/cryptroot
}
sleep 5 # wait /dev/disk/by-partlabel/
mkfs.vfat -F32 "$esp"
mkfs.ext4 -F "$root"
mount "$root" /mnt/
cat <<EOF > /mnt/etc/fstab
UUID=$(blkid "$root" -ovalue -sUUID) / ext4 rw,relatime 0 1
UUID=$(blkid "$esp" -ovalue -sUUID) /efi vfat rw,fmask=0077,dmask=0077,noauto 0 2
EOF
[ -n "$swapfile" ] && {
dd if=/dev/zero of=/mnt/swapfile bs=1M count="$swapfile" status=progress
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
}
cp -rfTv rootfs/ /mnt/
swapoff /mnt/swapfile

View file

@ -0,0 +1,18 @@
#!/bin/bash
#shellcheck disable=SC2154
case "$(lscpu)" in
*AMD*) echo amd-ucode >> pkglist.txt ;;
*Intel*) echo intel-ucode >> pkglist.txt ;;
*) ;;
esac
[ -s modules/chroot/flatpak.txt ] \
&& printf '%s\n' flatpak xdg-desktop-portal-gtk >> pkglist.txt
[ -d /sys/class/power_supply/BAT0 ] && echo tlp >> pkglist.txt
pacstrap -C rootfs/etc/pacman.conf -K /mnt \
base linux{,-lts,-firmware} "$shell" efibootmgr sbctl - < pkglist.txt
find /mnt/etc/ -name '*.pacnew' -delete