Arch Install Scripts Start

This commit is contained in:
Cure Gecko 2015-09-11 16:00:05 -05:00
commit a30f64310a
4 changed files with 201 additions and 0 deletions

41
ArchChroot.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
#
# Arch chroot install script
#
#Define drive params
DRIVE="$1"
#Print all commands
set -x
#Configure basic stuff
echo arch-server > /etc/hostname
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
#Configure network
pacman -S net-tools
MAC=`cat /sys/class/net/e*/address`
echo "SUBSYSTEM==\"net\", ACTION==\"add\", ATTR{address}==\"$MAC\", NAME=\"eth0\"" > /etc/udev/rules.d/10-network.rules
systemctl enable systemd-networkd
systemctl enable systemd-resolved
cat > /etc/systemd/network/dhcp.network <<EOL
[Match]
Name=eth0
[Network]
DHCP=ipv4
EOL
#Configure password
echo "Enter root password."
passwd
#Configure bootloader
pacman -S grub
grub-install --modules=part_gpt ${DRIVE}
grub-mkconfig -o /boot/grub/grub.cfg

46
ArchInstall.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
#
# Arch install script
#
#Define drive params
read -p "Enter driver location: " DRIVE
read -p "Enter swap amount: " DRIVESWAP
#Print all commands
set -x
#Partition drive
parted --script ${DRIVE} "mklabel gpt"
parted --script --align optimal ${DRIVE} "mkpart primary 0% 3MB mkpart primary ext4 3MB -$DRIVESWAP mkpart primary linux-swap -$DRIVESWAP 100%"
parted ${DRIVE} set 1 bios_grub on
#Format drive and mount
mkfs.ext4 ${DRIVE}2
mkswap ${DRIVE}3
mount ${DRIVE}2 /mnt
#Find best mirrors
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
#Install base
pacstrap /mnt base
cp /etc/pacman.d/mirrorlist.backup /mnt/etc/pacman.d/
#Build the fs table
genfstab -U /mnt >> /mnt/etc/fstab
#Load chroot configuration script
cp ArchChroot.sh /mnt/
chmod +x /mnt/ArchChroot.sh
if [ -f ArchPost.sh ]; then
cp ArchPost.sh /mnt/
chmod +x /mnt/ArchPost.sh
else
echo "ArchPost.sh does not exist."
fi
arch-chroot /mnt /ArchChroot.sh "$DRIVE"
rm /mnt/ArchChroot.sh
umount /mnt

88
ArchPost.sh Executable file
View File

@ -0,0 +1,88 @@
#!/bin/bash
#
# Arch post install script
#
#Print all commands
set -x
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
pacman -S xorg-server gnome gnome-extra plank gnome-do firefox wget cronie libva-vdpau-driver mesa-vdpau vdpauinfo cpio bc imagemagick fuse gtkmm linux-headers argyllcms ntp
#Nvidia
#pacman -S xorg-server gnome gnome-extra plank firefox wget cronie nvidia nvidia-libgl libva-vdpau-driver mesa-vdpau vdpauinfo cpio bc imagemagick fuse gtkmm linux-headers argyllcms ntp
systemctl enable cronie
systemctl enable gdm
systemctl start ntpd
systemctl enable ntpd
#Setup sudo
pacman -S sudo
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
#Add first user account
read -p "Enter username: " USERNAME
useradd -m -G wheel -s /bin/bash $USERNAME
echo "Enter password"
passwd $USERNAME
#Set startup applications.
mkdir -p /home/$USERNAME/.config/autostart
chown -R $USERNAME:$USERNAME /home/$USERNAME/.config/
cp /usr/share/applications/plank.desktop /home/$USERNAME/.config/autostart/plank.desktop
cat > /home/$USERNAME/.config/autostart/gnome-do.desktop <<EOL
[Desktop Entry]
Name=GNOME Do
Type=Application
Exec=gnome-do
Terminal=false
Icon=gnome-do
Comment=Do things as quickly as possible (but no quicker) with your files, bookmarks, applications, music, contacts, and more!
Categories=Utility;
Hidden=false
EOL
#Install ssh
pacman -S openssh
systemctl enable sshd
#Prepare for Development
pacman -S base-devel yasm intltool
mkdir -p /opt/src
chown -R $USERNAME:$USERNAME /opt
#AUR Package Manager
cd /home/$USERNAME
pacman -S diffutils gettext rsync yajl
sudo -u $USERNAME wget https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
sudo -u $USERNAME tar -xzf package-query.tar.gz
cd package-query
sudo -u $USERNAME makepkg -sri
cd ..
sudo -u $USERNAME wget https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
sudo -u $USERNAME tar -xzf yaourt.tar.gz
cd yaourt
sudo -u $USERNAME makepkg -sri
cd ..
#Media Player
pacman -S smplayer youtube-dl rtmpdump atomicparsley mkvtoolnix-cli mkvtoolnix-gtk mediainfo mediainfo-gui
sudo -u $USERNAME gpg --keyserver pool.sks-keyservers.net --recv-keys 0xD67658D8
sudo -u $USERNAME yaourt -S opencl-headers12-svn
sudo -u $USERNAME yaourt -S mpv-git
sudo -u $USERNAME yaourt -S ffmpeg-full
#VirtualBox
pacman -S virtualbox vde2 virtualbox-guest-iso virtualbox-host-dkms
modprobe vboxdrv
modprobe vboxnetflt
echo vboxdrv > /etc/modules-load.d/virtualbox.conf
echo vboxnetflt >> /etc/modules-load.d/virtualbox.conf
#Random tools
pacman -S nmap filezilla gparted go p7zip exfat-utils fuse-exfat nload iftop iotop lsof
sudo -u $USERNAME yaourt -S sublime-text-dev
gsettings set org.gnome.desktop.wm.preferences button-layout 'close:appmenu'

26
README.md Normal file
View File

@ -0,0 +1,26 @@
#Arch Install Scripts
These are scripts I wrote to install a general setup of Arch with some common utilities I use.
For customization, look into the ArchPost.sh script which is the script you run after first installation.
Basic idea is to download the three files and then run the main ArchInstall.sh script.
Example:
```bash
wget https://raw.githubusercontent.com/GRMrGecko/Arch/master/ArchInstall.sh
wget https://raw.githubusercontent.com/GRMrGecko/Arch/master/ArchChroot.sh
wget https://raw.githubusercontent.com/GRMrGecko/Arch/master/ArchPost.sh
chmod +x ArchInstall.sh
./ArchInstall.sh
```
ArchInstall.sh will ask you for the drive to install to and it will also ask how large to make the swap partition. Usually the idea is to make the swap the same size as the amount of ram, but you can probably go with 4GB fine.
To find which drive is the one you want to use, smartctl -i on each device to get information on the drive. Example:
```bash
smartctl -i /dev/sda
```
Beware that Arch is not designed for people who are new to Linux.
After ArchInstall.sh script is done, reboot to the installation, login as root and run /ArchPost.sh to install the GUI and such.