diff --git a/0-preinstall.sh b/0-preinstall.sh index 07c46bc..e5f61a7 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -7,7 +7,7 @@ CONFIG_FILE="$SCRIPT_DIR"/setup.conf if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" else - echo "Missing file: setup.conf" + echo "ERROR! Missing file: setup.conf" exit 1 fi @@ -36,14 +36,19 @@ do_btrfs() { done } +# list of packages to install +PACKAGES=() + do_format() { case "$FS" in "xfs") install_pkg xfsprogs + PACKAGES+=("xfsprogs") mkfs.xfs -f -L "$ROOT" "$1" ;; "btrfs") install_pkg btrfs-progs + PACKAGES+=("btrfs-progs") mkfs.btrfs -L "$ROOT" "$1" -f ;; "ext4") @@ -54,6 +59,7 @@ do_format() { ;; "f2fs") install_pkg f2fs-tools + PACKAGES+=("f2fs-tools") mkfs.f2fs -l "$ROOT" -O extra_attr,inode_checksum,sb_checksum "$1" ;; "ext2") @@ -64,14 +70,17 @@ do_format() { ;; "jfs") install_pkg jfsutils + PACKAGES+=("jfsutils") mkfs.jfs -L "$ROOT" "$1" ;; "nilfs2") install_pkg nilfs-utils + PACKAGES+=("nilfs-utils") mkfs.nilfs2 -L "$ROOT" "$1" ;; "ntfs") install_pkg ntfs-3g + PACKAGES+=("ntfs-3g") mkfs.ntfs -Q -L "$ROOT" "$1" ;; *) @@ -82,7 +91,6 @@ do_format() { } do_lvm() { - install_pkg lvm2 i=0 while [[ "$i" -le "${#LVM_PART_NUM[@]}" ]]; do if [[ "${#LVM_PART_NUM[@]}" -eq 1 ]]; then @@ -109,11 +117,13 @@ mount_lvm() { mount -t "$FS" /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x" done } + prep_disk() { wipefs -a -f "$DISK" # wipe any file system sgdisk -Z "$DISK" # zap all on disk sgdisk -a 2048 -o "$DISK" # new gpt disk 2048 alignment } + do_partition() { prep_disk if [[ "$UEFI" -eq 1 ]]; then @@ -166,6 +176,7 @@ if [[ "$LAYOUT" -eq 1 ]]; then mount_boot elif [[ "$LVM" -eq 1 ]]; then + PACKAGES+=("lvm2") do_partition sgdisk --typecode=2:8e00 "$DISK" partprobe "$DISK" @@ -178,6 +189,7 @@ elif [[ "$LVM" -eq 1 ]]; then set_option "HOOKS" "(lvm2 filesystems)" elif [[ "$LUKS" -eq 1 ]]; then + PACKAGES+=("cryptsetup" "lvm2") do_partition make_boot echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART2" - @@ -218,13 +230,13 @@ fi echo "Arch Install on Main Drive" # for test purposes -pacstrap "$MOUNTPOINT" base linux vim --needed --noconfirm -#pacstrap "$MOUNTPOINT" base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed +# pacstrap "$MOUNTPOINT" base linux vim --needed --noconfirm +pacstrap "$MOUNTPOINT" base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt "${PACKAGES[@]}" --noconfirm --needed echo "keyserver hkp://keyserver.ubuntu.com" >>"$MOUNTPOINT"/etc/pacman.d/gnupg/gpg.conf genfstab -U "$MOUNTPOINT" >>"$MOUNTPOINT"/etc/fstab -cp -R "${SCRIPT_DIR}" "$MOUNTPOINT"/root/ArchTitus +cp -R "$SCRIPT_DIR" "$MOUNTPOINT"/root/ArchTitus cp /etc/pacman.d/mirrorlist "$MOUNTPOINT"/etc/pacman.d/mirrorlist # TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') diff --git a/1-setup.sh b/1-setup.sh index 1c0afa8..2cc5650 100755 --- a/1-setup.sh +++ b/1-setup.sh @@ -7,18 +7,15 @@ CONFIG_FILE="$SCRIPT_DIR"/setup.conf if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" else - echo "Missing file: setup.conf" + echo "ERROR! Missing file: setup.conf" exit 1 fi title basic installations install_pkg networkmanager dhclient reflector \ - rsync btrfs-progs arch-install-scripts \ + rsync arch-install-scripts \ git pacman-contrib curl -echo "Network Setup" -systemctl enable --now NetworkManager - install_xorg() { install_pkg "xorg xorg-server" } @@ -48,10 +45,6 @@ localectl --no-ask-password set-locale LANG="$LOCALE" LC_TIME="$LOCALE" localectl --no-ask-password set-keymap --no-convert "$KEYMAP" # Add sudo no password rights -<<<<<<< HEAD -======= -sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers ->>>>>>> 44fb72cfdf009a9815f39848bc8aa7d8f7c8321b sed -i 's/^# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers #Add parallel downloading @@ -70,6 +63,7 @@ case "$DESKTOP" in echo "INSTALLING: $LINE" install_pkg "$LINE" done >/etc/default/grub + echo -e "Updating grub..." + grub-mkconfig -o /boot/grub/grub.cfg + echo -e "All set!" -echo -e "Installing CyberRe Grub theme..." -THEME_DIR="/boot/grub/themes" -THEME_NAME=CyberRe -echo -e "Creating the theme directory..." -mkdir -p "${THEME_DIR}/${THEME_NAME}" -echo -e "Copying the theme..." -cd "$HOME"/ArchTitus || exit 1 -cp -a ${THEME_NAME}/* ${THEME_DIR}/${THEME_NAME} -echo -e "Backing up Grub config..." -cp -an /etc/default/grub /etc/default/grub.bak -echo -e "Setting the theme as the default..." -grep "GRUB_THEME=" /etc/default/grub >/dev/null 2>&1 && sed -i '/GRUB_THEME=/d' /etc/default/grub -echo "GRUB_THEME=\"${THEME_DIR}/${THEME_NAME}/theme.txt\"" >>/etc/default/grub -echo -e "Updating grub..." -grub-mkconfig -o /boot/grub/grub.cfg -echo -e "All set!" +fi -echo -ne " -------------------------------------------------------------------------- - Enabling Login Display Manager -------------------------------------------------------------------------- -" -systemctl enable sddm.service -echo -ne " -------------------------------------------------------------------------- - Setting up SDDM Theme -------------------------------------------------------------------------- -" -cat </etc/sddm.conf +if [[ "$LAYOUT" -eq 1 || "$DESKTOP" =~ "lxqt" ]]; then + echo "Setting up SDDM Theme" + cat </etc/sddm.conf [Theme] Current=Nordic EOF +fi -echo -ne " -------------------------------------------------------------------------- - Enabling Essential Services -------------------------------------------------------------------------- -" +echo "Enabling Essential Services" systemctl enable cups.service systemctl enable cronie.service ntpd -qg @@ -62,23 +48,17 @@ systemctl disable dhcpcd.service systemctl stop dhcpcd.service systemctl enable NetworkManager.service systemctl enable bluetooth -echo -ne " -------------------------------------------------------------------------- - Cleaning -------------------------------------------------------------------------- -" + +echo "Cleaning" # Remove no password sudo rights -<<<<<<< HEAD -======= -sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers ->>>>>>> 44fb72cfdf009a9815f39848bc8aa7d8f7c8321b sed -i 's/^%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers + # Add sudo rights -sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers +cp "$SCRIPT_DIR"/main.log var/log/archtitus.log rm -r /root/ArchTitus rm -r /home/"$USERNAME"/ArchTitus # Replace in the same state -cd "$(pwd)" || exit 1 +cd "$(pwd)" || exit 1 \ No newline at end of file diff --git a/archtitus.sh b/archtitus.sh index f27c2a5..5fbca65 100755 --- a/archtitus.sh +++ b/archtitus.sh @@ -25,7 +25,29 @@ logo() { ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ " -<<<<<<< HEAD +} + +do_reboot () { + umount -R "$MOUNTPOINT"/boot + umount -R "$MOUNTPOINT" + reboot +} + +end() { + logo + for (( i = 15; i >= 1; i-- )); do + read -r -s -n 1 -t 1 -p "Rebooting in $i seconds... Press Esc key to abort or press R key to reboot now."$'\n' KEY# + CODE="$?" + if [ "$CODE" != "0" ]; then + continue + fi + if [[ "$KEY" == $'\e' ]]; then + break + elif [[ "$KEY" == "r" || "$KEY" == "R" ]]; then + do_reboot + break + fi + done } sequence() { @@ -36,37 +58,12 @@ sequence() { echo "ERROR! Missing file: setup.conf" exit 1 fi -======= -#!/bin/bash -if awk -F/ '$2 == "docker"' /proc/self/cgroup | read; then - echo -ne "docker container found script can't install (at the moment)" -else - bash startup.sh - source $SCRIPT_DIR/setup.conf ->>>>>>> 44fb72cfdf009a9815f39848bc8aa7d8f7c8321b + source "$SCRIPT_DIR"/setup.conf bash 0-preinstall.sh arch-chroot /mnt /root/ArchTitus/1-setup.sh arch-chroot /mnt /usr/bin/runuser -u "$USERNAME" -- /home/"$USERNAME"/ArchTitus/2-user.sh arch-chroot /mnt /root/ArchTitus/3-post-setup.sh -<<<<<<< HEAD - logo - echo -ne " -======= -fi -echo -ne " -------------------------------------------------------------------------- - █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ - ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ - ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ - ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ - ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ - ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ->>>>>>> 44fb72cfdf009a9815f39848bc8aa7d8f7c8321b -------------------------------------------------------------------------- - Automated Arch Linux Installer -------------------------------------------------------------------------- - Done - Please Eject Install Media and Reboot -" + } logo echo -ne " @@ -77,3 +74,4 @@ echo -ne " " bash startup.sh sequence |& tee "$LOG" +end diff --git a/startup.sh b/startup.sh index c824fd9..d18fd98 100644 --- a/startup.sh +++ b/startup.sh @@ -22,14 +22,24 @@ set_option() { check_root() { if [[ "$(id -u)" != "0" ]]; then - echo -ne "ERROR! This script must be running under the 'root' user!" + echo -ne "ERROR! This script must be running under the 'root' user!\n" + exit 1 + fi +} + +check_docker() { + if awk -F/ '$2 == "docker"' /proc/self/cgroup | read -r; then + echo -ne "ERROR! Docker container not supported (at the moment)\n" + exit 1 + elif [[ -f /.dockerenv ]]; then + echo -ne "ERROR! Docker container not supported (at the moment)\n" exit 1 fi } check_arch() { if [[ ! -e /etc/arch-release ]]; then - echo -ne "ERROR! This script must be run in Arch Linux!" + echo -ne "ERROR! This script must be run in Arch Linux!\n" exit 1 fi } @@ -37,7 +47,7 @@ check_arch() { check_pacman() { if [[ -f /var/lib/pacman/db.lck ]]; then echo "ERROR! Pacman is blocked." - echo "If not running remove /var/lib/pacman/db.lck." + echo -ne "If not running remove /var/lib/pacman/db.lck.\n" exit 1 fi } @@ -181,7 +191,7 @@ refresh_pacman() { } something_failed() { - echo "ERROR! Something is not right. Exiting." + echo "ERROR! Something is not right. Exiting.\n" exit 1 } @@ -228,6 +238,7 @@ background_check() { fi check_arch check_pacman + check_docker efi_check check_root set_ntp @@ -479,6 +490,22 @@ set_desktop() { } +set_aur_helper() { + title "Select your preferred AUR helper" + SELECTION=("yay" "trizen" "aurman" "aura" "pikaur") + PS3="$PROMPT" + select OPT in "${SELECTION[@]}"; do + if elements_present "$OPT" "${SELECTION[@]}"; then + set_option "AURHELPER" "$OPT" + break + else + invalid_option + set_aur_helper + break + fi + done +} + set_bootloader() { title "Select your bootloader" SELECTION=("Default (GRUB)" "Systemd" "UEFI" "None") @@ -532,6 +559,7 @@ make_choice() { set_option "LAYOUT" 1 set_option "BOOTLOADER" "grub" set_option "FS" "btrfs" + set_option "AURHELPER" "yay" set_option "DESKTOP" "default" break @@ -548,6 +576,7 @@ make_choice() { set_keymap ssd_drive # Advance options + set_aur_helper set_partion_layout set_bootloader set_filesystem