Skip to content

Instantly share code, notes, and snippets.

@george-aidonidis
Last active January 18, 2020 13:49
Show Gist options
  • Save george-aidonidis/37914c1aab96d52b2208f97a7b08ffea to your computer and use it in GitHub Desktop.
Save george-aidonidis/37914c1aab96d52b2208f97a7b08ffea to your computer and use it in GitHub Desktop.
########################################################################################
# Simple script that gathers all needed commands to install arch linux on UEFI system. #
########################################################################################
# Before running this script you need to partition the hard drive
# After you specify the hard drive's name you can type: cfdisk /dev/sdX (where X should be replaced)\
# The following commands are expecting:
# - the first partition to be the UEFI
# - the second to be root
# and that's it. Later a swapfile we'll be created
echo "#############################################################"
mkfs.fat -F32 /dev/sdX1
mkfs.ext4 /dev/sdX2
mkfs.ext4 /dev/sdX3
echo "#############################################################"
echo "Mounting the partitions"
mount /dev/sdX2 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
mkdir /mnt/boot
mount /dev/sdX1 /mnt/boot
echo "#############################################################"
echo "Pacstraping!"
pacstrap -i /mnt base base-devel
cp second /mnt/second
echo "#############################################################"
echo "Fstabing!"
genfstab -U -p /mnt >> /mnt/etc/fstab
echo "#############################################################"
echo "Cool. Type 'arch-chroot /mnt /bin/bash' to procceed"
# second script
arch-chroot /mnt /bin/bash
echo "#############################################################"
echo "Setting UTF-8 en for locale"
# Set english as layout
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo "#############################################################"
echo "Setting Greek timezone"
# Set greek timezone
ln -sf /usr/share/zoneinfo/Europe/Athens /etc/localtime
# Set local time
hwclock --systohc --utc
echo "#############################################################"
echo "Setting hostname"
# Set hostname
echo superlaptop > /etc/hostname
echo "127.0.1.1 localhost.localdomain superlaptop" >> /etc/hosts
# Enable network
pacman -S networkmanager
systemctl enable NetworkManager
echo "#############################################################"
echo "passwd"
passwd
echo "#############################################################"
echo "Installing grub efibootmgr"
pacman -S grub efibootmgr
lsblk # to check if everything is mounted correctly
echo "#############################################################"
echo "Install grub"
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
echo "#############################################################"
echo "mkconfig grub"
grub-mkconfig -o /boot/grub/grub.cfg
# Fix for virtual box. Uncomment if you are working on Virtual Box
# mkdir /boot/EFI/boot
# cp /boot/EFI/arch/grubx64.efi /boot/EFI/boot/bootx64.efi
echo "Please type exit, umount the /mnt (umount -R /mnt) and reboot"
#exit
#umount -R /mnt
#reboot
################
# After reboot #
#################
# echo "#############################################################"
# echo "Add george to users group"
# useradd -m -g users -G wheel -s /bin/bash george
# echo "#############################################################"
# echo "Set password for user"
# passwd george
# EDITOR=vi visudo
# ^ for the above look for the '# %wheel ALL=(ALL) ALL' line and uncomment it ;)
# exit
###########################################
# Installing personal dotfiles and system #
###########################################
# sudo pacman -S git wget
# git clone https://github.com/george-aidonidis/dotfiles
# echo 'SystemMaxUse=300M' | sudo tee --append /etc/systemd/journald.conf
# sudo pacman -Syy
# cd dotfiles && bash install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment