Sat Aug 27 2016
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
##############################################################
# Arch Linux install script
# @author sqram http://sqr.am
# Assumes you use a whole disk for OS, no partitions,
# with the exception of boot. It's going to create
# a UEFI ESP partition
# If you want other partitions such as /home /var,
# create them manually. mount them manually, and don't use this.
# This is how i always set up my system, so it caters to me.
# change it according to your own needs if you want
##############################################################

echo -e "what is the \e[1;36mUSER\e[0m to create besides root? "
read arch_user

echo -e "what is your \e[1;36mHOST\e[0m name (user@hostname)? "
read arch_hostname

echo -e "what is the 3 letter \e[1;36mDEVICE\e[0m to install on? (usually sda)? "
read arch_device

# Where to install OS. /dev/sda1 is boot. So use 2
os_partition=2
boot_partition=1

# Partition
echo -e '\e[1;33mPartitioning...\e[0m'
echo '---------------------------------'
parted /dev/$arch_device mklabel gpt
parted /dev/$arch_device mkpart primary fat32 1MiB 512MiB
parted /dev/$arch_device mkpart primary ext2 512MiB 100%

# Format as ext4 and mount (parted above doesnt accept ext4)
echo -e '\e[1;33mFormatting to ext4...\e[0m'
echo '---------------------------------'
mkfs.ext4 /dev/$arch_device$os_partition
mount /dev/$arch_device$os_partition /mnt
mount /dev/$arch_device$boot_partition /mnt/boot



# Install the base system with some other packages
echo -e '\e[1;33mPacstrapping...\e[0m'
echo '---------------------------------'
pacstrap /mnt base grub-bios dialog wpa_supplicant wireless_tools netctl zsh

# Generate fstab so you can boot
echo -e '\e[1;33mGenerating fstab...\e[0m'
echo '---------------------------------'
genfstab -U /mnt >> /mnt/etc/fstab


# set passwords for root and new user
echo ROOT password:
passwd

echo Creating user $arch_user
useradd -m -G wheel -s /bin/zsh $arch_user

echo Set password for $arch_user:
passwd $arch_user

curl https://storage.googleapis.com/www.sqr.am/sqram2.sh -o /mnt/sqram-install2.sh
arch-chroot /mnt /usr/bin/zsh sqram-install2.sh

## NOTE
# unfortunatelly, because this script is broken into two parts
# the variables here are lost in the installation script pt2.
# try to find a way to use a single script only. the issue is that
# when you call arch-chroot, you're in a new shell and this
# script halts -- or -- pass these variables as arguments to
# sqram-install2.sh (currently doing this)