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
##############################################################
# 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
 set passwords for root and new user
echo -e "Set passwd for  \e[1;31mROOT\e[0m"
echo ROOT password:
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
echo -e "Set passwd for \e[1;32m$arch_user\e[0m"
arch_chroot "passwd $arch_user"

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
cp sqram-install2.sh /mnt/home/$arch_user/sqram-install2.sh
arch_chroot "chmod 777 /home/$arch_user/sqram-install2.sh"
arch-chroot /mnt /bin/bash -c "su $arch_user -c /home/$arch_user/sqram-install2.sh"

#arch_chroot "/home/$arch_user/sqram-install2.sh $arch_user $arch_hostname"



## 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)