feat: full rewrite in modules
This commit is contained in:
parent
33725b0188
commit
5cc6a0dd08
30
README.md
30
README.md
@ -1,31 +1,13 @@
|
|||||||
# archinstall
|
# archinstall
|
||||||
My personal Arch install script. It automates from step 2 of ArchWiki's
|
My personal Arch install script.
|
||||||
[Installation guide](https://wiki.archlinux.org/title/Installation_guide#Installation)
|
|
||||||
and more!
|
|
||||||
|
|
||||||
## HOW-TO
|
## HOW-TO
|
||||||
Follow the [Pre-installation](https://wiki.archlinux.org/title/Installation_guide#Pre-installation).
|
Clone the script, edit the `config` file to match your preferences and run the
|
||||||
Once you mounted the partitions, clone this script
|
`install.sh` script.
|
||||||
```bash
|
|
||||||
git clone https://git.maby.dev/ange/archinstall /tmp/ai && cd -- "$_"
|
|
||||||
```
|
|
||||||
|
|
||||||
To install the base system, run:
|
|
||||||
```bash
|
```bash
|
||||||
|
git clone https://git.maby.dev/ange/archinstall.git
|
||||||
|
cd archinstall
|
||||||
$EDITOR config
|
$EDITOR config
|
||||||
./base.sh
|
./install.sh
|
||||||
```
|
|
||||||
|
|
||||||
If you want a desktop install:
|
|
||||||
```bash
|
|
||||||
$EDITOR ./desktop/config
|
|
||||||
./desktop/install.sh
|
|
||||||
|
|
||||||
$EDITOR ./desktop/$WM/config
|
|
||||||
./desktop/$WM/install.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
For the dotfiles, run the script as the newly created user:
|
|
||||||
```bash
|
|
||||||
su - $user -c ./dotfiles.sh
|
|
||||||
```
|
```
|
||||||
|
18
config
18
config
@ -2,14 +2,18 @@
|
|||||||
# Comment to disable
|
# Comment to disable
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
#swapfile=2048
|
install_type=dwm # base|desktop|dwm
|
||||||
swapfile=auto # auto|MB
|
|
||||||
|
disk=/dev/nvme0n1
|
||||||
|
disk_passwd=cryptroot
|
||||||
|
|
||||||
|
swapfile=1024 # MiB
|
||||||
|
|
||||||
username=ange
|
username=ange
|
||||||
user_passwd=ange
|
user_passwd=ange
|
||||||
root_passwd=root
|
root_passwd=root
|
||||||
|
|
||||||
default_shell=/bin/zsh
|
shell=zsh
|
||||||
|
|
||||||
hostname="$username-pc"
|
hostname="$username-pc"
|
||||||
|
|
||||||
@ -20,15 +24,14 @@ locales=(
|
|||||||
lang="${locales[0]}"
|
lang="${locales[0]}"
|
||||||
|
|
||||||
pkg=(
|
pkg=(
|
||||||
base{,-devel} man-{db,pages} tldr
|
base-devel man-{db,pages} tldr
|
||||||
efibootmgr
|
efibootmgr
|
||||||
fastfetch
|
fastfetch
|
||||||
git
|
git
|
||||||
gvfs{,-gphoto2,-mtp} dosfstools exfatprogs
|
dosfstools exfatprogs
|
||||||
iwd iptables-nft wireguard-tools bind gnu-netcat
|
iwd iptables-nft wireguard-tools bind gnu-netcat
|
||||||
jq
|
jq
|
||||||
lf
|
lf
|
||||||
linux{,-lts,-firmware} mkinitcpio
|
|
||||||
neovim{,-lspconfig} python-{pynvim,black} ripgrep bash-language-server pyright
|
neovim{,-lspconfig} python-{pynvim,black} ripgrep bash-language-server pyright
|
||||||
opendoas
|
opendoas
|
||||||
openssh
|
openssh
|
||||||
@ -38,8 +41,7 @@ pkg=(
|
|||||||
renameutils perl-rename
|
renameutils perl-rename
|
||||||
rsync
|
rsync
|
||||||
terminus-font awesome-terminal-fonts
|
terminus-font awesome-terminal-fonts
|
||||||
tlp
|
fzf
|
||||||
zsh fzf
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# vim: ft=sh
|
# vim: ft=sh
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
# User Variables
|
|
||||||
# Comment to disable
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
|
|
||||||
pkg=(
|
|
||||||
autorandr
|
|
||||||
i3lock xss-lock
|
|
||||||
picom
|
|
||||||
xorg-{server,xinit,xrandr,xsetroot} xclip xdotool
|
|
||||||
)
|
|
||||||
|
|
||||||
# vim: ft=sh
|
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
cd -- "$(dirname "$0")"
|
|
||||||
. ../../src/lib.sh
|
|
||||||
|
|
||||||
cp -rfTv rootfs/ /mnt/
|
|
||||||
cat config ../../src/lib.sh src/install.sh | arch-chroot /mnt/ bash
|
|
||||||
|
|
||||||
echo "${BOLD}${GREEN}DONE${NORMAL}"
|
|
@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
pac "${pkg[@]}"
|
|
||||||
|
|
||||||
case "$(lsmod)" in
|
|
||||||
*amdgpu*)
|
|
||||||
pac xf86-video-amdgpu
|
|
||||||
;;
|
|
||||||
*i915*)
|
|
||||||
# https://wiki.archlinux.org/title/Intel_graphics#Installation
|
|
||||||
#pac xf86-video-intel
|
|
||||||
;;
|
|
||||||
*nouveau*)
|
|
||||||
# https://bugs.freedesktop.org/show_bug.cgi?id=94844#c3
|
|
||||||
#pac xf86-video-nouveau
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
git clone --depth 1 https://git.maby.dev/ange/.dotfiles /tmp/dotfiles
|
|
||||||
/tmp/dotfiles/.config/suckless/update.sh
|
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
cd -- "$(dirname "$0")"
|
|
||||||
. ../src/lib.sh
|
|
||||||
|
|
||||||
cat config ../src/lib.sh src/install.sh | arch-chroot /mnt/ bash
|
|
||||||
|
|
||||||
echo "${BOLD}${GREEN}DONE${NORMAL}"
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
pac "${pkg[@]}" flatpak xdg-desktop-portal-gtk
|
|
||||||
flatpak install -y "${flatpakpkg[@]}"
|
|
||||||
|
|
||||||
case "$(lspci | grep 'VGA\|3D')" in
|
|
||||||
*AMD*) pac vulkan-radeon ;;
|
|
||||||
*Intel*) pac vulkan-intel ;;
|
|
||||||
*NVIDIA*) pac vulkan-nouveau ;;
|
|
||||||
*) ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
xdg-user-dirs-update
|
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
cd -- "$(dirname "$0")"
|
|
||||||
. ./config
|
|
||||||
. ./src/lib.sh
|
|
||||||
|
|
||||||
cat src/dotfiles.sh | arch-chroot /mnt/ su - "$username" -c 'bash'
|
|
||||||
|
|
||||||
echo "${BOLD}${GREEN}DONE.${NORMAL}"
|
|
35
install.sh
35
install.sh
@ -1,34 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd -- "$(dirname "$0")"
|
|
||||||
|
set -a
|
||||||
. ./config
|
. ./config
|
||||||
. ./src/lib.sh
|
set +a
|
||||||
|
|
||||||
set -x
|
./modules/"$install_type".sh
|
||||||
(
|
|
||||||
case "$swapfile" in
|
|
||||||
[0-9]*)
|
|
||||||
size="$swapfile"
|
|
||||||
;;
|
|
||||||
auto)
|
|
||||||
ram="$(free -m | awk '/^Mem:/ {print $2}')"
|
|
||||||
size="$(python -c "from math import ceil,log; print(2**ceil((log($ram)/log(2))))")"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
dd if=/dev/zero of=/mnt/swapfile bs=1M count="$size" status=progress
|
|
||||||
chmod 600 /mnt/swapfile
|
|
||||||
mkswap /mnt/swapfile
|
|
||||||
swapon /mnt/swapfile
|
|
||||||
)
|
|
||||||
|
|
||||||
pacstrap -C rootfs/etc/pacman.conf -K /mnt/ --needed "${pkg[@]}"
|
|
||||||
cp -rfTv rootfs/ /mnt/
|
|
||||||
genfstab -U /mnt/ >> /mnt/etc/fstab
|
|
||||||
swapoff /mnt/swapfile
|
|
||||||
|
|
||||||
cat config src/lib.sh src/install.sh | arch-chroot /mnt/ bash
|
|
||||||
|
|
||||||
echo "${BOLD}${GREEN}DONE${NORMAL}"
|
|
||||||
|
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
|
@ -1,13 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd
|
#shellcheck disable=SC2154
|
||||||
|
|
||||||
config=(git --git-dir "$HOME/.dotfiles" --work-tree "$HOME")
|
config=(git --git-dir "$HOME/.dotfiles" --work-tree "$HOME")
|
||||||
repo='https://git.maby.dev/ange/.dotfiles.git'
|
repo='https://git.maby.dev/ange/.dotfiles.git'
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
git clone --bare "$repo" "$HOME/.dotfiles"
|
git clone --bare "$repo" "$HOME/.dotfiles"
|
||||||
|
|
||||||
"${config[@]}" checkout -f
|
"${config[@]}" checkout -f
|
||||||
"${config[@]}" submodule update --init --recursive --remote
|
"${config[@]}" submodule update --init --recursive --remote
|
||||||
"${config[@]}" config status.showUntrackedFiles no
|
"${config[@]}" config status.showUntrackedFiles no
|
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
|
@ -1,14 +1,14 @@
|
|||||||
# User Variables
|
#!/bin/bash
|
||||||
# Comment to disable
|
#shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
|
||||||
|
|
||||||
pkg=(
|
pkg+=(
|
||||||
aerc w3m
|
aerc w3m
|
||||||
bluez{,-utils}
|
bluez{,-utils}
|
||||||
dunst libnotify
|
dunst libnotify
|
||||||
feh
|
feh
|
||||||
gammastep
|
gammastep
|
||||||
graphicsmagick ghostscript
|
graphicsmagick ghostscript
|
||||||
|
gvfs{,-gphoto2,-mtp}
|
||||||
materia-gtk-theme papirus-icon-theme
|
materia-gtk-theme papirus-icon-theme
|
||||||
monero
|
monero
|
||||||
mpv
|
mpv
|
||||||
@ -25,7 +25,7 @@ pkg=(
|
|||||||
zenity
|
zenity
|
||||||
)
|
)
|
||||||
|
|
||||||
flatpakpkg=(
|
flatpakpkg+=(
|
||||||
com.valvesoftware.Steam org.freedesktop.Platform.VulkanLayer.gamescope
|
com.valvesoftware.Steam org.freedesktop.Platform.VulkanLayer.gamescope
|
||||||
net.lutris.Lutris
|
net.lutris.Lutris
|
||||||
org.gimp.GIMP
|
org.gimp.GIMP
|
||||||
@ -33,4 +33,13 @@ flatpakpkg=(
|
|||||||
org.mozilla.firefox
|
org.mozilla.firefox
|
||||||
)
|
)
|
||||||
|
|
||||||
# vim: ft=sh
|
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
|
0
rootfs/boot/loader/entries/arch-lts.conf
Executable file → Normal file
0
rootfs/boot/loader/entries/arch-lts.conf
Executable file → Normal file
0
rootfs/boot/loader/entries/arch.conf
Executable file → Normal file
0
rootfs/boot/loader/entries/arch.conf
Executable file → Normal file
0
rootfs/boot/loader/loader.conf
Executable file → Normal file
0
rootfs/boot/loader/loader.conf
Executable file → Normal file
81
rootfs/etc/mkinitcpio.conf
Normal file
81
rootfs/etc/mkinitcpio.conf
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# vim:set ft=sh
|
||||||
|
# MODULES
|
||||||
|
# The following modules are loaded before any boot hooks are
|
||||||
|
# run. Advanced users may wish to specify all system modules
|
||||||
|
# in this array. For instance:
|
||||||
|
# MODULES=(usbhid xhci_hcd)
|
||||||
|
MODULES=()
|
||||||
|
|
||||||
|
# BINARIES
|
||||||
|
# This setting includes any additional binaries a given user may
|
||||||
|
# wish into the CPIO image. This is run last, so it may be used to
|
||||||
|
# override the actual binaries included by a given hook
|
||||||
|
# BINARIES are dependency parsed, so you may safely ignore libraries
|
||||||
|
BINARIES=()
|
||||||
|
|
||||||
|
# FILES
|
||||||
|
# This setting is similar to BINARIES above, however, files are added
|
||||||
|
# as-is and are not parsed in any way. This is useful for config files.
|
||||||
|
FILES=()
|
||||||
|
|
||||||
|
# HOOKS
|
||||||
|
# This is the most important setting in this file. The HOOKS control the
|
||||||
|
# modules and scripts added to the image, and what happens at boot time.
|
||||||
|
# Order is important, and it is recommended that you do not change the
|
||||||
|
# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
|
||||||
|
# help on a given hook.
|
||||||
|
# 'base' is _required_ unless you know precisely what you are doing.
|
||||||
|
# 'udev' is _required_ in order to automatically load modules
|
||||||
|
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
|
||||||
|
# Examples:
|
||||||
|
## This setup specifies all modules in the MODULES setting above.
|
||||||
|
## No RAID, lvm2, or encrypted root is needed.
|
||||||
|
# HOOKS=(base)
|
||||||
|
#
|
||||||
|
## This setup will autodetect all modules for your system and should
|
||||||
|
## work as a sane default
|
||||||
|
# HOOKS=(base udev autodetect modconf block filesystems fsck)
|
||||||
|
#
|
||||||
|
## This setup will generate a 'full' image which supports most systems.
|
||||||
|
## No autodetection is done.
|
||||||
|
# HOOKS=(base udev modconf block filesystems fsck)
|
||||||
|
#
|
||||||
|
## This setup assembles a mdadm array with an encrypted root file system.
|
||||||
|
## Note: See 'mkinitcpio -H mdadm_udev' for more information on RAID devices.
|
||||||
|
# HOOKS=(base udev modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)
|
||||||
|
#
|
||||||
|
## This setup loads an lvm2 volume group.
|
||||||
|
# HOOKS=(base udev modconf block lvm2 filesystems fsck)
|
||||||
|
#
|
||||||
|
## This will create a systemd based initramfs which loads an encrypted root filesystem.
|
||||||
|
# HOOKS=(base systemd autodetect modconf kms keyboard sd-vconsole sd-encrypt block filesystems fsck)
|
||||||
|
#
|
||||||
|
## NOTE: If you have /usr on a separate partition, you MUST include the
|
||||||
|
# usr and fsck hooks.
|
||||||
|
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt filesystems fsck)
|
||||||
|
|
||||||
|
# COMPRESSION
|
||||||
|
# Use this to compress the initramfs image. By default, zstd compression
|
||||||
|
# is used for Linux ≥ 5.9 and gzip compression is used for Linux < 5.9.
|
||||||
|
# Use 'cat' to create an uncompressed image.
|
||||||
|
#COMPRESSION="zstd"
|
||||||
|
#COMPRESSION="gzip"
|
||||||
|
#COMPRESSION="bzip2"
|
||||||
|
#COMPRESSION="lzma"
|
||||||
|
#COMPRESSION="xz"
|
||||||
|
#COMPRESSION="lzop"
|
||||||
|
#COMPRESSION="lz4"
|
||||||
|
|
||||||
|
# COMPRESSION_OPTIONS
|
||||||
|
# Additional options for the compressor
|
||||||
|
#COMPRESSION_OPTIONS=()
|
||||||
|
|
||||||
|
# MODULES_DECOMPRESS
|
||||||
|
# Decompress loadable kernel modules and their firmware during initramfs
|
||||||
|
# creation. Switch (yes/no).
|
||||||
|
# Enable to allow further decreasing image size when using high compression
|
||||||
|
# (e.g. xz -9e or zstd --long --ultra -22) at the expense of increased RAM usage
|
||||||
|
# at early boot.
|
||||||
|
# Note that any compressed files will be placed in the uncompressed early CPIO
|
||||||
|
# to avoid double compression.
|
||||||
|
#MODULES_DECOMPRESS="no"
|
@ -1,57 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
# System config
|
|
||||||
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
|
|
||||||
|
|
||||||
sed -i '/^HOOKS=(/s/filesystems/encrypt filesystems/' /etc/mkinitcpio.conf
|
|
||||||
|
|
||||||
# Services
|
|
||||||
systemctl enable \
|
|
||||||
iwd.service \
|
|
||||||
nftables.service \
|
|
||||||
reflector.timer \
|
|
||||||
systemd-networkd.service \
|
|
||||||
systemd-resolved.service \
|
|
||||||
systemd-timesyncd.service \
|
|
||||||
tlp.service
|
|
||||||
|
|
||||||
sudo -u "$username" systemctl enable podman.socket
|
|
||||||
|
|
||||||
# Users
|
|
||||||
echo "root:$root_passwd" | chpasswd
|
|
||||||
useradd -mG wheel,video "$username" -s "${default_shell-/bin/bash}"
|
|
||||||
echo - "$username:$user_passwd" | chpasswd
|
|
||||||
|
|
||||||
# ucode
|
|
||||||
case "$(lscpu)" in
|
|
||||||
*AMD*) pac amd-ucode ;;
|
|
||||||
*Intel*) pac intel-ucode ;;
|
|
||||||
*) ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Bootloader
|
|
||||||
bootctl install
|
|
||||||
|
|
||||||
root="$(findmnt -nr -o source /)"
|
|
||||||
cryptdev="$(cryptsetup status "$root" | awk '/device/{print $2}' || true)"
|
|
||||||
if [ -n "$cryptdev" ]; then
|
|
||||||
uuid="$(blkid | grep "$cryptdev" | awk '{print $2}')"
|
|
||||||
options="cryptdevice=$uuid:$(basename "$root") "
|
|
||||||
fi
|
|
||||||
|
|
||||||
options="${options}root=$root"
|
|
||||||
|
|
||||||
for f in /boot/loader/entries/*.conf; do
|
|
||||||
cat << EOF >> "$f"
|
|
||||||
options $options rw
|
|
||||||
EOF
|
|
||||||
done
|
|
11
src/lib.sh
11
src/lib.sh
@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ -t 1 ]; then
|
|
||||||
NORMAL=$'\e[0m'
|
|
||||||
BOLD=$'\e[1m'
|
|
||||||
GREEN=$'\e[32m'
|
|
||||||
fi
|
|
||||||
|
|
||||||
function pac() {
|
|
||||||
yes | pacman --needed -Syu "$@"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user