feat: full rewrite in modules
This commit is contained in:
parent
33725b0188
commit
5cc6a0dd08
31 changed files with 283 additions and 215 deletions
32
modules/00-prechroot/10-disk.sh
Normal file
32
modules/00-prechroot/10-disk.sh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
sgdisk -Z \
|
||||
-n '0:0:+512M' -t '0:ef00' -c '0:boot' \
|
||||
-n '0:0:0' -t '0:8300' -c '0:root' \
|
||||
"$disk"
|
||||
|
||||
boot=/dev/disk/by-partlabel/boot
|
||||
root=/dev/disk/by-partlabel/root
|
||||
|
||||
[ -n "$disk_passwd" ] && {
|
||||
echo "$disk_passwd" | cryptsetup luksFormat "$root" -
|
||||
echo "$disk_passwd" | cryptsetup open "$root" cryptroot -
|
||||
root=/dev/mapper/cryptroot
|
||||
}
|
||||
|
||||
mkfs.vfat -F32 "$boot"
|
||||
mkfs.ext4 "$root"
|
||||
mount "$root" /mnt/
|
||||
mount -mo fmask=0077,dmask=0077 /dev/disk/by-partlabel/boot /mnt/boot/
|
||||
|
||||
[ -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
|
||||
}
|
||||
|
||||
cp -rfTv rootfs/ /mnt/
|
||||
genfstab -U /mnt/ >> /mnt/etc/fstab
|
||||
swapoff /mnt/swapfile
|
||||
15
modules/00-prechroot/20-pkg.sh
Normal file
15
modules/00-prechroot/20-pkg.sh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
case "$(lscpu)" in
|
||||
*AMD*) pkg+=(amd-ucode) ;;
|
||||
*Intel*) pkg+=(intel-ucode) ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
[ -n "$flatpak" ] && pkg+=(flatpak xdg-desktop-portal-gtk)
|
||||
|
||||
[ -f /sys/class/power_supply/BAT0 ] && pkg+=(tlp)
|
||||
|
||||
pacstrap -C rootfs/etc/pacman.conf -K /mnt/ \
|
||||
base linux{,-lts,-firmware} "$shell" "${pkg[@]}"
|
||||
16
modules/00-prechroot/99-done.sh
Normal file
16
modules/00-prechroot/99-done.sh
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
BOLD=$'\e[1m'
|
||||
GREEN=$'\e[32m'
|
||||
NORMAL=$'\e[0m'
|
||||
|
||||
echo -e "${BOLD}${GREEN}DONE. Umount? [Y/n]${NORMAL} " && read -r ANS
|
||||
|
||||
case "$ANS" in
|
||||
[Yy]*) ;;
|
||||
*) exit ;;
|
||||
esac
|
||||
|
||||
awk '/mnt/ {print $1}' < /proc/swaps | xargs swapoff
|
||||
umount -R /mnt/
|
||||
14
modules/10-chroot/00-bootstrap.sh
Normal file
14
modules/10-chroot/00-bootstrap.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime
|
||||
hwclock --systohc
|
||||
|
||||
for l in "${locales[@]}"; do
|
||||
sed -i "/^#\s*$l.UTF-8/s/^#\s*//" /etc/locale.gen
|
||||
done
|
||||
locale-gen
|
||||
|
||||
echo "LANG=$lang.UTF-8" > /etc/locale.conf
|
||||
|
||||
echo - "$hostname" > /etc/hostname
|
||||
20
modules/10-chroot/10-bootloader.sh
Normal file
20
modules/10-chroot/10-bootloader.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/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
|
||||
8
modules/10-chroot/20-users.sh
Normal file
8
modules/10-chroot/20-users.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
shell="$(sed -n "/$shell/{p;q}" /etc/shells)"
|
||||
useradd -mG wheel,video "$username" -s "${shell:-/bin/bash}"
|
||||
|
||||
echo "root:$root_passwd" | chpasswd
|
||||
echo - "$username:$user_passwd" | chpasswd
|
||||
11
modules/10-chroot/30-services.sh
Normal file
11
modules/10-chroot/30-services.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
systemctl enable \
|
||||
iwd.service \
|
||||
nftables.service \
|
||||
reflector.timer \
|
||||
systemd-networkd.service \
|
||||
systemd-resolved.service \
|
||||
systemd-timesyncd.service \
|
||||
tlp.service
|
||||
4
modules/10-chroot/40-flatpak.sh
Normal file
4
modules/10-chroot/40-flatpak.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
[ -n "$flatpak" ] && flatpak install -y "${flatpak[@]}"
|
||||
4
modules/20-user/10-services.sh
Normal file
4
modules/20-user/10-services.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
systemctl enable --user podman.socket
|
||||
11
modules/20-user/20-dotfiles.sh
Normal file
11
modules/20-user/20-dotfiles.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
config=(git --git-dir "$HOME/.dotfiles" --work-tree "$HOME")
|
||||
repo='https://git.maby.dev/ange/.dotfiles.git'
|
||||
|
||||
git clone --bare "$repo" "$HOME/.dotfiles"
|
||||
"${config[@]}" checkout -f
|
||||
"${config[@]}" submodule update --init --recursive --remote
|
||||
"${config[@]}" config status.showUntrackedFiles no
|
||||
"${config[@]}" remote set-url origin git@git.maby.dev:ange/.dotfiles.git
|
||||
14
modules/base.sh
Normal file
14
modules/base.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
for i in modules/00-prechroot/*.sh; do
|
||||
bash -x "$i"
|
||||
done
|
||||
|
||||
for i in modules/10-chroot/*.sh; do
|
||||
arch-chroot /mnt/ bash -x "$i"
|
||||
done
|
||||
|
||||
for i in modules/20-user/*.sh; do
|
||||
arch-chroot /mnt/ sudo -u "$username" bash -x "$i"
|
||||
done
|
||||
45
modules/desktop.sh
Normal file
45
modules/desktop.sh
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
pkg+=(
|
||||
aerc w3m
|
||||
bluez{,-utils}
|
||||
dunst libnotify
|
||||
feh
|
||||
gammastep
|
||||
graphicsmagick ghostscript
|
||||
gvfs{,-gphoto2,-mtp}
|
||||
materia-gtk-theme papirus-icon-theme
|
||||
monero
|
||||
mpv
|
||||
#newsraft
|
||||
noto-fonts{,-cjk,-emoji} ttf-{dejavu,liberation} otf-font-awesome
|
||||
pass{,-otp} gcr
|
||||
pcmanfm-gtk3
|
||||
pipewire{,-pulse,-jack} pavucontrol playerctl
|
||||
polkit-gnome
|
||||
qemu-{base,audio-pipewire,hw-usb-host,hw-display-virtio-{gpu,vga},ui-gtk} dnsmasq
|
||||
xdg-user-dirs
|
||||
yt-dlp
|
||||
zathura{,-pdf-poppler}
|
||||
zenity
|
||||
)
|
||||
|
||||
flatpakpkg+=(
|
||||
com.valvesoftware.Steam org.freedesktop.Platform.VulkanLayer.gamescope
|
||||
net.lutris.Lutris
|
||||
org.gimp.GIMP
|
||||
org.gtk.Gtk3theme.Materia-dark
|
||||
org.mozilla.firefox
|
||||
)
|
||||
|
||||
case "$(lspci | grep 'VGA\|3D')" in
|
||||
*AMD*) pkg+=(vulkan-radeon) ;;
|
||||
*Intel*) pkg+=(vulkan-intel) ;;
|
||||
*NVIDIA*) pkg+=(vulkan-nouveau) ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
./modules/base.sh
|
||||
|
||||
xdg-user-dirs-update
|
||||
28
modules/dwm.sh
Normal file
28
modules/dwm.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
#shellcheck disable=SC2154
|
||||
|
||||
pkg+=(
|
||||
autorandr
|
||||
i3lock xss-lock
|
||||
picom
|
||||
xorg-{server,xinit,xrandr,xsetroot} xclip xdotool
|
||||
)
|
||||
|
||||
case "$(lsmod)" in
|
||||
*amdgpu*) pkg+=(xf86-video-amdgpu) ;;
|
||||
*i915*)
|
||||
# https://wiki.archlinux.org/title/Intel_graphics#Installation
|
||||
#pkg+=(xf86-video-intel)
|
||||
;;
|
||||
*nouveau*)
|
||||
# https://bugs.freedesktop.org/show_bug.cgi?id=94844#c3
|
||||
#pkg+=(xf86-video-nouveau)
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
./modules/desktop.sh
|
||||
|
||||
git clone --depth 1 https://git.maby.dev/ange/.dotfiles.git dotfiles
|
||||
arch-chroot ./dotfiles/.config/suckless/update.sh
|
||||
Loading…
Add table
Add a link
Reference in a new issue