##############################################################
# Arch Linux install script
# @author sqram http://sqr.am
# Assumes you use a whole disk for OS, no partitions.
# If you want to use partitions such as /boot /home /var,
# create them manually. mount them manually, and don't use this.
# This will use /dev/sda and /dev/sda1. always.
# This is how i always set up my system, so it caters to me.
# change it according to your own needs if you want
##############################################################
arch_chroot() {
arch-chroot /mnt /bin/bash -c "${1}"
}
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
# making it sda1
boot_partition=1
os_partition=2
# Partition
echo -e '\e[1;33mPartitioning...\e[0m'
echo '---------------------------------'
parted /dev/$arch_device mklabel gpt
parted /dev/$arch_device mkpart P1 fat32 1MiB 512MiB
parted /dev/$arch_device mkpart P2 ext2 512MiB 100%
parted /dev/$arch_device set $boot_partition boot on
echo
# Format partitions created
echo -e '\e[1;33mFormatting...\e[0m'
echo '---------------------------------'
mkfs.ext4 /dev/$arch_device$os_partition
mkfs.fat -F32 /dev/$arch_device$boot_partition
mount /dev/$arch_device$os_partition /mnt
mkdir /mnt/boot
mount /dev/$arch_device$boot_partition /mnt/boot
echo
# Install the base system with some other packages
echo -e '\e[1;33mPacstrapping...\e[0m'
echo '---------------------------------'
pacstrap /mnt base base-devel grub-bios dialog wpa_supplicant wireless_tools netctl
echo
# Generate fstab so you can boot
echo -e '\e[1;33mGenerating fstab...\e[0m'
echo '---------------------------------'
genfstab -U /mnt >> /mnt/etc/fstab
echo
echo -e '\e[1;36m------------------------------\e[0m'
echo -e "\e[1;32m Running arch-chroot commands \e[0m"
echo -e '\e[1;36m------------------------------\e[0m'
echo "[] setting host name..."
arch_chroot 'echo $arch_hostname > /etc/hostname'
echo "[] softlinking timezone..."
arch_chroot 'ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime'
echo "[] system clock..."
arch_chroot 'hwclock --systohc --utc'
echo "[] ntp = true..."
arch_chroot 'timedatectl set-ntp true'
echo "[] utf8 to locale.gen..."
arch_chroot "sed -i '1ien_US.UTF-8 UTF-8' /etc/locale.gen"
echo "[] running locale-gen..."
arch_chroot locale-gen
echo "[] writing to locale.conf..."
arch_chroot 'echo LANG=en_US.UTF-8 > /etc/locale.conf'
echo "[] initcipio..."
arch_chroot 'mkinitcpio -p linux'
# set passwords for root and new user
echo -e "Set passwd for \e[1;31mROOT\e[0m"
arch_chroot passwd
echo
echo
echo -e "Creating user \e[1;32m$arch_user\e[0m"
arch_chroot "useradd -m -G wheel -s /bin/bash $arch_user"
echo -e "Set passwd for \e[1;32m$arch_user\e[0m"
arch_chroot "passwd $arch_user"
# clear sudoers files with these settings
echo "root ALL=(ALL) ALL" > /mnt/etc/sudoers
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /mnt/etc/sudoers
#curl https://storage.googleapis.com/www.sqr.am/sqram-install2.sh -o /mnt/home/$arch_user/sqram-install2.sh
#arch_chroot "chmod 777 /home/$arch_user/sqram-install2.sh"
#arch_chroot "su $arch_user -c /home/$arch_user/sqram-install2.sh"
arch_chroot "su $arch_user -c 'cd && sudo pacman --noconfirm -S vim\
weechat\
i3-wm\
chromium\
nitrogen\
git\
svn\
openssh\
lxappearance\
arandr\
thunar\
viewnior\
tumbler\
nodejs\
filezilla\
dmenu\
rfkill\
rxvt-unicode\
xorg-server\
xorg-server-utils\
xorg-xinit\
ttf-inconsolata ttf-freefont ttf-droid ttf-bitstream-vera\
&& mkdir aur && cd aur && git clone https://aur.archlinux.org/package-query.git\
&& cd package-query && makepkg -si --noconfirm && cd ..\
&& git clone https://aur.archlinux.org/yaourt.git\
&& cd yaourt && makepkg -si --noconfirm && cd ..\
&& yaourt --noconfirm -S sublime-text-dev\
i3-gaps-git\
dropbox\
dropbox-cli\
super-flat-remix-icon-theme\
arc-dark-suite-git\
openbox-arc-git\
gtk-theme-arc-git\
gtk-arc-flatabulous-theme-git\
arc-suite-git\
paper-icon-theme-git\
arc-icon-theme-git'"
# NUMIX FLAT STUDIO is great, but not in aur, get from gnomelook