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

8
config
View File

@ -1,5 +1,4 @@
# User Variables
# Comment to disable
# shellcheck disable=SC2034
install_type=dwm # base|desktop|dwm
@ -7,25 +6,24 @@ install_type=dwm # base|desktop|dwm
disk=/dev/nvme0n1
disk_passwd=cryptroot
swapfile=1024 # MiB
swapfile=1024 # MiB, Comment to disable
username=ange
userpasswd=ange
rootpasswd=root
rootpasswd=root # Comment to disable
shell=bash
hostname="$username-pc"
tz=Europe/Paris
locales=en_US # 'en_US,fr_FR'
locales=en_US # en_US,fr_FR
lang=en_US
pkg=(
base-devel man-{db,pages} tldr
bash-completion fzf
dosfstools exfatprogs
efibootmgr
fastfetch
git
iwd iptables-nft wireguard-tools bind gnu-netcat

View File

@ -1,5 +1,8 @@
#!/bin/bash
echo 'If you want Secure Boot support, you need to put your system in Setup Mode'
read -r
exec &> >(tee logs.out)
set -a

View File

@ -2,11 +2,11 @@
#shellcheck disable=SC2154
sgdisk -Z \
-n '0:0:+512M' -t '0:ef00' -c '0:boot' \
-n '0:0:+512M' -t '0:ef00' -c '0:esp' \
-n '0:0:0' -t '0:8300' -c '0:root' \
"$disk"
boot=/dev/disk/by-partlabel/boot
esp=/dev/disk/by-partlabel/esp
root=/dev/disk/by-partlabel/root
[ -n "$disk_passwd" ] && {
@ -15,21 +15,26 @@ root=/dev/disk/by-partlabel/root
root=/dev/mapper/cryptroot
}
sleep 2 # wait for /dev/disk/by-partlabel/ to be populated
sleep 5 # wait /dev/disk/by-partlabel/
mkfs.fat -F32 "$boot"
mkfs.vfat -F32 "$esp"
mkfs.ext4 -F "$root"
mount "$root" /mnt/
mount -m -o fmask=0077,dmask=0077 /dev/disk/by-partlabel/boot /mnt/boot/
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/
genfstab -U /mnt/ >> /mnt/etc/fstab
swapoff /mnt/swapfile

View File

@ -13,6 +13,6 @@ esac
[ -d /sys/class/power_supply/BAT0 ] && echo tlp >> pkglist.txt
pacstrap -C rootfs/etc/pacman.conf -K /mnt \
base linux{,-lts,-firmware} "$shell" - < pkglist.txt
base linux{,-lts,-firmware} "$shell" efibootmgr sbctl - < pkglist.txt
find /mnt/etc/ -name '*.pacnew' -delete

View File

@ -0,0 +1,22 @@
#!/bin/bash
#shellcheck disable=SC2154
root="$(findmnt -n -osource /)"
boot="$(lsblk -ls -oname /dev/disk/by-partlabel/boot | tail -n1)"
cryptdev="$(cryptsetup status "$root" | awk '/device/ {print $2}')"
[ -n "$cryptdev" ] && {
uuid="$(blkid | grep "$cryptdev" | awk '{print $2}')"
options="cryptdevice=$uuid:${root##*/} "
}
options="${options}root=$root rw"
sbctl create-keys
sbctl enroll-keys
for l in arch{,-lts-fallback}; do
efibootmgr --create --unicode --label "$l" \
--disk "$boot" --part 1 --loader "\EFI\Linux\arch-linux$l.efi"
done
echo "$options" > /etc/cmdline.d/root.conf

View File

@ -4,5 +4,5 @@
shell="$(sed -n "/$shell/{p;q}" /etc/shells)"
useradd -mG wheel,video "$username" -s "${shell:-/bin/bash}"
echo "root:$rootpasswd" | chpasswd
[ -n "$rootpasswd" ] && echo "root:$rootpasswd" | chpasswd
echo "$username:$userpasswd" | chpasswd

View File

@ -1,4 +1,5 @@
#!/bin/bash
#shellcheck disable=SC2154
git clone --depth 1 https://git.maby.dev/ange/.dotfiles.git /tmp/dotfiles
/tmp/dotfiles/.config/suckless/update.sh

View File

@ -1,21 +1,21 @@
#!/bin/bash
#shellcheck disable=SC2154
for i in modules/prechroot/*.sh; do
for i in modules/00-prechroot/*.sh; do
bash -x "$i"
done
cp -r modules/chroot/ /mnt/
for i in modules/chroot/*.sh; do
for i in modules/10-chroot/*.sh; do
arch-chroot /mnt bash -x "${i/modules/}"
done
for i in modules/chroot/user/*.sh; do
for i in modules/10-chroot/user/*.sh; do
arch-chroot /mnt su - "$username" -c "bash -x '${i/modules/}'"
done
for i in modules/postchroot/*.sh; do
for i in modules/20-postchroot/*.sh; do
bash -x "$i"
done

View File

@ -1,20 +0,0 @@
#!/bin/bash
#shellcheck disable=SC2154
bootctl install
root="$(findmnt -nr -o source /)"
cryptdev="$(cryptsetup status "$root" | awk '/device/ {print $2}')"
[ -n "$cryptdev" ] && {
uuid="$(blkid | grep "$cryptdev" | awk '{print $2}')"
options="cryptdevice=$uuid:$(basename "$root") "
}
options="${options}root=$root"
for f in /boot/loader/entries/*.conf; do
cat << EOF >> "$f"
options $options rw
EOF
done

View File

@ -6,7 +6,6 @@ printf '%s\n' \
aerc w3m \
alacritty \
bluez{,-utils} \
dunst libnotify \
feh \
gammastep \
graphicsmagick ghostscript \

View File

@ -1,3 +0,0 @@
title Arch Linux LTS
linux /vmlinuz-linux-lts
initrd /initramfs-linux-lts.img

View File

@ -1,3 +0,0 @@
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img

View File

@ -1 +0,0 @@
default arch

View File

View File

@ -0,0 +1,3 @@
ALL_kver='/boot/vmlinuz-linux-lts'
PRESETS=('fallback')
fallback_uki='/efi/EFI/Linux/arch-linux-lts-fallback.efi'

View File

@ -0,0 +1,3 @@
ALL_kver="/boot/vmlinuz-linux"
PRESETS=('default')
default_uki="/efi/EFI/Linux/arch-linux.efi"

View File

@ -1,2 +1 @@
blacklist pcspkr
blacklist snd_pcsp

View File

@ -7,7 +7,7 @@ table inet filter {
chain input {
type filter hook input priority filter; policy drop;
#tcp dport 32768-40960 counter meta nftrace set 1 accept comment "WoW VoiceError:17"
#tcp dport 32768-65535 counter meta nftrace set 1 accept comment "WoW VoiceError:17"
ct state invalid counter drop
ct state {established,related} counter accept

View File

@ -35,6 +35,8 @@ Color
CheckSpace
VerbosePkgLists
ParallelDownloads = 8
DownloadUser = alpm
#DisableSandbox
ILoveCandy
# By default, pacman accepts packages signed by keys that its local keyring

View File

@ -1,9 +0,0 @@
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd
[Action]
Description = Gracefully upgrading systemd-boot...
When = PostTransaction
Exec = /usr/bin/systemctl restart systemd-boot-update.service