nixos-configs/scripts/archinstaller.sh

44 lines
1.2 KiB
Bash
Raw Normal View History

2023-02-12 12:49:54 -05:00
#!/bin/sh
PART="$1"
KEY="$2"
loadkeys ca
cryptsetup -y -v luksFormat --type luks1 /dev/nvme0n1p$PART
cryptsetup open /dev/nvme0n1p$PART root
mkfs.btrfs /dev/mapper/root
mount /dev/mapper/root /mnt
mount --mkdir /dev/nvme0n1p1 /mnt/boot
mount --mkdir /dev/sda$KEY usb
mv /etc/pacman.conf{,.bak}
mv ./pacman.conf /etc
pacman -Syu
pacstrap -K /mnt base linux-firmware linux amd-ucode patch dkms kmod rtw89-dkms-git btrfs-progs grub os-prober ntfs-3g efibootmgr efivar iwd nano sudo texinfo man-db man-pages
genfstab -U /mnt >> /mnt/etc/fstab
2023-02-12 19:21:11 -05:00
### TODO separate in 2 scripts but remember $PART
2023-02-12 12:49:54 -05:00
arch-chroot /mnt
ln -sf /usr/share/zoneinfo/America/Montreal /etc/localtime
hwclock --systohc
echo matt-laptop > /etc/hostname
passwd
nano /etc/locale.gen
locale-gen
echo LANG=en_CA.UTF-8 > /etc/locale.conf
echo KEYMAP=ca > /etc/vconsole.conf
2023-02-12 19:21:11 -05:00
nano /etc/mkinitcpio.conf # TODO SED
2023-02-12 12:49:54 -05:00
mkinitcpio -P
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch
2023-02-12 19:13:35 -05:00
CRYPT="cryptdevice=$(blkid | sed -n 's/.*nvme0n1p'$PART': \(.*\) TYPE.*/\1/p'):root"
2023-02-12 19:21:11 -05:00
sed -i 's#GRUB_CMDLINE_LINUX_DEFAULT.*#GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel 3 '$CRYPT' root=/dev/mapper/root"#' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
echo REBOOT