From 2a6a17d3adc8db143ec164f83b928bc62a1647f8 Mon Sep 17 00:00:00 2001 From: SteveTinkers <79803804+SteveTinkers@users.noreply.github.com> Date: Wed, 17 Nov 2021 17:17:22 -0800 Subject: [PATCH] Version 1.5 Many Many Changes and new features... --- 0-preinstall.sh | 266 +++++++++++++--------- 1-setup.sh | 532 ++++++++++++++++++++++++++----------------- 2-user.sh | 92 ++++++-- 3-post-setup.sh | 77 +++---- archtitus.sh | 16 +- install.example.conf | 1 + x-bootloader.sh | 59 +++++ x-mount.sh | 14 ++ 8 files changed, 674 insertions(+), 383 deletions(-) create mode 100755 x-bootloader.sh create mode 100755 x-mount.sh diff --git a/0-preinstall.sh b/0-preinstall.sh index d789a3a..83ab936 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -7,17 +7,111 @@ # ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ # ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ #------------------------------------------------------------------------- + +function formatdisk { + # disk prep + sgdisk -Z ${1} # zap all on disk + sgdisk -a 2048 -o ${1} # new gpt disk 2048 alignment + + # create partitions + sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${1} # partition 1 (BIOS Boot Partition) + sgdisk -n 2::+100M --typecode=2:ef00 --change-name=2:'BOOT' ${1} # partition 2 (UEFI Boot Partition) + sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${1} # partition 3 (Root), default start, remaining + if [[ ! -d "/sys/firmware/efi" ]]; then + sgdisk -A 1:set:2 ${1} + fi + + # make filesystems + if [[ ${1} =~ "nvme" ]]; then + mkfs.vfat -F32 -n "BOOT" "${1}p2" + mkfs.btrfs -L "ROOT" "${1}p3" -f + mount -t btrfs "${1}p3" /mnt + else + mkfs.vfat -F32 -n "BOOT" "${1}2" + mkfs.btrfs -L "ROOT" "${1}3" -f + mount -t btrfs "${1}3" /mnt + fi + ls /mnt #| xargs btrfs subvolume delete #ERROR: btrfs subvolumne delete: not enough arguments: 0 but at least 1 expected + btrfs subvolume create /mnt/@ + umount /mnt + + ~/ArchTitus/x-mount.sh +} + + +function install { + ISO=$(curl -4 ifconfig.co/country-iso) + echo "-------------------------------------------------------------------------" + echo "-- Setting up $ISO mirrors for faster downloads --" + echo "-------------------------------------------------------------------------" + pacman -S --noconfirm reflector rsync + cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup + echo "reflector is running, please wait..." + reflector -a 48 -c $ISO -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist + + # Add parallel downloading + sed -i 's/^#Para/Para/' /etc/pacman.conf + + # Enable multilib + sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf + pacman -Sy --noconfirm + + + echo "-------------------------------------------------------------------------" + echo "-- Base Install on Main Drive --" + echo "-------------------------------------------------------------------------" + pacstrap /mnt linux base sudo networkmanager iwd --noconfirm --needed + genfstab -U /mnt >> /mnt/etc/fstab + #echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf + cp -R ${SCRIPT_DIR} /mnt/root/ArchTitus + cp /mnt/etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist.backup + cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist + + #GRUB has been flaky...moving to chroot...BE SURE TO INSTALL GRUB IF YOU MOVE BACK + #echo "-------------------------------------------------------------------------" + #echo "-- GRUB Bootloader Install --" + #echo "-------------------------------------------------------------------------" + #if [[ ! -d "/sys/firmware/efi" ]]; then + # echo "Detected BIOS" + # grub-install --boot-directory=/mnt/boot ${1} + #fi + #if [[ -d "/sys/firmware/efi" ]]; then + # echo "Detected EFI" + # grub-install --efi-directory=/mnt/boot --root-directory=/mnt + #fi + + echo "-------------------------------------------------------------------------" + echo "-- Check for low memory systems <8G --" + echo "-------------------------------------------------------------------------" + TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') + if [[ $TOTALMEM -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. + mkdir /mnt/opt/swap #make a dir that we can apply NOCOW to to make it btrfs-friendly. + chattr +C /mnt/opt/swap #apply NOCOW, btrfs needs that. + dd if=/dev/zero of=/mnt/opt/swap/swapfile bs=1M count=2048 status=progress + chmod 600 /mnt/opt/swap/swapfile #set permissions. + chown root /mnt/opt/swap/swapfile + mkswap /mnt/opt/swap/swapfile + swapon /mnt/opt/swap/swapfile + #The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the sysytem itself. + echo "/opt/swap/swapfile none swap sw 0 0" >> /mnt/etc/fstab #Add swap to fstab, so it KEEPS working after installation. + fi +} + + +# Misc Setup SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -echo "-------------------------------------------------" -echo "Setting up mirrors for optimal download " -echo "-------------------------------------------------" -iso=$(curl -4 ifconfig.co/country-iso) timedatectl set-ntp true -pacman -S --noconfirm pacman-contrib terminus-font +pacman -S --noconfirm terminus-font setfont ter-v22b -sed -i 's/^#Para/Para/' /etc/pacman.conf -pacman -S --noconfirm reflector rsync grub -cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup + +# Read config file, if it exists +configFileName=${HOME}/ArchTitus/install.conf +if [ -e "$configFileName" ]; then + echo "Using configuration file $configFileName." + . $configFileName +fi + echo -e "-------------------------------------------------------------------------" echo -e " █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗" echo -e " ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝" @@ -25,111 +119,61 @@ echo -e " ███████║██████╔╝██║ ██ echo -e " ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║" echo -e " ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║" echo -e " ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝" -echo -e "-------------------------------------------------------------------------" -echo -e "-Setting up $iso mirrors for faster downloads" -echo -e "-------------------------------------------------------------------------" -reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist -mkdir /mnt - - -echo -e "\nInstalling prereqs...\n$HR" -pacman -S --noconfirm gptfdisk btrfs-progs - -echo "-------------------------------------------------" -echo "-------select your disk to format----------------" -echo "-------------------------------------------------" -lsblk -echo "Please enter disk to work on: (example /dev/sda)" -read DISK -echo "THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK" +# Get Disk +if [ -e "$configFileName" ] && [ ! -z "$disk" ]; then + echo -e "-------------------------------------------------------------------------" + echo -e "-- User - $username" + echo -e "-- Password - $password" + echo -e "-- Host - $hostname" + echo -e "-- Disk - $disk" + echo -e "-------------------------------------------------------------------------" + echo -e " *Blank values will be asked for during setup process..." + echo -e "-------------------------------------------------------------------------" + if [ "$password" == "*!*CHANGEME*!*...and-dont-store-in-plantext..." ]; then + while true; do + read -s -p "Password for $username: " password + echo + read -s -p "Password for $username (again): " password2 + echo + if [ "$password" = "$password2" ] && [ "$password" != "" ]; then + break + fi + echo "Please try again" + done + sed -i.bak "s/^\(password=\).*/\1$password/" $configFileName + fi + lsblk +else + echo -e "-------------------------------------------------------------------------" + echo -e " Configuration File $configFileName not found..." + echo -e " Will ask for disk, user, password and hostname during setup process... " + echo -e "-------------------------------------------------------------------------" + echo -e "------------------------select your disk to format-----------------------" + echo -e "-------------------------------------------------------------------------" + lsblk + echo "Please enter disk to format: (example /dev/sda)" + read disk + disk="${disk,,}" + if [[ "${disk}" != *"/dev/"* ]]; then + disk="/dev/${disk}" + fi + echo "disk=$disk" >> $configFileName +fi +echo "THIS WILL FORMAT AND DELETE ALL DATA ON ${disk}" read -p "are you sure you want to continue (Y/N):" formatdisk case $formatdisk in - -y|Y|yes|Yes|YES) -echo "--------------------------------------" -echo -e "\nFormatting disk...\n$HR" -echo "--------------------------------------" - -# disk prep -sgdisk -Z ${DISK} # zap all on disk -sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment - -# create partitions -sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition) -sgdisk -n 2::+100M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition) -sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining -if [[ ! -d "/sys/firmware/efi" ]]; then - sgdisk -A 1:set:2 ${DISK} -fi - -# make filesystems -echo -e "\nCreating Filesystems...\n$HR" -if [[ ${DISK} =~ "nvme" ]]; then -mkfs.vfat -F32 -n "EFIBOOT" "${DISK}p2" -mkfs.btrfs -L "ROOT" "${DISK}p3" -f -mount -t btrfs "${DISK}p3" /mnt -else -mkfs.vfat -F32 -n "EFIBOOT" "${DISK}2" -mkfs.btrfs -L "ROOT" "${DISK}3" -f -mount -t btrfs "${DISK}3" /mnt -fi -ls /mnt | xargs btrfs subvolume delete -btrfs subvolume create /mnt/@ -umount /mnt -;; -*) -echo "Rebooting in 3 Seconds ..." && sleep 1 -echo "Rebooting in 2 Seconds ..." && sleep 1 -echo "Rebooting in 1 Second ..." && sleep 1 -reboot now -;; + y|Y|yes|Yes|YES) + echo "-------------------------------------------------------------------------" + echo -e "\nFormatting ${disk}..." + echo "-------------------------------------------------------------------------" + formatdisk "${disk}" + ;; + *) + echo "Figure out your drive situation, and try again." + exit 1 + ;; esac -# mount target -mount -t btrfs -o subvol=@ -L ROOT /mnt -mkdir /mnt/boot -mkdir /mnt/boot/efi -mount -t vfat -L EFIBOOT /mnt/boot/ - -if ! grep -qs '/mnt' /proc/mounts; then - echo "Drive is not mounted can not continue" - echo "Rebooting in 3 Seconds ..." && sleep 1 - echo "Rebooting in 2 Seconds ..." && sleep 1 - echo "Rebooting in 1 Second ..." && sleep 1 - reboot now -fi - -echo "--------------------------------------" -echo "-- Arch Install on Main Drive --" -echo "--------------------------------------" -pacstrap /mnt base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed -genfstab -U /mnt >> /mnt/etc/fstab -echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf -cp -R ${SCRIPT_DIR} /mnt/root/ArchTitus -cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist -echo "--------------------------------------" -echo "--GRUB BIOS Bootloader Install&Check--" -echo "--------------------------------------" -if [[ ! -d "/sys/firmware/efi" ]]; then - grub-install --boot-directory=/mnt/boot ${DISK} -fi -echo "--------------------------------------" -echo "-- Check for low memory systems <8G --" -echo "--------------------------------------" -TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') -if [[ $TOTALMEM -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. - mkdir /mnt/opt/swap #make a dir that we can apply NOCOW to to make it btrfs-friendly. - chattr +C /mnt/opt/swap #apply NOCOW, btrfs needs that. - dd if=/dev/zero of=/mnt/opt/swap/swapfile bs=1M count=2048 status=progress - chmod 600 /mnt/opt/swap/swapfile #set permissions. - chown root /mnt/opt/swap/swapfile - mkswap /mnt/opt/swap/swapfile - swapon /mnt/opt/swap/swapfile - #The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the sysytem 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 "--------------------------------------" -echo "-- SYSTEM READY FOR 1-setup --" -echo "--------------------------------------" +install "${disk}" +echo "ready for 'arch-chroot /mnt /root/ArchTitus/1-setup.sh'" diff --git a/1-setup.sh b/1-setup.sh index 73904f1..745127a 100755 --- a/1-setup.sh +++ b/1-setup.sh @@ -7,247 +7,369 @@ # ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ # ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ #------------------------------------------------------------------------- -echo "--------------------------------------" -echo "-- Network Setup --" -echo "--------------------------------------" -pacman -S networkmanager dhclient --noconfirm --needed -systemctl enable --now NetworkManager -echo "-------------------------------------------------" -echo "Setting up mirrors for optimal download " -echo "-------------------------------------------------" -pacman -S --noconfirm pacman-contrib curl -pacman -S --noconfirm reflector rsync -cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak -nc=$(grep -c ^processor /proc/cpuinfo) -echo "You have " $nc" cores." -echo "-------------------------------------------------" -echo "Changing the makeflags for "$nc" cores." -TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') -if [[ $TOTALMEM -gt 8000000 ]]; then -sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf -echo "Changing the compression settings for "$nc" cores." -sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf -fi -echo "-------------------------------------------------" -echo " Setup Language to US and set locale " -echo "-------------------------------------------------" -sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen -locale-gen -timedatectl --no-ask-password set-timezone America/Chicago -timedatectl --no-ask-password set-ntp 1 -localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8" +ISO=$(curl -4 ifconfig.co/country-iso) +echo "-------------------------------------------------------------------------" +echo "-- Changes for optimal downloading --" +echo "-------------------------------------------------------------------------" +#commented because we just did this.. +#pacman -S --noconfirm reflector rsync +#cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup +#reflector -a 48 -c $ISO -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist -# Set keymaps -localectl --no-ask-password set-keymap us - -# Add sudo no password rights -sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers - -#Add parallel downloading +# Add parallel downloading sed -i 's/^#Para/Para/' /etc/pacman.conf -#Enable multilib +# Enable multilib sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf pacman -Sy --noconfirm -echo -e "\nInstalling Base System\n" -PKGS=( -'mesa' # Essential Xorg First -'xorg' -'xorg-server' -'xorg-apps' -'xorg-drivers' -'xorg-xkill' -'xorg-xinit' -'xterm' -'plasma-desktop' # KDE Load second -'alsa-plugins' # audio plugins -'alsa-utils' # audio utils -'ark' # compression -'audiocd-kio' -'autoconf' # build -'automake' # build -'base' -'bash-completion' -'bind' -'binutils' -'bison' -'bluedevil' -'bluez' -'bluez-libs' -'bluez-utils' -'breeze' -'breeze-gtk' -'bridge-utils' -'btrfs-progs' -'celluloid' # video players -'cmatrix' -'code' # Visual Studio code -'cronie' -'cups' -'dialog' -'discover' -'dolphin' -'dosfstools' -'dtc' -'efibootmgr' # EFI boot -'egl-wayland' -'exfat-utils' -'extra-cmake-modules' -'filelight' -'flex' -'fuse2' -'fuse3' -'fuseiso' -'gamemode' -'gcc' -'gimp' # Photo editing -'git' -'gparted' # partition management -'gptfdisk' -'grub' -'grub-customizer' -'gst-libav' -'gst-plugins-good' -'gst-plugins-ugly' -'gwenview' -'haveged' -'htop' -'iptables-nft' -'jdk-openjdk' # Java 17 -'kate' -'kcodecs' -'kcoreaddons' -'kdeplasma-addons' -'kde-gtk-config' -'kinfocenter' -'kscreen' -'kvantum-qt5' -'kitty' -'konsole' -'kscreen' -'layer-shell-qt' -'libdvdcss' -'libnewt' -'libtool' -'linux' -'linux-firmware' -'linux-headers' -'lsof' -'lutris' -'lzop' -'m4' -'make' -'milou' -'nano' -'neofetch' -'networkmanager' -'ntfs-3g' -'ntp' -'okular' -'openbsd-netcat' -'openssh' -'os-prober' -'oxygen' -'p7zip' -'pacman-contrib' -'patch' -'picom' -'pkgconf' -'plasma-meta' -'plasma-nm' -'powerdevil' +nc=$(grep -c ^processor /proc/cpuinfo) +echo "-------------------------------------------------------------------------" +echo "-- Changing the makeflags for "$nc" core(s). --" +echo "-------------------------------------------------------------------------" +TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') +if [[ $TOTALMEM -gt 8000000 ]]; then + sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf + echo "Changing the compression settings for "$nc" cores." + sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf +fi + + +echo "-------------------------------------------------------------------------" +echo "-- Setup Language to US and set locale --" +echo "-------------------------------------------------------------------------" +timezone=$(curl -4 http://ip-api.com/line?fields=timezone) +locale=en_US.UTF-8 + +# Set locale +sed -i s/^#$locale/$locale/ /etc/locale.gen +locale-gen +echo LANG=$locale > /etc/locale.conf +localectl --no-ask-password set-locale LANG=$locale LC_TIME=$locale + +# Set time +timedatectl --no-ask-password set-ntp 1 +timedatectl --no-ask-password set-timezone $timezone +#ln -sf /usr/share/zoneinfo/$timezone /etc/localtime + +# Set keymaps +localectl --no-ask-password set-keymap us +#echo "KEYMAP=US" > /etc/vconsole.conf + +# Set timezone when NetworkManager connects to a network +file=/etc/NetworkManager/dispatcher.d/09-timezone.sh +cat < $file +#!/bin/sh +case "\$2" in + up) + timezone=\$(curl --fail http://ip-api.com/line?fields=timezone) + timedatectl --no-ask-password set-timezone \$timezone + #ln -sf /usr/share/zoneinfo/\$timezone /etc/localtime + ;; +esac +EOF +chmod +x $file + + +echo "-------------------------------------------------------------------------" +echo "-- X Display Manager Setup --" +echo "-------------------------------------------------------------------------" +pacman -S xorg --noconfirm --needed + + +echo "-------------------------------------------------------------------------" +echo "-- KDE Plasma Setup --" +echo "-------------------------------------------------------------------------" +pacman -S plasma dolphin --noconfirm --needed +pacman -S packagekit-qt5 --noconfirm --needed #needed for discover, which is in the plasma group +pacman -S kdialog --noconfirm --needed #needed for some apps to display native kde dialogs + + +echo "-------------------------------------------------------------------------" +echo "-- Installing Requested Packages --" +echo "-------------------------------------------------------------------------" +PKGS_ARCH_DEFAULT=( + +#...THEME... +'terminus-font' 'powerline-fonts' -'print-manager' -'pulseaudio' + +#...TOOLS... +'usbutils' # query connected USB devices +'ntp' # network time protocol reference implementation + +#...NETWORK TOOLS... +'bridge-utils' # configuring etnernet bridge +'iptables-nft' # replaces iptables +'traceroute' # track route taken by packets over an IP network +'openbsd-netcat' # tcp/ip network tools +'bind' #DNS tools + +#...MAIN TOOLS... +'cmatrix' # matix screen +'cronie' # schedule tasks/jobs +'htop' # see running processes +'lsof' # list open files for running Unix processes +'nano' # a famous text editor +'neofetch' # displays information about your computer +'openssh' # remote login with the SSH protocol +'os-prober' # detect other OSes on a set of drives (for grub) +'vim' # a famous text editor +'wget' # get files from web +'git' # get files from web, development sync +'bash-completion' # programmable completion for the bash shell +'zsh' # command line intrepreter + 'zsh-syntax-highlighting' + 'zsh-autosuggestions' + 'zsh-completions' +'pacman-contrib' # scripts and tools for pacman systems +'rsync' # sync files +'reflector' # sort and filter pacman mirror list +'snapper' # managing BTRFS and LVM snapshots tool...also installed by snap-pac and snapper-gui-git!! + # btrfs can't create snapshots of a volume that also contains a swapfile. I fixed this by moving my swapfile to its own subvolume. +'gufw' # manage netfilter firewall...added by me replacing ufw + +#...KDE... +'konsole' # KDE terminal +'kate' # KDE text editor +'ark' # KDE file archive tool + 'p7zip' # 7Z format support + 'unrar' # RAR decompression support + 'unarchiver' # RAR format support + 'lzop' # LZO format support + 'lrzip' # LRZ format support +'gwenview' # KDE image viewer + 'qt5-imageformats' # tiff, webp and more formats + 'kimageformats' # dds, xcf, exr, psd, and more formats + 'kipi-plugins' # export to various online services + 'kamera' # imports from gphoto2 cameras +'filelight' # KDE tool to view disk useage +'spectacle' # KDE screenshot capture utility + 'kipi-plugins' # export to various online services + +#...MISC/OTHER... +'picom' # X compositor that may fix tearing issues +'gparted' # graphical partition management +'grub-customizer' # gui to customize grub +'kitty' # terminal +'celluloid' # video players +'code' # Visual Studio code +'gimp' # Photo editing +'jdk-openjdk' # Java 17 +'lutris' # gaming platform +'okular' +'qemu' +'steam' +'gamemode' # gaming optimizations +'synergy' +'virt-manager' +'virt-viewer' +'wine-gecko' #why not just wine? +'wine-mono' #why not just wine? +'winetricks' #why not just wine? + +#...AUDIO/SOUND SUPPORT... +'alsa-plugins' #installed by steam +'alsa-utils' +'pulseaudio' #installed as part of plasma-pa 'pulseaudio-alsa' 'pulseaudio-bluetooth' + +#...POWER/BATTERY/SUSPEND SUPPORT... +'powerdevil' # KDE tool to manage power consumption...installed as part of plasma-desktop + +#...BLUETOOTH SUPPORT... +'bluedevil' +'bluez' # bluetooth support...installed as part of bluedevil and powerdevil +'bluez-libs' #installed as part of networkmanager +'bluez-utils' + +#...PRINTER SUPPORT... +'cups' # printer support +'print-manager' # KDE tool to manage printers + +#...FILESYSTEM SUPPORT... +'ntfs-3g' # NTFS support +'dosfstools' #installed by k things +'exfat-utils' # exfat support +'btrfs-progs' #installed installed by snap-pac and snapper-gui-git MIGHT MIGHT Be installed by K! +'fuseiso' # mount ISO images + +#...SAMBA-WINDOWS NETWORK SHARE SUPPORT... +'samba' +'smbnetfs' + +#...UNNEEDED... +'unzip' # file compression installed by other things when needed as a depenency +'zip' # file compression +'audiocd-kio' # Audio CDs +'swtpm' # small tpm emulator +'dialog' # Shows a dialog by command line +'dtc' # Device Tree Compilier (required for qemu and spike a ISA emulator) +'egl-wayland' # graphics/nvidia +'extra-cmake-modules' #I saw these get installed by some aur program, but no dep listed... +'fuse2' #installed as part of fuseiso +'fuse3' #installed as part of plasma-worksapce +'gptfdisk' #DOES CFDISK work without it? YES Installed as part of a bunch of K things +'kcoreaddons' #installed as part of a bunch of k things +'zeroconf-ioslave' # network Monitor for DNS-SD services for KDE +'kvantum-qt5' +'linux-firmware' +'linux-headers' 'python-notify2' 'python-psutil' 'python-pyqt5' -'python-pip' -'qemu' -'rsync' -'sddm' -'sddm-kcm' -'snapper' -'spectacle' -'steam' -'sudo' -'swtpm' -'synergy' -'systemsettings' -'terminus-font' -'traceroute' -'ufw' -'unrar' -'unzip' -'usbutils' -'vim' -'virt-manager' -'virt-viewer' -'wget' -'which' -'wine-gecko' -'wine-mono' -'winetricks' -'xdg-desktop-portal-kde' -'xdg-user-dirs' -'zeroconf-ioslave' -'zip' -'zsh' -'zsh-syntax-highlighting' -'zsh-autosuggestions' +#CODECS +'gst-libav' #installed as part of wine dxvk-bin I DID NOT INSTALL WINE..its DXVK-BIN +'gst-plugins-good' #installed by virt +'gst-plugins-ugly' +'libdvdcss' # Portable abstraction library for DVD decryption +'kcodecs' #installed as part of a bunch of k things ) -for PKG in "${PKGS[@]}"; do - echo "INSTALLING: ${PKG}" - sudo pacman -S "$PKG" --noconfirm --needed -done +# Read config file, if it exists +configFileName=${HOME}/ArchTitus/install.conf +if [ -e "$configFileName" ]; then + echo "Using configuration file $configFileName." + . $configFileName +fi -# -# determine processor type and install microcode -# +# install default or user specified packages (if they exist) +if [ ${#PKGS_ARCH[@]} -eq 0 ]; then + echo "installing arch default packages" + for PKG in "${PKGS_ARCH_DEFAULT[@]}"; do + echo "INSTALLING ARCH DEFAULT PACKAGE: ${PKG}" + pacman -S "$PKG" --noconfirm --needed + break + done +else + echo "installing arch user specified packages" + for PKG in "${PKGS_ARCH[@]}"; do + echo "INSTALLING ARCH USER SPECIFIED PACKAGE: ${PKG}" + pacman -S "$PKG" --noconfirm --needed + break + done +fi + +echo "-------------------------------------------------------------------------" +echo "-- Installing Processor Microcode --" +echo "-------------------------------------------------------------------------" proc_type=$(lscpu | awk '/Vendor ID:/ {print $3}') case "$proc_type" in GenuineIntel) - print "Installing Intel microcode" + echo "Installing Intel microcode" pacman -S --noconfirm intel-ucode proc_ucode=intel-ucode.img ;; AuthenticAMD) - print "Installing AMD microcode" + echo "Installing AMD microcode" pacman -S --noconfirm amd-ucode proc_ucode=amd-ucode.img ;; esac -# Graphics Drivers find and install + +echo "-------------------------------------------------------------------------" +echo "-- Installing Grapics Drivers --" +echo "-------------------------------------------------------------------------" if lspci | grep -E "NVIDIA|GeForce"; then - pacman -S nvidia --noconfirm --needed + echo "Installing NVIDIA Drivers." + pacman -S nvidia --noconfirm --needed nvidia-xconfig elif lspci | grep -E "Radeon"; then - pacman -S xf86-video-amdgpu --noconfirm --needed + echo "Installing ATI/AMD Drivers." + pacman -S xf86-video-amdgpu --noconfirm --needed elif lspci | grep -E "Integrated Graphics Controller"; then - pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils --needed --noconfirm + echo "Installing Intel Integrated Drivers." + pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils --needed --noconfirm fi -echo -e "\nDone!\n" -if ! source install.conf; then - read -p "Please enter username:" username -echo "username=$username" >> ${HOME}/ArchTitus/install.conf +hypervisor=$(systemd-detect-virt) +case $hypervisor in +kvm ) echo "Installing KVM guest tools." + pacman -S qemu-guest-agent --noconfirm --needed + systemctl enable qemu-guest-agent + ;; +vmware ) echo "Installing VMWare guest tools." + pacman -S open-vm-tools --noconfirm --needed + systemctl enable vmtoolsd + systemctl enable vmware-vmblock-fuse + ;; +oracle ) echo "Installing VirtualBox guest tools." + pacman -S virtualbox-guest-utils --noconfirm --needed + systemctl enable vboxservice + ;; +microsoft ) echo "Installing Hyper-V guest tools." + pacman -S hyperv --noconfirm --needed + systemctl enable hv_fcopy_daemon + systemctl enable hv_kvp_daemon + systemctl enable hv_vss_daemon + ;; +esac + + +echo "-------------------------------------------------------------------------" +echo "-- Setup User --" +echo "-------------------------------------------------------------------------" +# Read config file, if it exists +configFileName=${HOME}/ArchTitus/install.conf +if [ -e "$configFileName" ]; then + echo "Using configuration file $configFileName." + . $configFileName fi -if [ $(whoami) = "root" ]; -then - useradd -m -G wheel,libvirt -s /bin/bash $username - passwd $username - cp -R /root/ArchTitus /home/$username/ - chown -R $username: /home/$username/ArchTitus - read -p "Please name your machine:" nameofmachine - echo $nameofmachine > /etc/hostname + +# Get username +if [ -e "$configFileName" ] && [ ! -z "$username" ]; then + echo "Creating user - $username." else - echo "You are already a user proceed with aur installs" + read -p "Please enter username:" username + echo "username=$username" >> $configFileName fi +# Add user +egrep -i "libvirt" /etc/group; +if [ $? -eq 0 ]; then + useradd -m -G wheel,libvirt -s /bin/bash $username +else + useradd -m -G wheel -s /bin/bash $username +fi + +# Set user password +if [ -e "$configFileName" ] && [ ! -z "$password" ] && [ "$password" != "*!*CHANGEME*!*...and-dont-store-in-plantext..." ]; then + echo "Got a password for $username." + echo "$username:$password" | chpasswd + echo "Masking password in config file." + sed -i.bak 's/^\(password=\).*/\1*!*CHANGEME*!*...and-dont-store-in-plantext.../' $configFileName +else + passwd $username + if [ "$password" != "*!*CHANGEME*!*...and-dont-store-in-plantext..." ]; then + echo "password=*!*CHANGEME*!*...and-dont-store-in-plantext..." >> ${HOME}/ArchTitus/install.conf + fi +fi + +# Set hostname +if [ -e "$configFileName" ] && [ ! -z "$hostname" ]; then + echo "hostname: $hostname" +else + read -p "Please name your machine:" hostname + echo "hostname=$hostname" >> $configFileName +fi +echo $hostname > /etc/hostname + +# Set hosts file. +cat < /etc/hosts +127.0.0.1 localhost +::1 localhost +127.0.1.1 $hostname.localdomain $hostname +EOF + +# Copy this script to new user home directory +cp -R /root/ArchTitus /home/$username/ +chown -R $username: /home/$username/ArchTitus + +# Add sudo no password rights +sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers + +echo "ready for 'arch-chroot /mnt /usr/bin/runuser -u $username -- /home/$username/ArchTitus/2-user.sh'" diff --git a/2-user.sh b/2-user.sh index 881a28d..b587025 100755 --- a/2-user.sh +++ b/2-user.sh @@ -8,30 +8,27 @@ # ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ #------------------------------------------------------------------------- -echo -e "\nINSTALLING AUR SOFTWARE\n" -# You can solve users running this script as root with this and then doing the same for the next for statement. However I will leave this up to you. +echo "-------------------------------------------------------------------------" +echo "-- Setup yay to download packages from AUR --" +echo "-------------------------------------------------------------------------" +# Make sure these packages are installed for installing AUR manager +sudo pacman -S git base-devel --noconfirm --needed -echo "CLONING: YAY" +# Download and Install yay cd ~ git clone "https://aur.archlinux.org/yay.git" cd ${HOME}/yay makepkg -si --noconfirm -cd ~ -touch "$HOME/.cache/zshhistory" -git clone "https://github.com/ChrisTitusTech/zsh" -git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $HOME/powerlevel10k -ln -s "$HOME/zsh/.zshrc" $HOME/.zshrc -PKGS=( -'autojump' + +echo "-------------------------------------------------------------------------" +echo "-- Installing Requested Packages from AUR --" +echo "-------------------------------------------------------------------------" +PKGS_AUR_CORE=( +'autojump' # A faster way to navigate your filesystem from the command line 'awesome-terminal-fonts' -'brave-bin' # Brave Browser -'dxvk-bin' # DXVK DirectX to Vulcan -'github-desktop-bin' # Github Desktop sync -'lightly-git' +'lightly-git' # theme (for qt) 'lightlyshaders-git' -'mangohud' # Gaming FPS Counter -'mangohud-common' 'nerd-fonts-fira-code' 'nordic-darker-standard-buttons-theme' 'nordic-darker-theme' @@ -42,19 +39,64 @@ PKGS=( 'plasma-pa' 'ocs-url' # install packages from websites 'sddm-nordic-theme-git' -'snapper-gui-git' 'ttf-droid' 'ttf-hack' 'ttf-meslo' # Nerdfont package 'ttf-roboto' -'zoom' # video conferences -'snap-pac' ) -for PKG in "${PKGS[@]}"; do +PKGS_AUR_DEFAULT=( +'brave-bin' # Brave Browser +'dxvk-bin' # DXVK DirectX to Vulcan +'github-desktop-bin' # Github Desktop sync +'mangohud' # Gaming FPS Counter +'mangohud-common' #installs with mangohud +'zoom' # video conferences +'snap-pac' # btrfs tools...runs snapshot after every pacman install +'snapper-gui-git' # a tool of managing snapshots of Btrfs subvolumes and LVM volumes +) + +# install core packages +for PKG in "${PKGS_AUR_CORE[@]}"; do + echo "INSTALLING AUR CORE PACKAGE: ${PKG}" yay -S --noconfirm $PKG done +# Read config file, if it exists +configFileName=${HOME}/ArchTitus/install.conf +if [ -e "$configFileName" ]; then + echo "Using configuration file $configFileName." + . $configFileName +fi + +# install default or user specified packages (if they exist) +if [ ${#PKGS_AUR[@]} -eq 0 ]; then + echo "installing AUR default packages" + for PKG in "${PKGS_AUR_DEFAULT[@]}"; do + echo "INSTALLING AUR DEFAULT PACKAGE: ${PKG}" + yay -S --noconfirm $PKG + done +else + echo "installing AUR user specified packages" + for PKG in "${PKGS_AUR[@]}"; do + echo "INSTALLING AUR USER SPECIFIED PACKAGE: ${PKG}" + yay -S --noconfirm $PKG + done +fi + + +echo "-------------------------------------------------------------------------" +echo "-- Setup User Theme --" +echo "-------------------------------------------------------------------------" +# Zsh syntax highlighting +cd ~ +touch "$HOME/.cache/zshhistory" +git clone "https://github.com/ChrisTitusTech/zsh" +git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $HOME/powerlevel10k +ln -s "$HOME/zsh/.zshrc" $HOME/.zshrc + +# KDE config +sudo pacman -S python-pip --noconfirm --needed export PATH=$PATH:~/.local/bin cp -r $HOME/ArchTitus/dotfiles/* $HOME/.config/ pip install konsave @@ -62,5 +104,11 @@ konsave -i $HOME/ArchTitus/kde.knsv sleep 1 konsave -a kde -echo -e "\nDone!\n" -exit +sudo systemctl enable sddm.service +sudo bash -c 'cat < /etc/sddm.conf +[Theme] +Current=Nordic +EOF +' + +echo "ready for 'arch-chroot /mnt /root/ArchTitus/3-post-setup.sh'" diff --git a/3-post-setup.sh b/3-post-setup.sh index ba51c5d..5420ae3 100755 --- a/3-post-setup.sh +++ b/3-post-setup.sh @@ -8,50 +8,47 @@ # ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ #------------------------------------------------------------------------- -echo -e "\nFINAL SETUP AND CONFIGURATION" -echo "--------------------------------------" -echo "-- GRUB EFI Bootloader Install&Check--" -echo "--------------------------------------" -if [[ -d "/sys/firmware/efi" ]]; then - grub-install --efi-directory=/boot ${DISK} -fi -grub-mkconfig -o /boot/grub/grub.cfg +echo "-------------------------------------------------------------------------" +echo "-- GRUB Bootloader --" +echo "-------------------------------------------------------------------------" + ~/ArchTitus/x-bootloader.sh -# ------------------------------------------------------------------------ -echo -e "\nEnabling Login Display Manager" -systemctl enable sddm.service -echo -e "\nSetup SDDM Theme" -cat < /etc/sddm.conf -[Theme] -Current=Nordic -EOF - -# ------------------------------------------------------------------------ - -echo -e "\nEnabling essential services" - -systemctl enable cups.service -ntpd -qg -systemctl enable ntpd.service -systemctl disable dhcpcd.service -systemctl stop dhcpcd.service -systemctl enable NetworkManager.service -systemctl enable bluetooth -echo " -############################################################################### -# Cleaning -############################################################################### -" -# Remove no password sudo rights +echo "-------------------------------------------------------------------------" +echo "-- Cleaning Up / Misc --" +echo "-------------------------------------------------------------------------" +# Remove no password sudo rights granted previously sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers # Add sudo rights sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers -# Replace in the same state +# Cleanup unused packages +pacman -Rsc --noconfirm "$(pacman -Qqdt)" + +# Enable btrfs snapshots +snapper -c root create-config / + + +# Enable services +systemctl disable dhcpcd.service +systemctl stop dhcpcd.service + +systemctl enable sddm.service + +ntpd -qg #netowrk time sync +systemctl enable ntpd.service + +systemctl enable cups.service +systemctl enable bluetooth + +systemctl enable smb.service +systemctl enable nmb.service +systemctl enable NetworkManager.service +systemctl enable NetworkManager-dispatcher.service + +# change directory back cd $pwd -echo " -############################################################################### -# Done - Please Eject Install Media and Reboot -############################################################################### -" + +echo "-------------------------------------------------------------------------" +echo "-- Done - Please Eject Install Media and Reboot --" +echo "-------------------------------------------------------------------------" diff --git a/archtitus.sh b/archtitus.sh index db537b3..3628a85 100755 --- a/archtitus.sh +++ b/archtitus.sh @@ -1,7 +1,13 @@ #!/bin/bash - bash 0-preinstall.sh - arch-chroot /mnt /root/ArchTitus/1-setup.sh - source /mnt/root/ArchTitus/install.conf - arch-chroot /mnt /usr/bin/runuser -u $username -- /home/$username/ArchTitus/2-user.sh - arch-chroot /mnt /root/ArchTitus/3-post-setup.sh \ No newline at end of file +read -t 60 -p 'Welcome! Please wait 60 seconds for lingering tasks (time set, reflector, graphical interface...) to complete. Press enter to skip.' + +status=$? +cmd="bash 0-preinstall.sh" +$cmd +status=$? && [ $status -eq 0 ] || exit + +arch-chroot /mnt /root/ArchTitus/1-setup.sh +source /mnt/root/ArchTitus/install.conf #read config file +arch-chroot /mnt /usr/bin/runuser -u $username -- /home/$username/ArchTitus/2-user.sh +arch-chroot /mnt /root/ArchTitus/3-post-setup.sh diff --git a/install.example.conf b/install.example.conf index 2eb631b..bfc10bc 100644 --- a/install.example.conf +++ b/install.example.conf @@ -1,3 +1,4 @@ +disk=/dev/sda hostname=host username=titus password=1234 diff --git a/x-bootloader.sh b/x-bootloader.sh new file mode 100755 index 0000000..0aad7b1 --- /dev/null +++ b/x-bootloader.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Read config file, if it exists +configFileName=${HOME}/ArchTitus/install.conf +if [ -e "$configFileName" ]; then + echo "Using configuration file $configFileName." + . $configFileName +fi + +# Check partitions are mounted +if ! grep -qs '/boot ' /proc/mounts; then + umount -fl /mnt + ~/ArchTitus/x-mount.sh + arch-chroot /mnt /root/ArchTitus/x-bootloader.sh + echo "Done. Please reboot and/or try again if needed". + exit +fi + +# install grub +if [[ ! -d "/sys/firmware/efi" ]]; then + pacman -S grub --noconfirm --needed + echo "Detected BIOS..." + if [ -z "$disk" ]; then + lsblk + echo "Please enter disk to install bootloader to: (example /dev/sda)" + read disk + disk="${disk,,}" + if [[ "${disk}" != *"/dev/"* ]]; then + disk="/dev/${disk}" + fi + else + echo "Installing BIOS GRUB to $disk." + fi + grub-install --boot-directory=/boot $disk +fi +if [[ -d "/sys/firmware/efi" ]]; then + pacman -S grub efibootmgr --noconfirm --needed + echo "Detected EFI..." + grub-install --efi-directory=/boot +fi + +grubfile=/boot/grub/grub.cfg +grub-mkconfig -o $grubfile + +if [[ -s $grubfile ]]; then + cat $grubfile + echo "$grubfile exists and not empty" + read -n 1 -s -r -p "Press any key to continue...or manually break script here." +else + echo "" + echo "$grubfile doesn't exist or is empty. Is grub downloading correctly?". + echo "Sometimes file wont exist, or a grub.new file is presnet in /boot/grub" + echo "Other times the file will be blank and grub-mkconfig outputs nothing..." + echo "Try again or break the script here and investigate" + echo "you'll find the following commands useful to investigate" + echo "arch-chroot /mnt" + echo "grub-mkconfig -o $grubfile" + read -n 1 -s -r -p "Press any key to continue...or manually break script here." +fi diff --git a/x-mount.sh b/x-mount.sh new file mode 100755 index 0000000..cd8ca70 --- /dev/null +++ b/x-mount.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + + # mount target + echo "Mounting Filesystems..." + mount -t btrfs -o subvol=@ -L ROOT /mnt + mkdir /mnt/boot + mkdir /mnt/boot/efi + mount -t vfat -L BOOT /mnt/boot + + if ! grep -qs '/mnt' /proc/mounts; then + echo "Drive did not mount correctly. Can not continue!" + read -n 1 -s -r -p "Press any key to reboot..." + reboot now + fi