Skip to content

Commit

Permalink
Merge branch 'games' into temp
Browse files Browse the repository at this point in the history
  • Loading branch information
leomeinel authored May 8, 2023
2 parents c5f70e5 + 07ba9d5 commit 40879a5
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 234 deletions.
88 changes: 28 additions & 60 deletions 0-erase-disks-before-v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,72 +16,40 @@ set -eu
mountpoint -q /mnt &&
umount -AR /mnt

# Detect disks
readarray -t DISKS < <(lsblk -drnpo NAME -I 259,8,254 | tr -d "[:blank:]")
DISKS_LENGTH="${#DISKS[@]}"
for ((i = 0; i < DISKS_LENGTH; i++)); do
udevadm info -q property --property=ID_BUS --value "${DISKS[$i]}" | grep -q "usb" &&
{
unset 'DISKS[$i]'
continue
}
DISKS=("${DISKS[@]}")
done
[[ "${#DISKS[@]}" -ne 2 ]] &&
{
echo "ERROR: There are not exactly 2 disks attached!"
exit 1
}
SIZE1="$(lsblk -drno SIZE "${DISKS[0]}" | tr -d "[:space:]")"
SIZE2="$(lsblk -drno SIZE "${DISKS[1]}" | tr -d "[:space:]")"
if [[ "$SIZE1" = "$SIZE2" ]]; then
DISK1="${DISKS[0]}"
DISK2="${DISKS[1]}"
# Prompt user for disk
# I will use this on an external SSD, therefore USB volumes will be valid
lsblk -drnpo SIZE,NAME -I 259,8,254
read -rp "Which disk do you want to erase? (Type '/dev/sdX' fex.): " choice
if lsblk -drnpo SIZE,NAME -I 259,8,254 $choice; then
echo "Erasing $choice..."
DISK1="$choice"
else
echo "ERROR: The attached disks don't have the same size!"
echo "ERROR: Drive not suitable for installation"
exit 1
fi

# Prompt user
read -rp "Erase $DISK1 and $DISK2? (Type 'yes' in capital letters): " choice
case "$choice" in
YES)
echo "Erasing $DISK1 and $DISK2..."
;;
*)
echo "ERROR: User aborted erasing $DISK1 and $DISK2"
exit 1
;;
esac

# Detect & close old crypt volumes
if lsblk -rno TYPE | grep -q "crypt"; then
OLD_CRYPT_0="$(lsblk -Mrno TYPE,NAME | grep "crypt" | sed 's/crypt//' | sed -n '1p' | tr -d "[:space:]")"
OLD_CRYPT_1="$(lsblk -Mrno TYPE,NAME | grep "crypt" | sed 's/crypt//' | sed -n '2p' | tr -d "[:space:]")"
# Detect, close & erase old crypt volumes
if lsblk -rno TYPE "$DISK1" | grep -q "crypt"; then
OLD_CRYPT_0="$(lsblk -Mrno TYPE,NAME $DISK1 | grep "crypt" | sed 's/crypt//' | sed -n '1p' | tr -d "[:space:]")"
OLD_CRYPT_1="$(lsblk -Mrno TYPE,NAME $DISK1 | grep "crypt" | sed 's/crypt//' | sed -n '2p' | tr -d "[:space:]")"
OLD_DISK1P2="$(lsblk -rnpo TYPE,NAME $DISK1 | grep "part" | sed 's/part//' | sed -n '2p' | tr -d "[:space:]")"
OLD_DISK1P3="$(lsblk -rnpo TYPE,NAME $DISK1 | grep "part" | sed 's/part//' | sed -n '3p' | tr -d "[:space:]")"
## Close old crypt volumes
cryptsetup close "$OLD_CRYPT_0"
cryptsetup close "$OLD_CRYPT_1"
fi

