diff --git a/archtitus.sh b/archtitus.sh index afed5fa..7f1e0dc 100755 --- a/archtitus.sh +++ b/archtitus.sh @@ -10,7 +10,7 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPTS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"/scripts CONFIGS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"/configs set +a -echo -ne " +echo " ------------------------------------------------------------------------- █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ @@ -21,8 +21,7 @@ echo -ne " ------------------------------------------------------------------------- Automated Arch Linux Installer ------------------------------------------------------------------------- - Scripts are in directory named ArchTitus -" + Scripts are in directory named ArchTitus" ( bash $SCRIPT_DIR/scripts/startup.sh )|& tee startup.log source $CONFIGS_DIR/setup.conf ( bash $SCRIPT_DIR/scripts/0-preinstall.sh )|& tee 0-preinstall.log @@ -33,7 +32,7 @@ echo -ne " ( arch-chroot /mnt $HOME/ArchTitus/scripts/3-post-setup.sh )|& tee 3-post-setup.log cp -v *.log /mnt/home/$USERNAME -echo -ne " +echo " ------------------------------------------------------------------------- █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ @@ -44,5 +43,4 @@ echo -ne " ------------------------------------------------------------------------- Automated Arch Linux Installer ------------------------------------------------------------------------- - Done - Please Eject Install Media and Reboot -" + Done - Please Eject Install Media and Reboot" diff --git a/scripts/0-preinstall.sh b/scripts/0-preinstall.sh index 8449b05..f6ece34 100755 --- a/scripts/0-preinstall.sh +++ b/scripts/0-preinstall.sh @@ -11,7 +11,7 @@ # # @file Preinstall # @brief Contains the steps necessary to configure and pacstrap the install to selected drive. -echo -ne " +echo " ------------------------------------------------------------------------- █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ @@ -23,8 +23,7 @@ echo -ne " Automated Arch Linux Installer ------------------------------------------------------------------------- -Setting up mirrors for optimal download -" +Setting up mirrors for optimal download" source $CONFIGS_DIR/setup.conf iso=$(curl -4 ifconfig.co/country-iso) timedatectl set-ntp true @@ -34,24 +33,21 @@ setfont ter-v22b sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf pacman -S --noconfirm --needed reflector rsync grub cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup -echo -ne " +echo " ------------------------------------------------------------------------- Setting up $iso mirrors for faster downloads -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist mkdir /mnt &>/dev/null # Hiding error message if any -echo -ne " +echo " ------------------------------------------------------------------------- Installing Prerequisites -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" pacman -S --noconfirm --needed gptfdisk btrfs-progs glibc -echo -ne " +echo " ------------------------------------------------------------------------- Formating Disk -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" umount -A --recursive /mnt # make sure everything is unmounted before we start # disk prep sgdisk -Z ${DISK} # zap all on disk @@ -67,11 +63,10 @@ fi partprobe ${DISK} # reread partition table to ensure it is correct # make filesystems -echo -ne " +echo " ------------------------------------------------------------------------- Creating Filesystems -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" subvols=(home var tmp .snapshots) # @description Creates the btrfs subvolumes. @@ -147,11 +142,10 @@ if ! grep -qs '/mnt' /proc/mounts; then echo "Rebooting in 1 Second ..." && sleep 1 reboot now fi -echo -ne " +echo " ------------------------------------------------------------------------- Arch Install on Main Drive -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" pacstrap /mnt base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf cp -R ${SCRIPT_DIR} /mnt/root/ArchTitus @@ -162,21 +156,19 @@ echo " Generated /etc/fstab: " cat /mnt/etc/fstab -echo -ne " +echo " ------------------------------------------------------------------------- GRUB BIOS Bootloader Install & Check -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" if [[ ! -d "/sys/firmware/efi" ]]; then grub-install --boot-directory=/mnt/boot ${DISK} else pacstrap /mnt efibootmgr --noconfirm --needed fi -echo -ne " +echo " ------------------------------------------------------------------------- Checking for low memory systems <8G -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') if [[ $TOTAL_MEM -lt 8000000 ]]; then # Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything. @@ -190,8 +182,7 @@ if [[ $TOTAL_MEM -lt 8000000 ]]; then # The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the system itself. echo "/opt/swap/swapfile none swap sw 0 0" >> /mnt/etc/fstab # Add swap to fstab, so it KEEPS working after installation. fi -echo -ne " +echo " ------------------------------------------------------------------------- SYSTEM READY FOR 1-setup.sh -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" diff --git a/scripts/1-setup.sh b/scripts/1-setup.sh index 62cd7ab..0663992 100755 --- a/scripts/1-setup.sh +++ b/scripts/1-setup.sh @@ -3,7 +3,7 @@ # # @file Setup # @brief Configures installed system, installs base packages, and creates user. -echo -ne " +echo " ------------------------------------------------------------------------- █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ @@ -14,44 +14,39 @@ echo -ne " ------------------------------------------------------------------------- Automated Arch Linux Installer SCRIPTHOME: ArchTitus -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" source $HOME/ArchTitus/configs/setup.conf -echo -ne " +echo " ------------------------------------------------------------------------- Network Setup -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" pacman -S --noconfirm --needed networkmanager dhclient systemctl enable --now NetworkManager -echo -ne " +echo " ------------------------------------------------------------------------- Setting up mirrors for optimal download -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" pacman -S --noconfirm --needed pacman-contrib curl pacman -S --noconfirm --needed reflector rsync grub arch-install-scripts git cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak nc=$(grep -c ^processor /proc/cpuinfo) -echo -ne " +echo " ------------------------------------------------------------------------- You have " $nc" cores. And changing the makeflags for "$nc" cores. Aswell as changing the compression settings. -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') if [[ $TOTAL_MEM -gt 8000000 ]]; then sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf fi -echo -ne " +echo " ------------------------------------------------------------------------- Setup Language to US and set locale -------------------------------------------------------------------------- -" -sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen +-------------------------------------------------------------------------" +sed -i 's/en_US.UTF-8 UTF-8/s/^#//' /etc/locale.gen locale-gen timedatectl --no-ask-password set-timezone ${TIMEZONE} timedatectl --no-ask-password set-ntp 1 @@ -61,21 +56,20 @@ ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime localectl --no-ask-password set-keymap ${KEYMAP} # Add sudo no password rights -sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers -sed -i 's/^# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers +sed -i 's/%wheel ALL=(ALL) NOPASSWD: ALL/s/^# //' /etc/sudoers +sed -i 's/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/s/^# //' /etc/sudoers #Add parallel downloading -sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf +sed -i 's/ParallelDownloads/s/^#//' /etc/pacman.conf #Enable multilib sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf pacman -Sy --noconfirm --needed -echo -ne " +echo " ------------------------------------------------------------------------- Installing Base System -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" # sed $INSTALL_TYPE is using install type to check for MINIMAL installation, if it's true, stop # stop the script and move on, not installing any more packages below that line if [[ ! $DESKTOP_ENV == server ]]; then @@ -89,11 +83,10 @@ if [[ ! $DESKTOP_ENV == server ]]; then sudo pacman -S --noconfirm --needed ${line} done fi -echo -ne " +echo " ------------------------------------------------------------------------- Installing Microcode -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" # determine processor type and install microcode proc_type=$(lscpu) if grep -E "GenuineIntel" <<< ${proc_type}; then @@ -106,11 +99,10 @@ elif grep -E "AuthenticAMD" <<< ${proc_type}; then proc_ucode=amd-ucode.img fi -echo -ne " +echo " ------------------------------------------------------------------------- Installing Graphics Drivers -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" # Graphics Drivers find and install gpu_type=$(lspci) if grep -E "NVIDIA|GeForce" <<< ${gpu_type}; then @@ -161,11 +153,10 @@ echo "password=${password,,}" >> ${HOME}/ArchTitus/configs/setup.conf echo "NAME_OF_MACHINE=${name_of_machine,,}" >> ${HOME}/ArchTitus/configs/setup.conf fi -echo -ne " +echo " ------------------------------------------------------------------------- Adding User -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" if [ $(whoami) = "root" ]; then groupadd libvirt useradd -m -G wheel,libvirt -s /bin/bash $USERNAME @@ -187,12 +178,11 @@ fi if [[ ${FS} == "luks" ]]; then # Making sure to edit mkinitcpio conf if luks is selected # add encrypt in mkinitcpio.conf before filesystems in hooks - sed -i 's/filesystems/encrypt filesystems/g' /etc/mkinitcpio.conf + sed -i 's/filesystems/encrypt &/g' /etc/mkinitcpio.conf # making mkinitcpio with linux kernel mkinitcpio -p linux fi -echo -ne " +echo " ------------------------------------------------------------------------- SYSTEM READY FOR 2-user.sh -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" diff --git a/scripts/2-user.sh b/scripts/2-user.sh index 8e60e6f..8392c40 100755 --- a/scripts/2-user.sh +++ b/scripts/2-user.sh @@ -3,7 +3,7 @@ # # @file User # @brief User customizations and AUR package installation. -echo -ne " +echo " ------------------------------------------------------------------------- █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ @@ -16,8 +16,7 @@ echo -ne " SCRIPTHOME: ArchTitus ------------------------------------------------------------------------- -Installing AUR Softwares -" +Installing AUR Softwares" source $HOME/ArchTitus/configs/setup.conf cd ~ @@ -74,9 +73,8 @@ if [[ $INSTALL_TYPE == "FULL" ]]; then fi fi -echo -ne " +echo " ------------------------------------------------------------------------- SYSTEM READY FOR 3-post-setup.sh -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" exit diff --git a/scripts/3-post-setup.sh b/scripts/3-post-setup.sh index 336e359..ea4287c 100755 --- a/scripts/3-post-setup.sh +++ b/scripts/3-post-setup.sh @@ -3,7 +3,7 @@ # # @file Post-Setup # @brief Finalizing installation configurations and cleaning up after script. -echo -ne " +echo " ------------------------------------------------------------------------- █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ @@ -17,22 +17,20 @@ echo -ne " ------------------------------------------------------------------------- Final Setup and Configurations -GRUB EFI Bootloader Install & Check -" +GRUB EFI Bootloader Install & Check" source ${HOME}/ArchTitus/configs/setup.conf if [[ -d "/sys/firmware/efi" ]]; then grub-install --efi-directory=/boot ${DISK} fi -echo -ne " +echo " ------------------------------------------------------------------------- Creating (and Theming) Grub Boot Menu -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" # set kernel parameter for decrypting the drive if [[ "${FS}" == "luks" ]]; then -sed -i "s%GRUB_CMDLINE_LINUX_DEFAULT=\"%GRUB_CMDLINE_LINUX_DEFAULT=\"cryptdevice=UUID=${ENCRYPTED_PARTITION_UUID}:ROOT root=/dev/mapper/ROOT %g" /etc/default/grub +sed -i "s%GRUB_CMDLINE_LINUX_DEFAULT=\"%&cryptdevice=UUID=${ENCRYPTED_PARTITION_UUID}:ROOT root=/dev/mapper/ROOT %g" /etc/default/grub fi # set kernel parameter for adding splash screen sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& splash /' /etc/default/grub @@ -54,11 +52,10 @@ echo -e "Updating grub..." grub-mkconfig -o /boot/grub/grub.cfg echo -e "All set!" -echo -ne " +echo " ------------------------------------------------------------------------- Enabling (and Theming) Login Display Manager -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" if [[ ${DESKTOP_ENV} == "kde" ]]; then systemctl enable sddm.service if [[ ${INSTALL_TYPE} == "FULL" ]]; then @@ -88,11 +85,10 @@ else fi fi -echo -ne " +echo " ------------------------------------------------------------------------- Enabling Essential Services -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" systemctl enable cups.service echo " Cups enabled" ntpd -qg @@ -110,11 +106,10 @@ systemctl enable avahi-daemon.service echo " Avahi enabled" if [[ "${FS}" == "luks" || "${FS}" == "btrfs" ]]; then -echo -ne " +echo " ------------------------------------------------------------------------- Creating Snapper Config -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" SNAPPER_CONF="$HOME/ArchTitus/configs/etc/snapper/configs/root" mkdir -p /etc/snapper/configs/ @@ -126,11 +121,10 @@ cp -rfv ${SNAPPER_CONF_D} /etc/conf.d/ fi -echo -ne " +echo " ------------------------------------------------------------------------- Enabling (and Theming) Plymouth Boot Splash -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" PLYMOUTH_THEMES_DIR="$HOME/ArchTitus/configs/usr/share/plymouth/themes" PLYMOUTH_THEME="arch-glow" # can grab from config later if we allow selection mkdir -p /usr/share/plymouth/themes @@ -145,17 +139,16 @@ fi plymouth-set-default-theme -R arch-glow # sets the theme and runs mkinitcpio echo 'Plymouth theme installed' -echo -ne " +echo " ------------------------------------------------------------------------- Cleaning -------------------------------------------------------------------------- -" +-------------------------------------------------------------------------" # Remove no password sudo rights -sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# &/' /etc/sudoers -sed -i 's/^%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# &/' /etc/sudoers +sed -i 's/%wheel ALL=(ALL) NOPASSWD: ALL/# &/' /etc/sudoers +sed -i 's/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# &/' /etc/sudoers # Add sudo rights -sed -i '/^# %wheel ALL=(ALL) ALL/s/^# //' /etc/sudoers -sed -i '/^# %wheel ALL=(ALL:ALL) ALL/s/^# //' /etc/sudoers +sed -i '/%wheel ALL=(ALL) ALL/s/^# //' /etc/sudoers +sed -i '/%wheel ALL=(ALL:ALL) ALL/s/^# //' /etc/sudoers rm -r $HOME/ArchTitus rm -r /home/$USERNAME/ArchTitus