chore: init with draft script

This commit is contained in:
2025-10-15 13:41:32 +03:00
commit 95a6a03a56
2 changed files with 118 additions and 0 deletions

117
install.sh Normal file
View File

@@ -0,0 +1,117 @@
# prepare ssd
sgdisk -Z /dev/nvme0n1 # zap all on disk
sgdisk -a 2048 -o /dev/nvme0n1 # new gpt disk 2048 alignment
sgdisk -n 1::+1G --typecode=1:ef00 --change-name=1:'BOOT' /dev/nvme0n1 # UEFI Boot Partition
sgdisk -n 2::+32G --typecode=2:8200 --change-name=2:'SWAP' /dev/nvme0n1 # SWAP
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' /dev/nvme0n1 # partition 3 (Root), default start, remaining
mkfs.vfat -F32 -n "BOOT" /dev/nvme0n1p1
swapon /dev/nvme0n1p2
mkfs.btrfs -L ROOT /dev/nvme0n1p3 -f
mount -t btrfs /dev/nvme0n1p3 /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@var
btrfs subvolume create /mnt/@tmp
btrfs subvolume create /mnt/@.snapshots
# unmount root to remount with subvolume
umount /mnt
mount -o subvol=@ /dev/nvme0n1p3 /mnt
mkdir -p /mnt/{home,var,tmp,.snapshots}
mount -o subvol=@home /dev/nvme0n1p3 /mnt/home
mount -o subvol=@tmp /dev/nvme0n1p3 /mnt/tmp
mount -o subvol=@var /dev/nvme0n1p3 /mnt/var
mount -o subvol=@.snapshots /dev/nvme0n1p3 /mnt/.snapshots
# mount boot
mkdir -p /mnt/boot/efi
mount -t vfat -L BOOT /mnt/boot/
# timedatectl set-ntp true
# pacman -Sy --noconfirm archlinux-keyring # update keyrings to latest to prevent packages failing to install
iso=$(curl -4 ifconfig.co/country-iso) # grab country code
reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
pacstrap --noconfirm --needed /mnt \
base base-devel linux linux-firmware git \
dhcpcd btrfs-progs amd-ucode nvidia nvidia-utils nvidia-xconfig \
neovim sudo archlinux-keyring wget pipewire pavucontrol
genfstab -L /mnt >>/mnt/etc/fstab
cat /mnt/etc/fstab
bootctl --esp-path=/mnt/boot install
root_uuid=$(blkid /dev/nvme0n1p3 -s UUID -o value)
cat >/mnt/boot/loader/entries/arch.conf <<EOL
title arch
linux vmlinuz-linux
initrd initramfs-linux.img
initrd amd-ucode.img
options root=UUID=${root_uuid} rw nomodeset rootflags=subvol=@ loglevel=3
EOL
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /mnt/etc/locale.gen
ln -s /mnt/usr/share/zoneinfo/Europe/Kyiv /mnt/etc/localtime
sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /mnt/etc/sudoers
sed -i 's/^# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /mnt/etc/sudoers
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /mnt/etc/pacman.conf
sed -i "/\[multilib\]/,/Include/"'s/^#//' /mnt/etc/pacman.conf
#chroot
arch-chroot /mnt bash -c "
usermod -p 'changeme' root
useradd -m -G wheel -s /bin/bash madundead
echo 'madundead:changeme' | chpasswd
locale-gen
timedatectl --no-ask-password set-timezone Europe/Kyiv
timedatectl --no-ask-password set-ntp 1
localectl --no-ask-password set-locale LANG='en_US.UTF-8' LC_TIME='en_US.UTF-8'
systemctl enable dhcpcd
"
# sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si
# TODO: enable multilib in pacman first, then
# pacman -Syu
# yay -S arch-gaming-meta
# usermod -p 'changeme' root
# echo 'password is changeme'
# systemd-sysvcompat !!!
# hwclock --systohc
#
# sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
# locale-gen
#
# ln -sf /usr/share/zoneinfo/Europe/Kyiv /etc/localtime
# timedatectl --no-ask-password set-timezone Europe/Kyiv
# timedatectl --no-ask-password set-ntp 1
#
# # Add sudo no password rights
# sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
# sed -i 's/^# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers
#
# #Add parallel downloading
# sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
#
# #Enable multilib
# sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
# pacman -Sy --noconfirm --needed
# # pacman -S --noconfirm --needed amd-ucode nvidia
#
# passwd # set root passwd