# Detect & erase old crypt/raid1 volumes
if lsblk -rno TYPE | grep -q "raid1"; then
DISK1P2="$(lsblk -rnpo TYPE,NAME "$DISK1" | grep "part" | sed 's/part//' | sed -n '2p' | tr -d "[:space:]")"
DISK2P2="$(lsblk -rnpo TYPE,NAME "$DISK2" | grep "part" | sed 's/part//' | sed -n '2p' | tr -d "[:space:]")"
DISK1P3="$(lsblk -rnpo TYPE,NAME "$DISK1" | grep "part" | sed 's/part//' | sed -n '3p' | tr -d "[:space:]")"
DISK2P3="$(lsblk -rnpo TYPE,NAME "$DISK2" | grep "part" | sed 's/part//' | sed -n '3p' | tr -d "[:space:]")"
OLD_RAID_0="$(lsblk -Mrnpo TYPE,NAME | grep "raid1" | sed 's/raid1//' | sed -n '1p' | tr -d "[:space:]")"
OLD_RAID_1="$(lsblk -Mrnpo TYPE,NAME | grep "raid1" | sed 's/raid1//' | sed -n '2p' | tr -d "[:space:]")"
if cryptsetup isLuks "$OLD_RAID_0"; then
cryptsetup erase "$OLD_RAID_0"
## Erase old crypt volumes
if cryptsetup isLuks "$OLD_DISK1P2"; then
cryptsetup erase "$OLD_DISK1P2"
sgdisk -Z "$OLD_DISK1P2"
else
echo "ERROR: Can't erase old crypt volume"
exit 1
fi
if cryptsetup isLuks "$OLD_RAID_1"; then
cryptsetup erase "$OLD_RAID_1"
if cryptsetup isLuks "$OLD_DISK1P3"; then
cryptsetup erase "$OLD_DISK1P3"
sgdisk -Z "$OLD_DISK1P3"
else
echo "ERROR: Can't erase old crypt volume"
exit 1
fi
sgdisk -Z "$OLD_RAID_0"
sgdisk -Z "$OLD_RAID_1"
mdadm --stop "$OLD_RAID_0"
mdadm --stop "$OLD_RAID_1"
mdadm --zero-superblock "$DISK1P2"
mdadm --zero-superblock "$DISK2P2"
mdadm --zero-superblock "$DISK1P3"
mdadm --zero-superblock "$DISK2P3"
fi
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
# arch-install

My personal Arch Linux install script using mdadm RAID1, LUKS2 encryption, LVM and btrfs.
My personal Arch Linux install script using LUKS2 encryption, LVM and btrfs.

Meant for general purpose systems.
Meant for systems that mainly run steam and other games.

## Info

:information_source: | Expect errors to occur during the installation. They only matter if any of the scripts don't finish successfully.

:information_source: | This script will only work on a system with exactly 2 disks of the same size attached!

:information_source: | I recommend disks with at least 512GB (change $DISK_ALLOCATION in install.conf otherwise).
:information_source: | I recommend a disk with at least 512GB (change $DISK_ALLOCATION in install.conf otherwise).

:warning: | All data on both disks will be wiped!

