Created
October 11, 2016 04:44
-
-
Save jiulongw/d04399cbd3c06f35e66fd5afec40857f to your computer and use it in GitHub Desktop.
Arch install scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# errexit on | |
set -e | |
echo Distroying /dev/sda and creating partition. Press Ctrl+C to exit | |
read -n1 -r -p "Press any key to continue" | |
sgdisk -Z --new=0:0:0 --typecode=0:8300 --new=0:0:0 --typecode=0:EF02 /dev/sda | |
mkfs.ext4 /dev/sda1 | |
mkfs.ext4 /dev/sda2 | |
echo Mounting /dev/sda1 | |
mount /dev/sda1 /mnt | |
echo Bootstrapping... | |
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak | |
curl -L "https://www.archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&use_mirror_status=on" | sed 's/^#Server/Server/' | head -20 > /etc/pacman.d/mirrorlist.raw | |
rankmirrors /etc/pacman.d/mirrorlist.raw > /etc/pacman.d/mirrorlist | |
pacstrap /mnt base base-devel | |
genfstab -p /mnt >> /mnt/etc/fstab | |
echo Executing post-init script | |
curl https://raw.githubusercontent.com/jiulongw/arch-init/master/arch-post.sh > /mnt/root/arch-post.sh | |
arch-chroot /mnt "/bin/bash" "/root/arch-post.sh" | |
umount /mnt | |
echo All Done. Type "reboot" to enjoy! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read -r -p "Enter computer name:" hostname | |
echo $hostname > /etc/hostname | |
echo "Setting root password" | |
passwd | |
read -r -p "Enter a new user name:" username | |
useradd -m -G wheel -s /bin/bash $username | |
passwd $username | |
echo setting up system... | |
# time zone | |
ln -fs /usr/share/zoneinfo/US/Pacific /etc/localtime | |
# locale | |
sed --in-place=.bak 's/^#en_US\.UTF-8/en_US\.UTF-8/' /etc/locale.gen | |
locale-gen | |
echo LANG=en_US.UTF-8 > /etc/locale.conf | |
# bootloader | |
pacman -S --noconfirm grub | |
grub-install --recheck /dev/sda | |
grub-mkconfig -o /boot/grub/grub.cfg | |
# sudo | |
echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers | |
pacman -S --noconfirm xorg | |
pacman -S --noconfirm xfce4 | |
sed -e '/^twm/d' -e '/^xclock/d' -e '/^xterm/d' -e '/^exec xterm/d' /etc/X11/xinit/xinitrc > /home/$username/.xinitrc | |
# for vbox only | |
pacman -S --noconfirm virtualbox-guest-utils | |
systemctl enable vboxservice | |
echo '/usr/bin/VBoxClient-all' >> /home/$username/.xinitrc | |
# enable startx | |
echo 'exec startxfce4' >> /home/$username/.xinitrc | |
# additional packages | |
pacman -S --noconfirm gvim | |
pacman -S --noconfirm git | |
pacman -S --noconfirm npm | |
pacman -S --noconfirm calc | |
# google chrome | |
runuser -l $username -c "curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/google-chrome.tar.gz && tar -xvf google-chrome.tar.gz && cd google-chrome && makepkg -sri --noconfirm" | |
# display manager auto startx | |
pacman -S --noconfirm nodm | |
sed --in-place=.bak "s/{user}/$username/" /etc/nodm.conf | |
chmod +x /home/$username/.xinitrc | |
systemctl enable nodm | |
# networking | |
systemctl enable systemd-networkd | |
systemctl enable systemd-resolved | |
sed --in-place=.bak 's/ dns / resolve /' /etc/nsswitch.conf | |
printf '%s\n%s\n%s\n%s\n' '[Match]' 'Name=en*' '[Network]' 'DHCP=ipv4' > /etc/systemd/network/dhcp.network |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment