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
##########################
# Color helpers
# Color helpers (no tput)
##########################
tput_reset() { tput sgr0; }
tput_black() { tput setaf 0; }
tput_red() { tput setaf 1; }
tput_green() { tput setaf 2; }
tput_yellow() { tput setaf 3; }
tput_blue() { tput setaf 4; }
tput_purple() { tput setaf 5; }
tput_cyan() { tput setaf 6; }
tput_gray() { tput setaf 7; }
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'
# Disable colors if output is not a terminal
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
@@ -23,233 +31,163 @@ DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
tput_cyan
color_cyan
echo
echo "Starting Arch Linux setup..."
tput_reset
color_reset
echo
echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
##########################
# 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)"
# Installing chaotic-aur keys and mirrors
pkg_dir="packages"
# Ensure directory exists
if [[ ! -d "$pkg_dir" ]]; then
echo "Directory not found: $pkg_dir"
exit 1
fi
if ! command -v curl >/dev/null 2>&1; then
tput_yellow
color_yellow
echo
echo "curl is not installed. Installing..."
tput_reset
sudo pacman -Sy
sudo sudo pacman -S --noconfirm --needed curl
color_reset
sudo pacman -Sy --noconfirm curl
fi
# Install all local packages using pacman
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 "Checking /etc/apt/sources.list for contrib/non-free..."
tput_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
tput_green
echo "Checking pacman.conf and sources..."
color_reset
sudo cp /etc/pacman.conf /etc/pacman.conf.bak.$(date +%s)
sudo cp -v "$installed_dir/config-files/pacman.conf" /etc/pacman.conf
# Update the system
color_green
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 "Updating the system - sudo pacman -Syyu"
echo "################################################################################"
tput sgr0
color_reset
echo
sudo pacman -Syyu --noconfirm
# fix missing console font
##########################
# Fix missing console font
##########################
color_yellow
echo
tput setaf 3
echo "################################################################"
echo "################### fix missing console font"
echo "Fix missing console font"
echo "################################################################"
tput sgr0
echo
color_reset
if grep -q FONT= /etc/vconsole.conf; then
color_green
echo
tput setaf 2
echo "################################################################"
echo "################### FONT is already set in /etc/vconsole.conf"
echo "################################################################"
tput sgr0
echo
echo "Font is already set in /etc/vconsole.conf"
color_reset
else
tput setaf 2
echo "################################################################"
echo "################### FONT added to /etc/vconsole.conf"
echo "################################################################"
tput sgr0
echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf
color_green
echo
echo "Setting console font in /etc/vconsole.conf"
color_reset
echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf
fi
##########################
# Detected OS / DE / TWM info
##########################
color_yellow
echo
tput_yellow
echo "################################################################################"
echo "################### Detected OS / Desktop Environmet / Tiling Window Manager"
echo "Detected OS / Desktop Environment / Tiling Window Manager"
echo "################################################################################"
tput_reset
color_reset
echo
echo "Installing OS-specific packages..."
echo "Selected DE: $SELECTED_DE"
echo "Selected TWM: $SELECTED_TWM"
echo "Selected DE: $DE"
echo "Selected TWM: $TWM"
echo "Installation Level: $INSTALL_LEVEL"
if [[ "$SELECTED_DE" == "xfce" ]]; then
# Desktop Environment installation
if [[ "$DE" == "xfce" ]]; then
color_green
echo
tput_green
echo "################################################################################"
echo "################### Installing XFCE4"
echo "Installing XFCE4"
echo "################################################################################"
tput_reset
echo
color_reset
echo "Installing XFCE packages..."
fi
if [[ "$SELECTED_DE" == "plasma" ]]; then
if [[ "$DE" == "plasma" ]]; then
color_green
echo
tput_green
echo "################################################################################"
echo "################### Installing KDE Plasma 6"
echo "Installing KDE Plasma 6"
echo "################################################################################"
tput_reset
echo
color_reset
echo "Installing Plasma packages..."
fi
if [[ "$SELECTED_DE" == "gnome" ]]; then
if [[ "$DE" == "gnome" ]]; then
color_green
echo
tput_green
echo "################################################################################"
echo "################### Installing Gnome 48"
echo "Installing Gnome 48"
echo "################################################################################"
tput_reset
echo
color_reset
echo "Installing Gnome packages..."
fi
if [[ "$SELECTED_DE" == "none" ]]; then
if [[ "$DE" == "none" ]]; then
color_green
echo
tput_green
echo "################################################################################"
echo "################### Installing no Desktop Environment"
echo "Installing no Desktop Environment"
echo "################################################################################"
tput_reset
echo
color_reset
echo "Installing no Desktop Environment packages..."
fi
if [[ "$SELECTED_TWM" == "chadwm" ]]; then
# Tiling Window Manager installation
if [[ "$TWM" == "chadwm" ]]; then
color_green
echo
tput_green
echo "################################################################################"
echo "################### Installing Chadwm"
echo "Installing Chadwm"
echo "################################################################################"
tput_reset
echo
color_reset
echo "Installing CHADWM..."
fi
if [[ "$SELECTED_TWM" == "hyprland" ]]; then
if [[ "$TWM" == "hyprland" ]]; then
color_green
echo
tput_green
echo "################################################################################"
echo "################### Installing Hyprland"
echo "Installing Hyprland"
echo "################################################################################"
tput_reset
echo
echo "Installing Hyperland..."
color_reset
echo "Installing Hyprland..."
fi
if [[ "$SELECTED_TWM" == "none" ]]; then
if [[ "$TWM" == "none" ]]; then
color_green
echo
tput_green
echo "################################################################################"
echo "################### Installing no Tiling Window Manager"
echo "Installing no Tiling Window Manager"
echo "################################################################################"
tput_reset
echo
color_reset
echo "Installing no Tiling Window Manager packages..."
fi