:exclamation: | Follow [these instructions](https://github.com/leomeinel/arch-install/blob/main/virt-manager.md) for virt-manager.
:exclamation: | Follow [these instructions](https://github.com/leomeinel/arch-install/blob/games/virt-manager.md) for virt-manager.

## Pre-installation

Expand All @@ -24,7 +22,7 @@ Meant for general purpose systems.

```sh
pacman -Sy git
git clone https://github.com/leomeinel/arch-install.git
git clone -b games https://github.com/leomeinel/arch-install.git
chmod +x /root/arch-install/prepare.sh
/root/arch-install/prepare.sh
arch-chroot /mnt
Expand Down
12 changes: 0 additions & 12 deletions etc/pacman.d/hooks/99-efibackup.hook

This file was deleted.

23 changes: 0 additions & 23 deletions etc/pacman.d/hooks/scripts/99-efibackup.sh

This file was deleted.

5 changes: 2 additions & 3 deletions install.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# USERS
SYSUSER="systux"
VIRTUSER="virt"
HOMEUSER="leo"
GUESTUSER="guest"

Expand All @@ -9,7 +8,7 @@ GUESTUSER="guest"
## Network devices: elements
## Servers: colors
## Clients: flowers
HOSTNAME="tulip"
HOSTNAME="lilium"
## https://www.rfc-editor.org/rfc/rfc8375.html
DOMAIN="home.arpa"

Expand All @@ -24,7 +23,7 @@ TIMEZONE="Europe/Amsterdam"
# Strings are sorted by their time of execution.
# x%FREE means x% of what is left after allocating the previous volume.
# / /usr /var /home
DISK_ALLOCATION=("5%FREE" "5%FREE" "40%FREE" "100%FREE")
DISK_ALLOCATION=("5%FREE" "5%FREE" "20%FREE" "100%FREE")
# Example allocation for small disks
#DISK_ALLOCATION=("15%FREE" "40%FREE" "50%FREE" "100%FREE")

Expand Down
3 changes: 0 additions & 3 deletions pkgs-post.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
autotiling
dotnet-sdk-bin
freetube-bin
gdlauncher-bin
kvantum-theme-arc
libreoffice-extension-languagetool
librewolf-bin
macchina-bin
nwg-bar-bin
Expand All @@ -17,4 +15,3 @@ vscodium-bin
vscodium-bin-marketplace
waterfox-g-bin
xdg-ninja-git
xxd-standalone
1 change: 0 additions & 1 deletion pkgs-prepare.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ linux-lts-headers
linux-zen
linux-zen-headers
lvm2
mdadm
mesa
neovim
opendoas
Expand Down
24 changes: 1 addition & 23 deletions pkgs-setup.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
alacritty
alsa-utils
android-tools
apparmor
arc-gtk-theme
arch-audit
Expand All @@ -25,28 +24,18 @@ ethtool
exa
fd
ffmpeg
filezilla
firejail
fwupd
gimp
git-delta
glow
gnome-keyring
go
gradle
grex
grim
gsettings-desktop-schemas
gutenprint
htop
hunspell
hunspell-de
hunspell-en_us
hunspell-fr
hunspell-nl
hwinfo
hyperfine
inetutils
jdk-openjdk
jdk17-openjdk
jdk8-openjdk
Expand All @@ -57,14 +46,9 @@ libavif
libheif
libjxl
libopenraw
libreoffice-extension-texmaths
libreoffice-still
librsvg
libsecret
libvirt
libwmf
lldb
llvm
logrotate
logwatch
lrzip
Expand All @@ -73,7 +57,6 @@ lsof
lxappearance
lzop
man-db
mariadb
mtools
mupdf
mupdf-tools
Expand All @@ -92,23 +75,19 @@ pam-u2f
papirus-icon-theme
pavucontrol
pdftk
perl-image-exiftool
perl-rename
pipewire
pipewire-jack
polkit-gnome
postfix
postgresql
procs
python-pip
python-psutil
qemu-desktop
qt5ct
qt6ct
quilt
ripgrep
rkhunter
rustup
sbsigntools
screen
signal-desktop
Expand All @@ -118,14 +97,14 @@ snap-pac
snapper
sshfs
starship
steam
sway
swaybg
swayidle
sysstat
system-config-printer
thunar
thunderbird
tokei
tpm2-tools
tree
ttf-font-awesome
Expand All @@ -136,7 +115,6 @@ unzip
usbguard
usbutils
viewnior
virt-manager
waybar
webp-pixbuf-loader
wget
Expand Down
7 changes: 1 addition & 6 deletions post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ doas localectl --no-convert set-x11-keymap "$KEYLAYOUT"

# Configure dot-files (setup)
/dot-files.sh setup
doas su -lc '/dot-files.sh setup' "$VIRTUSER"
doas su -lc '/dot-files.sh setup' "$HOMEUSER"
doas su -lc '/dot-files.sh setup' "$GUESTUSER"
doas su -lc '/dot-files.sh setup-min' root
Expand Down Expand Up @@ -291,8 +290,6 @@ doas sed -i "/$STRING/a BatchInstall" "$FILE"

# Install packages
paru -S --noprogressbar --noconfirm --needed - <"$SCRIPT_DIR/pkgs-post.txt"
pacman -Qq "dotnet-sdk-bin" >/dev/null 2>&1 &&
paru -S --noprogressbar --noconfirm --needed --asdeps aspnet-targeting-pack-bin
paru --noprogressbar --noconfirm -Syu
paru -Scc

Expand All @@ -301,7 +298,6 @@ doas firecfg --clean

# Configure dot-files (vscodium)
/dot-files.sh vscodium
doas su -lc '/dot-files.sh vscodium' "$VIRTUSER"
doas su -lc '/dot-files.sh vscodium' "$HOMEUSER"
doas su -lc '/dot-files.sh vscodium' "$GUESTUSER"

Expand Down Expand Up @@ -333,11 +329,10 @@ STRING="^vscodium$"
grep -q "$STRING" "$FILE" || sed_exit
doas sed -i "s/$STRING/#vscodium #arch-install/" "$FILE"
## END sed
doas firecfg --add-users root "$SYSUSER" "$VIRTUSER" "$HOMEUSER" "$GUESTUSER"
doas firecfg --add-users root "$SYSUSER" "$HOMEUSER" "$GUESTUSER"
doas apparmor_parser -r /etc/apparmor.d/firejail-default
doas firecfg
rm -rf ~/.local/share/applications/*
doas su -c 'rm -rf ~/.local/share/applications/*' "$VIRTUSER"
doas su -c 'rm -rf ~/.local/share/applications/*' "$HOMEUSER"
doas su -c 'rm -rf ~/.local/share/applications/*' "$GUESTUSER"

Expand Down
Loading

0 comments on commit 40879a5

Please sign in to comment.