~alexdavid/dotfiles

410cba4306c922adda49f605e36a390e27aa75c1 — Alex David 2 years ago 2b9381f
Add archlinux setup & chroot script
2 files changed, 72 insertions(+), 0 deletions(-)

A archlinux/chroot
A archlinux/setup.md
A archlinux/chroot => archlinux/chroot +46 -0
@@ 0,0 1,46 @@
#!/usr/bin/env bash

function section {
  echo
  echo
  echo
  echo "################################################################"
  echo "==> $1"
  echo
}

function ask {
  printf "%s: " "$2"
  read $1
}


section "SETTING LOCALE"
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
export LANG=en_US.UTF-8
ln -f -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
ask HOSTNAME "Hostname"
echo "$HOSTNAME" > /etc/hostname


section "SETTING ROOT PASSWORD"
passwd


section "CREATING MAIN USER"
ask USERNAME "Username"
useradd -m -g users -G wheel "$USERNAME"
passwd "$USERNAME"


section "INSTALLING GRUB"
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg


section "SETTING UP SIMPLE FIREWALL"
cp /etc/iptables/simple_firewall.rules /etc/iptables/iptables.rules
systemctl enable iptables.service

A archlinux/setup.md => archlinux/setup.md +26 -0
@@ 0,0 1,26 @@
# My archlinux setup scripts

```shell
wget https://raw.githubusercontent.com/alexdavid/dotfiles/master/archlinux/setup
bash setup
arch-chroot /mnt
```
Add `encrypt` to `/etc/mkinitcpio.conf` hooks:
```
HOOKS="base udev autodetect block encrypt filesystems keyboard fsck"
```

```shell
mkinitcpio -p linux
wget https://raw.githubusercontent.com/alexdavid/dotfiles/master/archlinux/chroot
bash chroot

# optional if wifi-menu is needed after reboot:
pacman -S sudo dialog wpa_supplicant

exit
umount /mnt/boot
umount /mnt
cryptsetup close main
reboot
```