updated arch to same standards

This commit is contained in:
[yuri]
2025-11-10 11:06:08 +01:00
parent 982c713a71
commit 3481a0cb44

View File

@@ -2,17 +2,25 @@
set -euo pipefail set -euo pipefail
########################## ##########################
# Color helpers # Color helpers (no tput)
########################## ##########################
tput_reset() { tput sgr0; } RED='\033[0;31m'
tput_black() { tput setaf 0; } GREEN='\033[0;32m'
tput_red() { tput setaf 1; } YELLOW='\033[0;33m'
tput_green() { tput setaf 2; } CYAN='\033[0;36m'
tput_yellow() { tput setaf 3; } BOLD='\033[1m'
tput_blue() { tput setaf 4; } RESET='\033[0m'
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; } # Disable colors if output is not a terminal
tput_gray() { tput setaf 7; } if [ ! -t 1 ]; then
RED='' GREEN='' YELLOW='' CYAN='' BOLD='' RESET=''
fi
color_red() { printf '%b' "$RED"; }
color_green() { printf '%b' "$GREEN"; }
color_yellow() { printf '%b' "$YELLOW"; }
color_cyan() { printf '%b' "$CYAN"; }
color_reset() { printf '%b' "$RESET"; }
########################## ##########################
# Use exported variables from main detection script # Use exported variables from main detection script
@@ -23,233 +31,163 @@ DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}" TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
tput_cyan color_cyan
echo echo
echo "Starting Arch Linux setup..." echo "Starting Arch Linux setup..."
tput_reset color_reset
echo echo
echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
########################## ##########################
# 0. Ensure base is ready for installation # 0. Ensure base is ready for installation
########################## ##########################
# Setting installed_dir to base folder of the git-repository
installed_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" installed_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Installing chaotic-aur keys and mirrors
pkg_dir="packages" pkg_dir="packages"
# Ensure directory exists
if [[ ! -d "$pkg_dir" ]]; then if [[ ! -d "$pkg_dir" ]]; then
echo "Directory not found: $pkg_dir" echo "Directory not found: $pkg_dir"
exit 1 exit 1
fi fi
if ! command -v curl >/dev/null 2>&1; then if ! command -v curl >/dev/null 2>&1; then
tput_yellow color_yellow
echo echo
echo "curl is not installed. Installing..." echo "curl is not installed. Installing..."
tput_reset color_reset
sudo pacman -Sy sudo pacman -Sy --noconfirm curl
sudo sudo pacman -S --noconfirm --needed curl
fi fi
# Install all local packages using pacman # Install all local packages using pacman
find "$pkg_dir" -maxdepth 1 -name '*.pkg.tar.zst' -print0 | sudo xargs -0 pacman -U --noconfirm find "$pkg_dir" -maxdepth 1 -name '*.pkg.tar.zst' -print0 | sudo xargs -0 pacman -U --noconfirm
########################## ##########################
# 1. Add repsotirories if missing # 1. Add repositories if missing
########################## ##########################
tput_yellow color_yellow
echo echo
echo "Checking /etc/apt/sources.list for contrib/non-free..." echo "Checking pacman.conf and sources..."
tput_reset color_reset
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak.$(date +%s)
sudo sed -i -r 's/^(deb\s+\S+\s+\S+)\s+(main)$/\1 main contrib non-free/' /etc/apt/sources.list sudo cp /etc/pacman.conf /etc/pacman.conf.bak.$(date +%s)
tput_green sudo cp -v "$installed_dir/config-files/pacman.conf" /etc/pacman.conf
# Update the system
color_green
echo echo
echo "Updated sources.list to include contrib/non-free where needed."
tput_reset
# personal pacman.conf
if [[ ! -f /etc/pacman.conf.starburst ]]; then
echo
tput setaf 2
echo "################################################################################"
echo "Copying /etc/pacman.conf to /etc/pacman.conf.starburst"
echo "################################################################################"
tput sgr0
echo
sudo cp -v /etc/pacman.conf /etc/pacman.conf.starburst
echo
else
echo
tput setaf 2
echo "################################################################################"
echo "Backup already exists: /etc/pacman.conf.starburst"
echo "################################################################################"
tput sgr0
echo
fi
sudo cp -v $installed_dir/config-files/pacman.conf /etc/pacman.conf
# update the system
echo
tput setaf 2
echo "################################################################################" echo "################################################################################"
echo "Updating the system - sudo pacman -Syyu" echo "Updating the system - sudo pacman -Syyu"
echo "################################################################################" echo "################################################################################"
tput sgr0 color_reset
echo echo
sudo pacman -Syyu --noconfirm sudo pacman -Syyu --noconfirm
# fix missing console font ##########################
# Fix missing console font
##########################
color_yellow
echo echo
tput setaf 3
echo "################################################################" echo "################################################################"
echo "################### fix missing console font" echo "Fix missing console font"
echo "################################################################" echo "################################################################"
tput sgr0 color_reset
echo
if grep -q FONT= /etc/vconsole.conf; then if grep -q FONT= /etc/vconsole.conf; then
color_green
echo echo
tput setaf 2 echo "Font is already set in /etc/vconsole.conf"
echo "################################################################" color_reset
echo "################### FONT is already set in /etc/vconsole.conf"
echo "################################################################"
tput sgr0
echo
else else
color_green
tput setaf 2 echo
echo "################################################################" echo "Setting console font in /etc/vconsole.conf"
echo "################### FONT added to /etc/vconsole.conf" color_reset
echo "################################################################" echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf
tput sgr0
echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf
fi fi
##########################
# Detected OS / DE / TWM info
##########################
color_yellow
echo echo
tput_yellow
echo "################################################################################" echo "################################################################################"
echo "################### Detected OS / Desktop Environmet / Tiling Window Manager" echo "Detected OS / Desktop Environment / Tiling Window Manager"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo echo
echo "Installing OS-specific packages..." echo "Installing OS-specific packages..."
echo "Selected DE: $SELECTED_DE" echo "Selected DE: $DE"
echo "Selected TWM: $SELECTED_TWM" echo "Selected TWM: $TWM"
echo "Installation Level: $INSTALL_LEVEL" echo "Installation Level: $INSTALL_LEVEL"
if [[ "$SELECTED_DE" == "xfce" ]]; then # Desktop Environment installation
if [[ "$DE" == "xfce" ]]; then
color_green
echo echo
tput_green
echo "################################################################################" echo "################################################################################"
echo "################### Installing XFCE4" echo "Installing XFCE4"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo
echo "Installing XFCE packages..." echo "Installing XFCE packages..."
fi fi
if [[ "$SELECTED_DE" == "plasma" ]]; then if [[ "$DE" == "plasma" ]]; then
color_green
echo echo
tput_green
echo "################################################################################" echo "################################################################################"
echo "################### Installing KDE Plasma 6" echo "Installing KDE Plasma 6"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo
echo "Installing Plasma packages..." echo "Installing Plasma packages..."
fi fi
if [[ "$SELECTED_DE" == "gnome" ]]; then if [[ "$DE" == "gnome" ]]; then
color_green
echo echo
tput_green
echo "################################################################################" echo "################################################################################"
echo "################### Installing Gnome 48" echo "Installing Gnome 48"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo
echo "Installing Gnome packages..." echo "Installing Gnome packages..."
fi fi
if [[ "$SELECTED_DE" == "none" ]]; then if [[ "$DE" == "none" ]]; then
color_green
echo echo
tput_green
echo "################################################################################" echo "################################################################################"
echo "################### Installing no Desktop Environment" echo "Installing no Desktop Environment"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo
echo "Installing no Desktop Environment packages..." echo "Installing no Desktop Environment packages..."
fi fi
# Tiling Window Manager installation
if [[ "$SELECTED_TWM" == "chadwm" ]]; then if [[ "$TWM" == "chadwm" ]]; then
color_green
echo echo
tput_green
echo "################################################################################" echo "################################################################################"
echo "################### Installing Chadwm" echo "Installing Chadwm"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo
echo "Installing CHADWM..." echo "Installing CHADWM..."
fi fi
if [[ "$SELECTED_TWM" == "hyprland" ]]; then if [[ "$TWM" == "hyprland" ]]; then
color_green
echo echo
tput_green
echo "################################################################################" echo "################################################################################"
echo "################### Installing Hyprland" echo "Installing Hyprland"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo echo "Installing Hyprland..."
echo "Installing Hyperland..."
fi fi
if [[ "$SELECTED_TWM" == "none" ]]; then if [[ "$TWM" == "none" ]]; then
color_green
echo echo
tput_green
echo "################################################################################" echo "################################################################################"
echo "################### Installing no Tiling Window Manager" echo "Installing no Tiling Window Manager"
echo "################################################################################" echo "################################################################################"
tput_reset color_reset
echo
echo "Installing no Tiling Window Manager packages..." echo "Installing no Tiling Window Manager packages..."
fi fi