initial commit
This commit is contained in:
parent
212a05d71a
commit
e1427912f5
80 changed files with 8684 additions and 0 deletions
26
core/tabs/system-setup/arch/paru-setup.sh
Executable file
26
core/tabs/system-setup/arch/paru-setup.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
installDepend() {
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
if ! command_exists paru; then
|
||||
printf "%b\n" "${YELLOW}Installing paru as AUR helper...${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel git
|
||||
cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/paru.git && "$ESCALATION_TOOL" chown -R "$USER": ./paru
|
||||
cd paru && makepkg --noconfirm -si
|
||||
printf "%b\n" "${GREEN}Paru installed${RC}"
|
||||
else
|
||||
printf "%b\n" "${GREEN}Paru already installed${RC}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installDepend
|
673
core/tabs/system-setup/arch/server-setup.sh
Executable file
673
core/tabs/system-setup/arch/server-setup.sh
Executable file
|
@ -0,0 +1,673 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Redirect stdout and stderr to archsetup.txt and still output to console
|
||||
exec > >(tee -i archsetup.txt)
|
||||
exec 2>&1
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
|
||||
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
|
||||
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
|
||||
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||
-------------------------------------------------------------------------
|
||||
Automated Arch Linux Installer
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Verifying Arch Linux ISO is Booted
|
||||
|
||||
"
|
||||
if [ ! -f /usr/bin/pacstrap ]; then
|
||||
echo "This script must be run from an Arch Linux ISO environment."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
root_check() {
|
||||
if [[ "$(id -u)" != "0" ]]; then
|
||||
echo -ne "ERROR! This script must be run under the 'root' user!\n"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
docker_check() {
|
||||
if awk -F/ '$2 == "docker"' /proc/self/cgroup | read -r; then
|
||||
echo -ne "ERROR! Docker container is not supported (at the moment)\n"
|
||||
exit 0
|
||||
elif [[ -f /.dockerenv ]]; then
|
||||
echo -ne "ERROR! Docker container is not supported (at the moment)\n"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
arch_check() {
|
||||
if [[ ! -e /etc/arch-release ]]; then
|
||||
echo -ne "ERROR! This script must be run in Arch Linux!\n"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
pacman_check() {
|
||||
if [[ -f /var/lib/pacman/db.lck ]]; then
|
||||
echo "ERROR! Pacman is blocked."
|
||||
echo -ne "If not running remove /var/lib/pacman/db.lck.\n"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
background_checks() {
|
||||
root_check
|
||||
arch_check
|
||||
pacman_check
|
||||
docker_check
|
||||
}
|
||||
|
||||
select_option() {
|
||||
local options=("$@")
|
||||
local num_options=${#options[@]}
|
||||
local selected=0
|
||||
local last_selected=-1
|
||||
|
||||
while true; do
|
||||
# Move cursor up to the start of the menu
|
||||
if [ $last_selected -ne -1 ]; then
|
||||
echo -ne "\033[${num_options}A"
|
||||
fi
|
||||
|
||||
if [ $last_selected -eq -1 ]; then
|
||||
echo "Please select an option using the arrow keys and Enter:"
|
||||
fi
|
||||
for i in "${!options[@]}"; do
|
||||
if [ "$i" -eq $selected ]; then
|
||||
echo "> ${options[$i]}"
|
||||
else
|
||||
echo " ${options[$i]}"
|
||||
fi
|
||||
done
|
||||
|
||||
last_selected=$selected
|
||||
|
||||
# Read user input
|
||||
read -rsn1 key
|
||||
case $key in
|
||||
$'\x1b') # ESC sequence
|
||||
read -rsn2 -t 0.1 key
|
||||
case $key in
|
||||
'[A') # Up arrow
|
||||
((selected--))
|
||||
if [ $selected -lt 0 ]; then
|
||||
selected=$((num_options - 1))
|
||||
fi
|
||||
;;
|
||||
'[B') # Down arrow
|
||||
((selected++))
|
||||
if [ $selected -ge $num_options ]; then
|
||||
selected=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
'') # Enter key
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
return $selected
|
||||
}
|
||||
|
||||
# @description Displays ArchTitus logo
|
||||
# @noargs
|
||||
logo () {
|
||||
# This will be shown on every set as user is progressing
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
|
||||
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
|
||||
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
|
||||
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||
------------------------------------------------------------------------
|
||||
Please select presetup settings for your system
|
||||
------------------------------------------------------------------------
|
||||
"
|
||||
}
|
||||
# @description This function will handle file systems. At this movement we are handling only
|
||||
# btrfs and ext4. Others will be added in future.
|
||||
filesystem () {
|
||||
echo -ne "
|
||||
Please Select your file system for both boot and root
|
||||
"
|
||||
options=("btrfs" "ext4" "luks" "exit")
|
||||
select_option "${options[@]}"
|
||||
|
||||
case $? in
|
||||
0) export FS=btrfs;;
|
||||
1) export FS=ext4;;
|
||||
2)
|
||||
set_password "LUKS_PASSWORD"
|
||||
export FS=luks
|
||||
;;
|
||||
3) exit ;;
|
||||
*) echo "Wrong option please select again"; filesystem;;
|
||||
esac
|
||||
}
|
||||
|
||||
# @description Detects and sets timezone.
|
||||
timezone () {
|
||||
# Added this from arch wiki https://wiki.archlinux.org/title/System_time
|
||||
time_zone="$(curl --fail https://ipapi.co/timezone)"
|
||||
echo -ne "
|
||||
System detected your timezone to be '$time_zone' \n"
|
||||
echo -ne "Is this correct?
|
||||
"
|
||||
options=("Yes" "No")
|
||||
select_option "${options[@]}"
|
||||
|
||||
case ${options[$?]} in
|
||||
y|Y|yes|Yes|YES)
|
||||
echo "${time_zone} set as timezone"
|
||||
export TIMEZONE=$time_zone;;
|
||||
n|N|no|NO|No)
|
||||
echo "Please enter your desired timezone e.g. Europe/London :"
|
||||
read -r new_timezone
|
||||
echo "${new_timezone} set as timezone"
|
||||
export TIMEZONE=$new_timezone;;
|
||||
*) echo "Wrong option. Try again";timezone;;
|
||||
esac
|
||||
}
|
||||
# @description Set user's keyboard mapping.
|
||||
keymap () {
|
||||
echo -ne "
|
||||
Please select key board layout from this list"
|
||||
# These are default key maps as presented in official arch repo archinstall
|
||||
options=(us by ca cf cz de dk es et fa fi fr gr hu il it lt lv mk nl no pl ro ru se sg ua uk)
|
||||
|
||||
select_option "${options[@]}"
|
||||
keymap=${options[$?]}
|
||||
|
||||
echo -ne "Your key boards layout: ${keymap} \n"
|
||||
export KEYMAP=$keymap
|
||||
}
|
||||
|
||||
# @description Choose whether drive is SSD or not.
|
||||
drivessd () {
|
||||
echo -ne "
|
||||
Is this an ssd? yes/no:
|
||||
"
|
||||
|
||||
options=("Yes" "No")
|
||||
select_option "${options[@]}"
|
||||
|
||||
case ${options[$?]} in
|
||||
y|Y|yes|Yes|YES)
|
||||
export MOUNT_OPTIONS="noatime,compress=zstd,ssd,commit=120";;
|
||||
n|N|no|NO|No)
|
||||
export MOUNT_OPTIONS="noatime,compress=zstd,commit=120";;
|
||||
*) echo "Wrong option. Try again";drivessd;;
|
||||
esac
|
||||
}
|
||||
|
||||
# @description Disk selection for drive to be used with installation.
|
||||
diskpart () {
|
||||
echo -ne "
|
||||
------------------------------------------------------------------------
|
||||
THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK
|
||||
Please make sure you know what you are doing because
|
||||
after formatting your disk there is no way to get data back
|
||||
*****BACKUP YOUR DATA BEFORE CONTINUING*****
|
||||
***I AM NOT RESPONSIBLE FOR ANY DATA LOSS***
|
||||
------------------------------------------------------------------------
|
||||
|
||||
"
|
||||
|
||||
PS3='
|
||||
Select the disk to install on: '
|
||||
options=($(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2"|"$3}'))
|
||||
|
||||
select_option "${options[@]}"
|
||||
disk=${options[$?]%|*}
|
||||
|
||||
echo -e "\n${disk%|*} selected \n"
|
||||
export DISK=${disk%|*}
|
||||
|
||||
drivessd
|
||||
}
|
||||
|
||||
# @description Gather username and password to be used for installation.
|
||||
userinfo () {
|
||||
# Loop through user input until the user gives a valid username
|
||||
while true
|
||||
do
|
||||
read -r -p "Please enter username: " username
|
||||
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
echo "Incorrect username."
|
||||
done
|
||||
export USERNAME=$username
|
||||
|
||||
while true
|
||||
do
|
||||
read -rs -p "Please enter password: " PASSWORD1
|
||||
echo -ne "\n"
|
||||
read -rs -p "Please re-enter password: " PASSWORD2
|
||||
echo -ne "\n"
|
||||
if [[ "$PASSWORD1" == "$PASSWORD2" ]]; then
|
||||
break
|
||||
else
|
||||
echo -ne "ERROR! Passwords do not match. \n"
|
||||
fi
|
||||
done
|
||||
export PASSWORD=$PASSWORD1
|
||||
|
||||
# Loop through user input until the user gives a valid hostname, but allow the user to force save
|
||||
while true
|
||||
do
|
||||
read -r -p "Please name your machine: " name_of_machine
|
||||
# hostname regex (!!couldn't find spec for computer name!!)
|
||||
if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
# if validation fails allow the user to force saving of the hostname
|
||||
read -r -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
|
||||
if [[ "${force,,}" = "y" ]]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
export NAME_OF_MACHINE=$name_of_machine
|
||||
}
|
||||
|
||||
# Starting functions
|
||||
background_checks
|
||||
clear
|
||||
logo
|
||||
userinfo
|
||||
clear
|
||||
logo
|
||||
diskpart
|
||||
clear
|
||||
logo
|
||||
filesystem
|
||||
clear
|
||||
logo
|
||||
timezone
|
||||
clear
|
||||
logo
|
||||
keymap
|
||||
|
||||
echo "Setting up mirrors for optimal download"
|
||||
iso=$(curl -4 ifconfig.co/country-iso)
|
||||
timedatectl set-ntp true
|
||||
pacman -Sy
|
||||
pacman -S --noconfirm archlinux-keyring #update keyrings to latest to prevent packages failing to install
|
||||
pacman -S --noconfirm --needed pacman-contrib terminus-font
|
||||
setfont ter-v18b
|
||||
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 "
|
||||
-------------------------------------------------------------------------
|
||||
Setting up $iso mirrors for faster downloads
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
reflector -a 48 -c "$iso" -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist
|
||||
if [ ! -d "/mnt" ]; then
|
||||
mkdir /mnt
|
||||
fi
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Installing Prerequisites
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
pacman -S --noconfirm --needed gptfdisk btrfs-progs glibc
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Formatting Disk
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
umount -A --recursive /mnt # make sure everything is unmounted before we start
|
||||
# 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::+1GiB --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 # Checking for bios system
|
||||
sgdisk -A 1:set:2 "${DISK}"
|
||||
fi
|
||||
partprobe "${DISK}" # reread partition table to ensure it is correct
|
||||
|
||||
# make filesystems
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Creating Filesystems
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
# @description Creates the btrfs subvolumes.
|
||||
createsubvolumes () {
|
||||
btrfs subvolume create /mnt/@
|
||||
btrfs subvolume create /mnt/@home
|
||||
}
|
||||
|
||||
# @description Mount all btrfs subvolumes after root has been mounted.
|
||||
mountallsubvol () {
|
||||
mount -o "${MOUNT_OPTIONS}",subvol=@home "${partition3}" /mnt/home
|
||||
}
|
||||
|
||||
# @description BTRFS subvolulme creation and mounting.
|
||||
subvolumesetup () {
|
||||
# create nonroot subvolumes
|
||||
createsubvolumes
|
||||
# unmount root to remount with subvolume
|
||||
umount /mnt
|
||||
# mount @ subvolume
|
||||
mount -o "${MOUNT_OPTIONS}",subvol=@ "${partition3}" /mnt
|
||||
# make directories home, .snapshots, var, tmp
|
||||
mkdir -p /mnt/home
|
||||
# mount subvolumes
|
||||
mountallsubvol
|
||||
}
|
||||
|
||||
if [[ "${DISK}" =~ "nvme" ]]; then
|
||||
partition2=${DISK}p2
|
||||
partition3=${DISK}p3
|
||||
else
|
||||
partition2=${DISK}2
|
||||
partition3=${DISK}3
|
||||
fi
|
||||
|
||||
if [[ "${FS}" == "btrfs" ]]; then
|
||||
mkfs.vfat -F32 -n "EFIBOOT" "${partition2}"
|
||||
mkfs.btrfs -L ROOT "${partition3}" -f
|
||||
mount -t btrfs "${partition3}" /mnt
|
||||
subvolumesetup
|
||||
elif [[ "${FS}" == "ext4" ]]; then
|
||||
mkfs.vfat -F32 -n "EFIBOOT" "${partition2}"
|
||||
mkfs.ext4 -L ROOT "${partition3}"
|
||||
mount -t ext4 "${partition3}" /mnt
|
||||
elif [[ "${FS}" == "luks" ]]; then
|
||||
mkfs.vfat -F32 -n "EFIBOOT" "${partition2}"
|
||||
# enter luks password to cryptsetup and format root partition
|
||||
echo -n "${LUKS_PASSWORD}" | cryptsetup -y -v luksFormat "${partition3}" -
|
||||
# open luks container and ROOT will be place holder
|
||||
echo -n "${LUKS_PASSWORD}" | cryptsetup open "${partition3}" ROOT -
|
||||
# now format that container
|
||||
mkfs.btrfs -L ROOT "${partition3}"
|
||||
# create subvolumes for btrfs
|
||||
mount -t btrfs "${partition3}" /mnt
|
||||
subvolumesetup
|
||||
fi
|
||||
|
||||
sync
|
||||
if ! mountpoint -q /mnt; then
|
||||
echo "ERROR! Failed to mount ${partition3} to /mnt after multiple attempts."
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p /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 -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Arch Install on Main Drive
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
if [[ ! -d "/sys/firmware/efi" ]]; then
|
||||
pacstrap /mnt base base-devel linux-lts linux-firmware --noconfirm --needed
|
||||
else
|
||||
pacstrap /mnt base base-devel linux-lts linux-firmware efibootmgr --noconfirm --needed
|
||||
fi
|
||||
echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf
|
||||
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
|
||||
|
||||
genfstab -L /mnt >> /mnt/etc/fstab
|
||||
echo "
|
||||
Generated /etc/fstab:
|
||||
"
|
||||
cat /mnt/etc/fstab
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
GRUB BIOS Bootloader Install & Check
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
if [[ ! -d "/sys/firmware/efi" ]]; then
|
||||
grub-install --boot-directory=/mnt/boot "${DISK}"
|
||||
fi
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
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.
|
||||
mkdir -p /mnt/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly.
|
||||
if findmnt -n -o FSTYPE /mnt | grep -q btrfs; then
|
||||
chattr +C /mnt/opt/swap # apply NOCOW, btrfs needs that.
|
||||
fi
|
||||
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 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
|
||||
|
||||
gpu_type=$(lspci | grep -E "VGA|3D|Display")
|
||||
|
||||
arch-chroot /mnt /bin/bash -c "KEYMAP='${KEYMAP}' /bin/bash" <<EOF
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Network Setup
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
pacman -S --noconfirm --needed networkmanager dhclient
|
||||
systemctl enable --now NetworkManager
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Setting up mirrors for optimal download
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
pacman -S --noconfirm --needed pacman-contrib curl
|
||||
pacman -S --noconfirm --needed reflector rsync grub arch-install-scripts git ntp wget
|
||||
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
|
||||
|
||||
nc=$(grep -c ^processor /proc/cpuinfo)
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
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 "
|
||||
-------------------------------------------------------------------------
|
||||
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
|
||||
locale-gen
|
||||
timedatectl --no-ask-password set-timezone ${TIMEZONE}
|
||||
timedatectl --no-ask-password set-ntp 1
|
||||
localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8"
|
||||
ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
|
||||
|
||||
# Set keymaps
|
||||
echo "KEYMAP=${KEYMAP}" > /etc/vconsole.conf
|
||||
echo "XKBLAYOUT=${KEYMAP}" >> /etc/vconsole.conf
|
||||
echo "Keymap set to: ${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
|
||||
|
||||
#Add parallel downloading
|
||||
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
|
||||
|
||||
#Enable multilib
|
||||
sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
|
||||
pacman -Sy --noconfirm --needed
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Installing Microcode
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
# determine processor type and install microcode
|
||||
if grep -q "GenuineIntel" /proc/cpuinfo; then
|
||||
echo "Installing Intel microcode"
|
||||
pacman -S --noconfirm --needed intel-ucode
|
||||
elif grep -q "AuthenticAMD" /proc/cpuinfo; then
|
||||
echo "Installing AMD microcode"
|
||||
pacman -S --noconfirm --needed amd-ucode
|
||||
else
|
||||
echo "Unable to determine CPU vendor. Skipping microcode installation."
|
||||
fi
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Installing Graphics Drivers
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
# Graphics Drivers find and install
|
||||
if echo "${gpu_type}" | grep -E "NVIDIA|GeForce"; then
|
||||
echo "Installing NVIDIA drivers: nvidia-lts"
|
||||
pacman -S --noconfirm --needed nvidia-lts
|
||||
elif echo "${gpu_type}" | grep 'VGA' | grep -E "Radeon|AMD"; then
|
||||
echo "Installing AMD drivers: xf86-video-amdgpu"
|
||||
pacman -S --noconfirm --needed xf86-video-amdgpu
|
||||
elif echo "${gpu_type}" | grep -E "Integrated Graphics Controller"; then
|
||||
echo "Installing Intel drivers:"
|
||||
pacman -S --noconfirm --needed libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa
|
||||
elif echo "${gpu_type}" | grep -E "Intel Corporation UHD"; then
|
||||
echo "Installing Intel UHD drivers:"
|
||||
pacman -S --noconfirm --needed libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa
|
||||
fi
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Adding User
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
groupadd libvirt
|
||||
useradd -m -G wheel,libvirt -s /bin/bash $USERNAME
|
||||
echo "$USERNAME created, home directory created, added to wheel and libvirt group, default shell set to /bin/bash"
|
||||
echo "$USERNAME:$PASSWORD" | chpasswd
|
||||
echo "$USERNAME password set"
|
||||
echo $NAME_OF_MACHINE > /etc/hostname
|
||||
|
||||
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
|
||||
# making mkinitcpio with linux kernel
|
||||
mkinitcpio -p linux-lts
|
||||
fi
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
|
||||
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
|
||||
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
|
||||
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||
-------------------------------------------------------------------------
|
||||
Automated Arch Linux Installer
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Final Setup and Configurations
|
||||
GRUB EFI Bootloader Install & Check
|
||||
"
|
||||
|
||||
if [[ -d "/sys/firmware/efi" ]]; then
|
||||
grub-install --efi-directory=/boot ${DISK}
|
||||
fi
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
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
|
||||
fi
|
||||
# set kernel parameter for adding splash screen
|
||||
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& splash /' /etc/default/grub
|
||||
|
||||
echo -e "Installing CyberRe Grub theme..."
|
||||
THEME_DIR="/boot/grub/themes/CyberRe"
|
||||
echo -e "Creating the theme directory..."
|
||||
mkdir -p "${THEME_DIR}"
|
||||
|
||||
# Clone the theme
|
||||
cd "${THEME_DIR}" || exit
|
||||
git init
|
||||
git remote add -f origin https://github.com/ChrisTitusTech/Top-5-Bootloader-Themes.git
|
||||
git config core.sparseCheckout true
|
||||
echo "themes/CyberRe/*" >> .git/info/sparse-checkout
|
||||
git pull origin main
|
||||
mv themes/CyberRe/* .
|
||||
rm -rf themes
|
||||
rm -rf .git
|
||||
|
||||
echo "CyberRe theme has been cloned to ${THEME_DIR}"
|
||||
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 2>&1 >/dev/null && sed -i '/GRUB_THEME=/d' /etc/default/grub
|
||||
echo "GRUB_THEME=\"${THEME_DIR}/theme.txt\"" >> /etc/default/grub
|
||||
echo -e "Updating grub..."
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
echo -e "All set!"
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Enabling Essential Services
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
ntpd -qg
|
||||
systemctl enable ntpd.service
|
||||
echo " NTP enabled"
|
||||
systemctl disable dhcpcd.service
|
||||
echo " DHCP disabled"
|
||||
systemctl stop dhcpcd.service
|
||||
echo " DHCP stopped"
|
||||
systemctl enable NetworkManager.service
|
||||
echo " NetworkManager enabled"
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Cleaning
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
# Remove no password sudo 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
|
||||
# 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
|
||||
EOF
|
26
core/tabs/system-setup/arch/yay-setup.sh
Executable file
26
core/tabs/system-setup/arch/yay-setup.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
installDepend() {
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
if ! command_exists yay; then
|
||||
printf "%b\n" "${YELLOW}Installing yay as AUR helper...${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel git
|
||||
cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/yay-bin.git && "$ESCALATION_TOOL" chown -R "$USER": ./yay-bin
|
||||
cd yay-bin && makepkg --noconfirm -si
|
||||
printf "%b\n" "${GREEN}Yay installed${RC}"
|
||||
else
|
||||
printf "%b\n" "${GREEN}Aur helper already installed${RC}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installDepend
|
23
core/tabs/system-setup/fedora/configure-dnf.sh
Normal file
23
core/tabs/system-setup/fedora/configure-dnf.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
configureDNF() {
|
||||
case "$PACKAGER" in
|
||||
dnf)
|
||||
printf "%b\n" "${YELLOW}Configuring DNF...${RC}"
|
||||
"$ESCALATION_TOOL" sed -i '/^max_parallel_downloads=/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf
|
||||
echo "fastestmirror=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
|
||||
echo "defaultyes=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
|
||||
printf "%b\n" "${GREEN}DNF Configured Successfully.${RC}"
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
configureDNF
|
26
core/tabs/system-setup/fedora/multimedia-codecs.sh
Normal file
26
core/tabs/system-setup/fedora/multimedia-codecs.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
multimedia() {
|
||||
case "$PACKAGER" in
|
||||
dnf)
|
||||
if [ -e /etc/yum.repos.d/rpmfusion-free.repo ] && [ -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
|
||||
printf "%b\n" "${YELLOW}Installing Multimedia Codecs...${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update @sound-and-video -y
|
||||
printf "%b\n" "${GREEN}Multimedia Codecs Installed...${RC}"
|
||||
else
|
||||
printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
multimedia
|
94
core/tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh
Executable file
94
core/tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh
Executable file
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
# This script allows user to download proprietary drivers for nvidia in fedora
|
||||
|
||||
# It also disables nouveau nvidia drivers
|
||||
|
||||
# Installation guide link: https://rpmfusion.org/Howto/NVIDIA
|
||||
|
||||
# NOTE: Currently script only provides drivers for gpu 2014 and above (510+ and above)
|
||||
|
||||
checkRepo() {
|
||||
REPO_ID="rpmfusion-nonfree-nvidia-driver"
|
||||
|
||||
if [ "$(dnf repolist enabled 2>/dev/null | grep -c "$REPO_ID")" -gt 0 ]; then
|
||||
printf "%b\n" "${GREEN}Nvidia non-free repository is already enabled.${RC}"
|
||||
else
|
||||
printf "%b\n" "${YELLOW}Nvidia non-free repository is not enabled. Enabling now...${RC}"
|
||||
|
||||
# Enable the repository
|
||||
"$ESCALATION_TOOL" dnf config-manager --set-enabled "$REPO_ID"
|
||||
|
||||
# Refreshing repository list
|
||||
"$ESCALATION_TOOL" dnf makecache
|
||||
|
||||
# Verify if the repository is enabled
|
||||
if [ "$(dnf repolist enabled 2>/dev/null | grep -c "$REPO_ID")" -gt 0 ]; then
|
||||
printf "%b\n" "${GREEN}Nvidia non-free repository is now enabled...${RC}"
|
||||
else
|
||||
printf "%b\n" "${RED}Failed to enable nvidia non-free repository...${RC}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checkDriverInstallation() {
|
||||
if modinfo -F version nvidia >/dev/null 2>&1; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
installDriver() {
|
||||
|
||||
if checkDriverInstallation; then
|
||||
printf "%b\n" "${GREEN}NVIDIA driver is already installed.${RC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# NOTE:: Installing graphics driver.
|
||||
"$ESCALATION_TOOL" dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y
|
||||
printf "%b\n" "${YELLOW}Building the drivers may take upto 5 minutes. Please don't kill the script!\n If the build failed try running the script again, select \"Remove Nvidia Drivers\" and reboot the system, then try installing drivers again.${RC}"
|
||||
|
||||
for i in $(seq 1 5); do
|
||||
if checkDriverInstallation; then
|
||||
printf "%b\n" "${GREEN}Driver installed successfully.${RC}"
|
||||
printf "%b\n" "${GREEN}Installed driver version $(modinfo -F version nvidia)${RC}"
|
||||
break
|
||||
fi
|
||||
printf "%b\n" "${YELLOW}Waiting for driver to be built..."
|
||||
sleep 1m
|
||||
done
|
||||
|
||||
printf "%b\n" "${GREEN}Now you can reboot the system.${RC}"
|
||||
|
||||
}
|
||||
|
||||
# NOTE: A confirmation option to proceed or not
|
||||
userConfirmation() {
|
||||
printf "%b" "${YELLOW}Do you want to continue? (y/N): ${RC}"
|
||||
read -r choice
|
||||
case "$choice" in
|
||||
y | Y)
|
||||
checkRepo
|
||||
installDriver
|
||||
return
|
||||
;;
|
||||
n | N)
|
||||
printf "%b\n" "${RED} Exiting the Script ${RC}"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED} Invalid Option! ${RC}"
|
||||
userConfirmation
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
printf "%b\n" "${YELLOW}Warning! This script will enable Nvidia non-free repository and only install drivers for GPUs from 2014 or later. It works on fedora 34 and above.\n It is recommended remove this driver while updating your kernel packages to newer version.${RC}"
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
userConfirmation
|
29
core/tabs/system-setup/fedora/rpm-fusion-setup.sh
Normal file
29
core/tabs/system-setup/fedora/rpm-fusion-setup.sh
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
# https://rpmfusion.org/Configuration
|
||||
|
||||
installRPMFusion() {
|
||||
case "$PACKAGER" in
|
||||
dnf)
|
||||
if [ ! -e /etc/yum.repos.d/rpmfusion-free.repo ] || [ ! -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
|
||||
printf "%b\n" "${YELLOW}Installing RPM Fusion...${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora)".noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm
|
||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --enable fedora-cisco-openh264
|
||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --set-enabled rpmfusion-nonfree-updates
|
||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --set-enabled rpmfusion-free-updates
|
||||
printf "%b\n" "${GREEN}RPM Fusion installed and enabled${RC}"
|
||||
else
|
||||
printf "%b\n" "${GREEN}RPM Fusion already installed${RC}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installRPMFusion
|
21
core/tabs/system-setup/fedora/virtualization.sh
Normal file
21
core/tabs/system-setup/fedora/virtualization.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../../common-script.sh
|
||||
|
||||
# Install virtualization tools to enable virtual machines
|
||||
configureVirtualization() {
|
||||
case "$PACKAGER" in
|
||||
dnf)
|
||||
printf "%b\n" "${YELLOW}Installing virtualization tools...${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization
|
||||
printf "%b\n" "${GREEN}Installed virtualization tools...${RC}"
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
configureVirtualization
|
106
core/tabs/system-setup/gaming-setup.sh
Executable file
106
core/tabs/system-setup/gaming-setup.sh
Executable file
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
installDepend() {
|
||||
# Check for dependencies
|
||||
DEPENDENCIES='wine dbus'
|
||||
printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
#Check for multilib
|
||||
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
|
||||
echo "[multilib]" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
|
||||
echo "Include = /etc/pacman.d/mirrorlist" | "$ESCALATION_TOOL" tee -a /etc/pacman.conf
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Syu
|
||||
else
|
||||
printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
|
||||
fi
|
||||
|
||||
DISTRO_DEPS="gnutls lib32-gnutls base-devel gtk2 gtk3 lib32-gtk2 lib32-gtk3 libpulse lib32-libpulse alsa-lib lib32-alsa-lib \
|
||||
alsa-utils alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib giflib lib32-giflib libpng lib32-libpng \
|
||||
libldap lib32-libldap openal lib32-openal libxcomposite lib32-libxcomposite libxinerama lib32-libxinerama \
|
||||
ncurses lib32-ncurses vulkan-icd-loader lib32-vulkan-icd-loader ocl-icd lib32-ocl-icd libva lib32-libva \
|
||||
gst-plugins-base-libs lib32-gst-plugins-base-libs sdl2"
|
||||
|
||||
$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
|
||||
;;
|
||||
apt-get|nala)
|
||||
DISTRO_DEPS="libasound2 libsdl2 wine64 wine32"
|
||||
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common
|
||||
"$ESCALATION_TOOL" apt-add-repository contrib -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
|
||||
;;
|
||||
dnf)
|
||||
if [ "$(rpm -E %fedora)" -le 41 ]; then
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install ffmpeg ffmpeg-libs -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||
else
|
||||
printf "%b\n" "${CYAN}Fedora < 41 detected. Installing rpmfusion repos.${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --enable fedora-cisco-openh264 -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||
fi
|
||||
;;
|
||||
zypper)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -n install $DEPENDENCIES
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
installAdditionalDepend() {
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
DISTRO_DEPS='steam lutris goverlay'
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS
|
||||
;;
|
||||
apt-get|nala)
|
||||
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
|
||||
grep -v 'beta' |
|
||||
tail -n1 |
|
||||
cut -d '/' --fields=3)
|
||||
|
||||
version_no_v=$(echo "$version" | tr -d v)
|
||||
curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb"
|
||||
|
||||
printf "%b\n" "${YELLOW}Installing Lutris...${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb
|
||||
|
||||
rm lutris_"${version_no_v}"_all.deb
|
||||
|
||||
printf "%b\n" "${GREEN}Lutris Installation complete.${RC}"
|
||||
printf "%b\n" "${YELLOW}Installing steam...${RC}"
|
||||
|
||||
if lsb_release -i | grep -qi Debian; then
|
||||
"$ESCALATION_TOOL" apt-add-repository non-free -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install steam-installer -y
|
||||
else
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y steam
|
||||
fi
|
||||
;;
|
||||
dnf)
|
||||
DISTRO_DEPS='steam lutris'
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DISTRO_DEPS
|
||||
;;
|
||||
zypper)
|
||||
# Flatpak
|
||||
DISTRO_DEPS='lutris'
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkAURHelper
|
||||
checkEscalationTool
|
||||
installDepend
|
||||
installAdditionalDepend
|
466
core/tabs/system-setup/postinstall.sh
Executable file
466
core/tabs/system-setup/postinstall.sh
Executable file
|
@ -0,0 +1,466 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# ANSI color codes
|
||||
RED='\033[0;31m'
|
||||
CYAN='\033[0;36m'
|
||||
YELLOW='\033[0;33m'
|
||||
LIGHT_GREEN='\033[0;92m'
|
||||
BOLD='\033[1m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Initialize storage variables
|
||||
_STORED_ERRORS=""
|
||||
_STORED_WARNINGS=""
|
||||
_STORED_INFOS=""
|
||||
_STORED_NOTES=""
|
||||
|
||||
# Modified echo functions that store and display messages
|
||||
echo_error() {
|
||||
message="${RED}$1${NC}\n"
|
||||
printf "$message" >&2
|
||||
_STORED_ERRORS="${_STORED_ERRORS}${message}"
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
message="${YELLOW}$1${NC}\n"
|
||||
printf "$message"
|
||||
_STORED_WARNINGS="${_STORED_WARNINGS}${message}"
|
||||
}
|
||||
|
||||
echo_info() {
|
||||
message="${CYAN}$1${NC}\n"
|
||||
printf "$message"
|
||||
_STORED_INFOS="${_STORED_INFOS}${message}"
|
||||
}
|
||||
|
||||
echo_note() {
|
||||
message="${LIGHT_GREEN}$1${NC}\n"
|
||||
printf "$message"
|
||||
_STORED_NOTES="${_STORED_NOTES}${message}"
|
||||
}
|
||||
|
||||
echo_db() {
|
||||
message="${LIGHT_GREEN}$1${NC}\n"
|
||||
printf "$message"
|
||||
}
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# ─< to get the alias to install everything either with your shell or inside your script! >─
|
||||
if command_exists curl; then
|
||||
install_pkg() {
|
||||
sh -c "$(curl -sSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/snippets/install_pkg.sh)" -- "$@"
|
||||
}
|
||||
else
|
||||
echo_error "curl is not installed, universal install disabled!"
|
||||
fi
|
||||
|
||||
# Check if the user is root and set sudo variable if necessary
|
||||
check_root() {
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
if command_exists sudo; then
|
||||
echo_info "User is not root. Using sudo for privileged operations."
|
||||
_sudo="sudo"
|
||||
else
|
||||
echo_error "No sudo found and you're not root! Can't install packages."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo_info "Root access confirmed."
|
||||
_sudo=""
|
||||
fi
|
||||
}
|
||||
|
||||
comment_cd_sources() {
|
||||
# Path to sources.list
|
||||
sources_file="/etc/apt/sources.list"
|
||||
|
||||
# Check if file exists
|
||||
if [ ! -f "$sources_file" ]; then
|
||||
echo_error "Error: $sources_file not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Comment out CD-ROM entries using sudo
|
||||
$_sudo sed -i 's/^[[:space:]]*deb[[:space:]]\+cdrom:/#&/' "$sources_file"
|
||||
echo_info "CD-ROM entries have been commented out in $sources_file"
|
||||
}
|
||||
|
||||
i_yazi() {
|
||||
if command_exists curl; then
|
||||
curl -fsSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/installs/yazi.sh | sh
|
||||
else
|
||||
echo_error "No curl was found"
|
||||
fi
|
||||
}
|
||||
|
||||
deps="zsh tmux gdu rsync fzf unzip go btop make stow git npm bc pv zoxide ripgrep trash-cli"
|
||||
|
||||
check_nala() {
|
||||
deb_pkger=""
|
||||
echo_info "Updating sources.."
|
||||
if ! $_sudo apt-get update; then
|
||||
echo_error "Maybe you need a proxy?"
|
||||
fi
|
||||
if ! command_exists sudo; then
|
||||
echo_note "Installing sudo"
|
||||
apt-get install sudo --assume-yes
|
||||
fi
|
||||
if command_exists nala; then
|
||||
deb_pkger="nala"
|
||||
echo_info "Nala is already present, fetching mirros now! (This might take a minute or two, depending on your internet speed)"
|
||||
$_sudo nala fetch --auto --assume-yes
|
||||
else
|
||||
echo_note "Nala is not installed on the system, do you want to install it now? (Y/n): "
|
||||
read -r inst_nala
|
||||
case "$inst_nala" in
|
||||
N | n)
|
||||
deb_pkger="apt-get"
|
||||
echo_warning "All right, continue without nala!"
|
||||
;;
|
||||
*)
|
||||
echo_note "Installing nala.."
|
||||
$_sudo apt-get install nala --assume-yes &&
|
||||
deb_pkger="nala"
|
||||
|
||||
echo_info "Fetching best mirrors"
|
||||
$_sudo nala fetch --auto --assume-yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
inst_debian() {
|
||||
comment_cd_sources
|
||||
check_nala
|
||||
if command_exists nano; then
|
||||
if command_exists vi; then
|
||||
echo_note "Removing nano"
|
||||
$_sudo $deb_pkger remove nano --assume-yes
|
||||
else
|
||||
echo_info "Removing nano and installing vi as a backup"
|
||||
$_sudo $deb_pkger remove nano --assume-yes && $_sudo apt-get install vi --assume-yes
|
||||
fi
|
||||
fi
|
||||
|
||||
echo_note "Installing base packages: $deps"
|
||||
for _deps in $deps; do
|
||||
if ! command_exists "$_deps"; then
|
||||
if ! $_sudo $deb_pkger install "$_deps" --assume-yes; then
|
||||
echo_error "$_deps - failed to install"
|
||||
fi
|
||||
else
|
||||
echo_note "$_deps - was already installed"
|
||||
fi
|
||||
done
|
||||
|
||||
i_yazi
|
||||
}
|
||||
|
||||
inst_ubuntu() {
|
||||
comment_cd_sources
|
||||
check_nala
|
||||
if command_exists nano; then
|
||||
if command_exists vi; then
|
||||
echo_note "Removing nano"
|
||||
$_sudo $deb_pkger remove nano --assume-yes
|
||||
else
|
||||
echo_note "Removing nano and installing vi as a backup"
|
||||
$_sudo $deb_pkger remove nano --assume-yes && $_sudo apt-get install vi --assume-yes
|
||||
fi
|
||||
fi
|
||||
|
||||
echo_note "Installing base packages: $deps"
|
||||
for _deps in $deps; do
|
||||
if ! command_exists "$_deps"; then
|
||||
if ! $_sudo $deb_pkger install "$_deps" --assume-yes; then
|
||||
echo_error "$_deps - failed to install"
|
||||
fi
|
||||
else
|
||||
echo_note "$_deps - was already installed"
|
||||
fi
|
||||
done
|
||||
|
||||
i_yazi
|
||||
}
|
||||
|
||||
inst_fedora() {
|
||||
if command_exists nano; then
|
||||
if command_exists vi; then
|
||||
echo_note "Removing nano"
|
||||
$_sudo dnf remove nano </dev/tty
|
||||
else
|
||||
echo_note "Removing nano and installing vi as a backup"
|
||||
$_sudo dnf remove nano </dev/tty &&
|
||||
$_sudo dnf install vi </dev/tty
|
||||
fi
|
||||
fi
|
||||
|
||||
echo_note "Installing base packages: $deps"
|
||||
for _deps in $deps; do
|
||||
if ! command_exists "$_deps"; then
|
||||
if ! $_sudo dnf install "$_deps" </dev/tty; then
|
||||
echo_error "$_deps - failed to install"
|
||||
fi
|
||||
else
|
||||
echo_note "$_deps - was already installed"
|
||||
fi
|
||||
done
|
||||
|
||||
i_yazi
|
||||
}
|
||||
|
||||
inst_opensuse() {
|
||||
if command_exists nano; then
|
||||
if command_exists vi; then
|
||||
echo_note "Removing nano"
|
||||
$_sudo zypper install -y nano </dev/tty
|
||||
else
|
||||
echo_note "Removing nano and installing vi as a backup"
|
||||
$_sudo zypper install -y vi </dev/tty
|
||||
fi
|
||||
fi
|
||||
|
||||
echo_note "Installing base packages: $deps"
|
||||
for _deps in $deps; do
|
||||
if ! command_exists "$_deps"; then
|
||||
if ! $_sudo zypper in -y "$_deps" </dev/tty; then
|
||||
echo_error "$_deps - failed to install"
|
||||
fi
|
||||
else
|
||||
echo_note "$_deps - was already installed"
|
||||
fi
|
||||
done
|
||||
|
||||
i_yazi
|
||||
}
|
||||
|
||||
inst_arch() {
|
||||
if command_exists nano; then
|
||||
if command_exists vi; then
|
||||
echo_note "Removing nano"
|
||||
$_sudo pacman -R nano --noconfirm
|
||||
else
|
||||
echo_note "Removing nano and installing vi as a backup"
|
||||
$_sudo pacman -S vi --noconfirm
|
||||
fi
|
||||
fi
|
||||
|
||||
$_sudo pacman -S base-devel --noconfirm
|
||||
echo_note "Installing base packages: $deps"
|
||||
for _deps in $deps; do
|
||||
if ! command_exists "$_deps"; then
|
||||
if ! $_sudo pacman -S "$_deps" --noconfirm; then
|
||||
echo_error "$_deps - failed to install"
|
||||
fi
|
||||
else
|
||||
echo_note "$_deps - was already installed"
|
||||
fi
|
||||
done
|
||||
|
||||
i_yazi
|
||||
}
|
||||
|
||||
# ─< Distribution detection and installation >────────────────────────────────────────
|
||||
get_packager() {
|
||||
if [ -e /etc/os-release ]; then
|
||||
echo_info "Detecting distribution..."
|
||||
. /etc/os-release
|
||||
|
||||
# Convert $ID and $ID_LIKE to lowercase
|
||||
ID=$(printf "%s" "$ID" | tr '[:upper:]' '[:lower:]')
|
||||
ID_LIKE=$(printf "%s" "$ID_LIKE" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
case "$ID" in
|
||||
ubuntu | pop | zorin) inst_ubuntu ;;
|
||||
debian) inst_debian ;;
|
||||
fedora) inst_fedora ;;
|
||||
alpine) inst_alpine ;;
|
||||
arch | manjaro | garuda | endeavour) inst_arch ;;
|
||||
opensuse*) inst_opensuse ;;
|
||||
*)
|
||||
# Use standard [ ] syntax for string matching
|
||||
if [ "${ID_LIKE#*debian}" != "$ID_LIKE" ]; then
|
||||
inst_debian
|
||||
elif [ "${ID_LIKE#*ubuntu}" != "$ID_LIKE" ]; then
|
||||
inst_ubuntu
|
||||
elif [ "${ID_LIKE#*arch}" != "$ID_LIKE" ]; then
|
||||
inst_arch
|
||||
elif [ "${ID_LIKE#*fedora}" != "$ID_LIKE" ]; then
|
||||
inst_fedora
|
||||
elif [ "${ID_LIKE#*suse}" != "$ID_LIKE" ]; then
|
||||
inst_opensuse
|
||||
else
|
||||
echo_error "Unsupported distribution: $ID"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo_error "Unable to detect distribution. /etc/os-release not found."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Improved display function that only shows categories with content
|
||||
display_stored_messages() {
|
||||
has_messages=0
|
||||
|
||||
# First check if we have any messages at all
|
||||
if [ -z "$_STORED_ERRORS" ] && [ -z "$_STORED_WARNINGS" ] && [ -z "$_STORED_INFOS" ] && [ -z "$_STORED_NOTES" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Now display each non-empty category with proper spacing
|
||||
if [ -n "$_STORED_ERRORS" ]; then
|
||||
printf "\n${BOLD}${RED}=== Errors ===${NC}\n"
|
||||
printf "$_STORED_ERRORS"
|
||||
has_messages=1
|
||||
fi
|
||||
|
||||
if [ -n "$_STORED_WARNINGS" ]; then
|
||||
[ "$has_messages" -eq 1 ] && printf "\n"
|
||||
printf "${BOLD}${YELLOW}=== Warnings ===${NC}\n"
|
||||
printf "$_STORED_WARNINGS"
|
||||
has_messages=1
|
||||
fi
|
||||
|
||||
if [ -n "$_STORED_INFOS" ]; then
|
||||
[ "$has_messages" -eq 1 ] && printf "\n"
|
||||
printf "${BOLD}${CYAN}=== Info ===${NC}\n"
|
||||
printf "$_STORED_INFOS"
|
||||
has_messages=1
|
||||
fi
|
||||
|
||||
if [ -n "$_STORED_NOTES" ]; then
|
||||
[ "$has_messages" -eq 1 ] && printf "\n"
|
||||
printf "${BOLD}${LIGHT_GREEN}=== Notes ===${NC}\n"
|
||||
printf "$_STORED_NOTES"
|
||||
fi
|
||||
}
|
||||
|
||||
_inst_docker() {
|
||||
if ! command_exists docker; then
|
||||
bash --norc -c "$(curl -fsSL https://git.k4li.de/pika/scripts/raw/branch/main/bash/installs/docker.sh)"
|
||||
else
|
||||
echo_note "Docker is already installed, do you need to activate it and make the group changes for $(whoami)? (y/n): "
|
||||
read -r _docker
|
||||
case "$_docker" in
|
||||
N | n)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
$_sudo systemctl enable --now docker &&
|
||||
$_sudo usermod -aG docker "$(whoami)"
|
||||
echo_info "Docker was configured"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
_inst_lazydocker() {
|
||||
if [ ! -e "$HOME/.local/bin/lazydocker" ]; then
|
||||
if command_exists curl; then
|
||||
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
|
||||
else
|
||||
echo_error "curl is not installed, cannot continue!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo_warning "$HOME/.local/bin/lazydocker is already present."
|
||||
fi
|
||||
_dashboard
|
||||
}
|
||||
|
||||
_check_gitpath() {
|
||||
if [ ! -d "$HOME/git/" ]; then
|
||||
mkdir $HOME/git
|
||||
else
|
||||
echo_note "git dir is already present"
|
||||
fi
|
||||
}
|
||||
|
||||
_ytgo() {
|
||||
if ! command_exists go; then
|
||||
if ! install_pkg golang; then
|
||||
echo_error "Something went wrong, couldn't install golang"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command_exists ytgo; then
|
||||
cd "$(mktemp --dir)"
|
||||
git clone --depth=1 https://git.k4li.de/pika/ytgo.git
|
||||
cd ytgo
|
||||
make install
|
||||
else
|
||||
echo_info "ytgo is already present at $(whereis ytgo)"
|
||||
fi
|
||||
}
|
||||
|
||||
_init_dotfiles() {
|
||||
_check_gitpath
|
||||
echo_db "What dotfiles do you want to clone?
|
||||
1. homelab-dotfiles
|
||||
2. hyprdots
|
||||
3. tty-dotfiles
|
||||
q. Quit"
|
||||
read -r _dotfiles_db
|
||||
case "$_dotfiles_db" in
|
||||
1)
|
||||
git clone --recursive --depth=1 https://git.k4li.de/dotfiles/homelab-dotfiles.git $HOME/git/homelab-dotfiles
|
||||
;;
|
||||
2)
|
||||
git clone --recursive --depth=1 https://git.k4li.de/dotfiles/hyprdots.git $HOME/git/hyprdots
|
||||
;;
|
||||
3)
|
||||
git clone --recursive --depth=1 https://git.k4li.de/dotfiles/tty-dotfiles.git $HOME/git/tty-dotfiles
|
||||
;;
|
||||
q)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
echo default
|
||||
;;
|
||||
esac
|
||||
_dashboard
|
||||
}
|
||||
|
||||
_dashboard() {
|
||||
echo_db "What else can I do for you?
|
||||
1. Docker installation
|
||||
2. Dotfile initialization
|
||||
3. lazydocker installation
|
||||
4. ytgo
|
||||
q. Quit"
|
||||
read -r _db </dev/tty
|
||||
case "$_db" in
|
||||
1)
|
||||
_inst_docker
|
||||
;;
|
||||
2)
|
||||
_init_dotfiles
|
||||
;;
|
||||
3)
|
||||
_inst_lazydocker
|
||||
;;
|
||||
4)
|
||||
_ytgo
|
||||
;;
|
||||
q)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main() {
|
||||
# set -x
|
||||
if check_root; then
|
||||
get_packager
|
||||
_dashboard
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
33
core/tabs/system-setup/remove-snaps.sh
Normal file
33
core/tabs/system-setup/remove-snaps.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
removeSnaps() {
|
||||
if command_exists snap; then
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Rns snapd
|
||||
;;
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" autoremove --purge snapd
|
||||
if [ "$ID" = ubuntu ]; then
|
||||
"$ESCALATION_TOOL" apt-mark hold snapd
|
||||
fi
|
||||
;;
|
||||
dnf|zypper)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
printf "%b\n" "${GREEN}Successfully removed snaps.${RC}"
|
||||
else
|
||||
printf "%b\n" "${GREEN}Snapd is not installed.${RC}"
|
||||
fi
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
removeSnaps
|
71
core/tabs/system-setup/system-cleanup.sh
Executable file
71
core/tabs/system-setup/system-cleanup.sh
Executable file
|
@ -0,0 +1,71 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
cleanup_system() {
|
||||
printf "%b\n" "${YELLOW}Performing system cleanup...${RC}"
|
||||
case "$PACKAGER" in
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" clean
|
||||
"$ESCALATION_TOOL" "$PACKAGER" autoremove -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" autoclean
|
||||
"$ESCALATION_TOOL" du -h /var/cache/apt
|
||||
"$ESCALATION_TOOL" "$PACKAGER" clean
|
||||
;;
|
||||
zypper)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" clean -a
|
||||
"$ESCALATION_TOOL" "$PACKAGER" tidy
|
||||
"$ESCALATION_TOOL" "$PACKAGER" cc -a
|
||||
;;
|
||||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" clean all
|
||||
"$ESCALATION_TOOL" "$PACKAGER" autoremove -y
|
||||
;;
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}. Skipping.${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
common_cleanup() {
|
||||
if [ -d /var/tmp ]; then
|
||||
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete
|
||||
fi
|
||||
if [ -d /tmp ]; then
|
||||
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete
|
||||
fi
|
||||
if [ -d /var/log ]; then
|
||||
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
|
||||
fi
|
||||
"$ESCALATION_TOOL" journalctl --vacuum-time=3d
|
||||
}
|
||||
|
||||
clean_data() {
|
||||
printf "%b" "${YELLOW}Clean up old cache files and empty the trash? (y/N): ${RC}"
|
||||
read -r clean_response
|
||||
case $clean_response in
|
||||
y|Y)
|
||||
printf "%b\n" "${YELLOW}Cleaning up old cache files and emptying trash...${RC}"
|
||||
if [ -d "$HOME/.cache" ]; then
|
||||
find "$HOME/.cache/" -type f -atime +5 -delete
|
||||
fi
|
||||
if [ -d "$HOME/.local/share/Trash" ]; then
|
||||
find "$HOME/.local/share/Trash" -mindepth 1 -delete
|
||||
fi
|
||||
printf "%b\n" "${GREEN}Cache and trash cleanup completed.${RC}"
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${YELLOW}Skipping cache and trash cleanup.${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
cleanup_system
|
||||
common_cleanup
|
||||
clean_data
|
106
core/tabs/system-setup/system-update.sh
Executable file
106
core/tabs/system-setup/system-update.sh
Executable file
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
fastUpdate() {
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
|
||||
$AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
|
||||
|
||||
printf "%b\n" "${YELLOW}Generating a new list of mirrors using rate-mirrors. This process may take a few seconds...${RC}"
|
||||
|
||||
if [ -s /etc/pacman.d/mirrorlist ]; then
|
||||
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
|
||||
fi
|
||||
|
||||
# If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail
|
||||
dtype_local=${DTYPE}
|
||||
if [ "${DTYPE}" = "unknown" ]; then
|
||||
dtype_local="arch"
|
||||
fi
|
||||
|
||||
"$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local}
|
||||
if [ $? -ne 0 ] || [ ! -s /etc/pacman.d/mirrorlist ]; then
|
||||
printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}"
|
||||
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
|
||||
fi
|
||||
;;
|
||||
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" apt-get update
|
||||
if ! command_exists nala; then
|
||||
"$ESCALATION_TOOL" apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; }
|
||||
fi
|
||||
|
||||
if [ "$PACKAGER" = "nala" ]; then
|
||||
"$ESCALATION_TOOL" cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||
"$ESCALATION_TOOL" nala update
|
||||
PACKAGER="nala"
|
||||
fi
|
||||
|
||||
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||
;;
|
||||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update -y
|
||||
;;
|
||||
zypper)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" ref
|
||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
updateSystem() {
|
||||
printf "%b\n" "${GREEN}Updating system${RC}"
|
||||
case "$PACKAGER" in
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||
;;
|
||||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update -y
|
||||
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
|
||||
;;
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Su --noconfirm
|
||||
;;
|
||||
zypper)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" ref
|
||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
updateFlatpaks() {
|
||||
if command_exists flatpak; then
|
||||
printf "%b\n" "${YELLOW}Updating installed Flathub apps...${RC}"
|
||||
installed_apps=$(flatpak list --app --columns=application)
|
||||
|
||||
if [ -z "$installed_apps" ]; then
|
||||
printf "%b\n" "${RED}No Flathub apps are installed.${RC}"
|
||||
return
|
||||
fi
|
||||
|
||||
for app in $installed_apps; do
|
||||
printf "%b\n" "${YELLOW}Updating $app...${RC}"
|
||||
flatpak update -y "$app"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkAURHelper
|
||||
checkEscalationTool
|
||||
fastUpdate
|
||||
updateSystem
|
||||
updateFlatpaks
|
102
core/tabs/system-setup/tab_data.toml
Normal file
102
core/tabs/system-setup/tab_data.toml
Normal file
|
@ -0,0 +1,102 @@
|
|||
name = "System Setup"
|
||||
multi_selectable = false
|
||||
|
||||
[[data]]
|
||||
name = "Arch Linux"
|
||||
|
||||
[[data.preconditions]]
|
||||
matches = true
|
||||
data = "command_exists"
|
||||
values = ["pacman"]
|
||||
|
||||
[[data.entries]]
|
||||
name = "Arch Server Setup"
|
||||
description = "This command installs a minimal arch server setup under 5 minutes."
|
||||
script = "arch/server-setup.sh"
|
||||
task_list = "SI D"
|
||||
|
||||
[[data.entries]]
|
||||
name = "Paru AUR Helper"
|
||||
description = "Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
|
||||
script = "arch/paru-setup.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data.entries]]
|
||||
name = "Yay AUR Helper"
|
||||
description = "Yet Another Yogurt - An AUR Helper Written in Go.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
|
||||
script = "arch/yay-setup.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data]]
|
||||
name = "Fedora"
|
||||
|
||||
[[data.preconditions]]
|
||||
matches = true
|
||||
data = "command_exists"
|
||||
values = ["dnf"]
|
||||
|
||||
[[data.entries]]
|
||||
name = "Configure DNF"
|
||||
description = "Optimizes DNF for parallel downloads"
|
||||
script = "fedora/configure-dnf.sh"
|
||||
task_list = "PFM"
|
||||
|
||||
[[data.entries]]
|
||||
name = "Multimedia Codecs"
|
||||
description = "This script is designed to install multimedia codecs, and to ensure RPM Fusion repositories are installed."
|
||||
script = "fedora/multimedia-codecs.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data.entries]]
|
||||
name = "Nvidia Proprietary Drivers"
|
||||
description = "This script is designed to download the proprietary NVIDIA drivers in Fedora."
|
||||
script = "fedora/nvidia-proprietary-driver-setup.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data.entries]]
|
||||
name = "RPM Fusion"
|
||||
description = "RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship.\nThat software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit.\nFor more information visit: https://rpmfusion.org/"
|
||||
script = "fedora/rpm-fusion-setup.sh"
|
||||
task_list = "MP"
|
||||
|
||||
[[data.entries]]
|
||||
name = "Virtualization"
|
||||
description = "Enables Virtualization through dnf"
|
||||
script = "fedora/virtualization.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data]]
|
||||
name = "Full System Cleanup"
|
||||
description = "This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash."
|
||||
script = "system-cleanup.sh"
|
||||
task_list = "RP PFM"
|
||||
|
||||
[[data]]
|
||||
name = "Full System Update"
|
||||
description = "This command updates your system to the latest packages available for your distro"
|
||||
script = "system-update.sh"
|
||||
task_list = "PFM"
|
||||
|
||||
[[data]]
|
||||
name = "Gaming Dependencies"
|
||||
description = "This script is designed to handle the installation of gaming dependencies across different Linux distributions"
|
||||
script = "gaming-setup.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data]]
|
||||
name = "Postinstallation Script"
|
||||
description = "This script is designed to handle the installation of various software dependencies across different Linux distributions"
|
||||
script = "postinstall.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data]]
|
||||
name = "Remove Snaps"
|
||||
description = "This script is designed to remove snap"
|
||||
script = "remove-snaps.sh"
|
||||
task_list = "RP"
|
||||
|
||||
[[data]]
|
||||
name = "TTY Fonts"
|
||||
description = "This Script will set the default TTY font to Terminus size 32 Bold"
|
||||
script = "terminus-tty.sh"
|
||||
task_list = "I PFM"
|
66
core/tabs/system-setup/terminus-tty.sh
Executable file
66
core/tabs/system-setup/terminus-tty.sh
Executable file
|
@ -0,0 +1,66 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
InstallTermiusFonts() {
|
||||
if [ ! -f "/usr/share/kbd/consolefonts/ter-c18b.psf.gz" ] &&
|
||||
[ ! -f "/usr/share/consolefonts/Uni3-TerminusBold18x10.psf.gz" ] &&
|
||||
[ ! -f "/usr/lib/kbd/consolefonts/ter-p32n.psf.gz" ]; then
|
||||
printf "%b\n" "${YELLOW}Installing Terminus Fonts...${RC}"
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm terminus-font
|
||||
;;
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y fonts-terminus
|
||||
;;
|
||||
dnf)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y terminus-fonts-console
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
printf "%b\n" "${GREEN}Terminus Fonts is already installed.${RC}"
|
||||
fi
|
||||
}
|
||||
|
||||
SetTermiusFonts() {
|
||||
case "$DTYPE" in
|
||||
arch)
|
||||
printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}"
|
||||
"$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
"$ESCALATION_TOOL" setfont -C /dev/tty1 ter-v32b
|
||||
fi
|
||||
printf "%b\n" "${GREEN}Terminus font set for TTY.${RC}"
|
||||
;;
|
||||
debian)
|
||||
|
||||
printf "%b\n" "${YELLOW}Updating console-setup configuration...${RC}"
|
||||
"$ESCALATION_TOOL" sed -i 's/^CODESET=.*/CODESET="guess"/' /etc/default/console-setup
|
||||
"$ESCALATION_TOOL" sed -i 's/^FONTFACE=.*/FONTFACE="TerminusBold"/' /etc/default/console-setup
|
||||
"$ESCALATION_TOOL" sed -i 's/^FONTSIZE=.*/FONTSIZE="16x32"/' /etc/default/console-setup
|
||||
printf "%b\n" "${GREEN}Console-setup configuration updated for Terminus font.${RC}"
|
||||
# Editing console-setup requires initramfs to be regenerated
|
||||
"$ESCALATION_TOOL" update-initramfs -u
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
"$ESCALATION_TOOL" setfont -C /dev/tty1 /usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz
|
||||
fi
|
||||
printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}"
|
||||
;;
|
||||
fedora)
|
||||
printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}"
|
||||
"$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
"$ESCALATION_TOOL" setfont -C /dev/tty1 ter-v32b
|
||||
fi
|
||||
printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
InstallTermiusFonts
|
||||
SetTermiusFonts
|
Loading…
Add table
Add a link
Reference in a new issue