arch started

This commit is contained in:
[yuri]
2025-11-11 16:45:42 +01:00
parent db28365a6c
commit 9a38c02135
4 changed files with 298 additions and 131 deletions

74
v2/arch-minimal.sh Executable file
View File

@@ -0,0 +1,74 @@
#!/bin/bash
set -euo pipefail
##########################
# Color helpers (printf-safe, no tput)
##########################
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
CYAN="\033[0;36m"
GRAY="\033[0;37m"
BOLD="\033[1m"
RESET="\033[0m"
# Disable colors if output is not a terminal
if [ ! -t 1 ]; then
RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi
say_red() { printf "\n"; printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "\n"; printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "\n"; printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "\n"; printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "\n"; printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "\n"; printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
##########################
# Use exported variables from main detection script
##########################
OS="${DETECTED_OS:-debian}"
DDE="${DETECTED_DE}"
DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
##########################
# Helper functions
##########################
install_packages() { sudo pacman -Sy; sudo pacman -S --noconfirm --needed "$1"; }
is_package_installed() { pacman -Qi "$1" &>/dev/null; }
remove_packages() { sudo pacman -Rs --noconfirm "$1"; }
say_yellow "Starting minimal setup..."
# Create user directories
mkdir -p "$HOME"/{.bin,.fonts,.icons,.themes,DATA} "$HOME/.local/share/"{icons,themes,applications} "$HOME/.config/"{autostart,gtk-{3.0,4.0},variety,fish,neofetch}
# Install essential tools
install_packages wget curl nano fastfetch lolcat bash-completion starship alacritty hwinfo lshw man-db tree xdg-user-dirs rsync time bat chrony unzip chromium
# Optionally handle fonts
FONT_DIR="$HOME/.local/share/fonts"
FONT_NAME="RobotoMonoNerdFont" # Changed name to reflect the installed files
FONT_ZIP="/tmp/RobotoMono.zip" # Use original ZIP name for download
DOWNLOAD_NAME="RobotoMono"
if ! find "$FONT_DIR" -name "${FONT_NAME}*.ttf" -print -quit 2>/dev/null; then
say_yellow "Installing ${DOWNLOAD_NAME} Nerd Font..."
mkdir -p "$FONT_DIR"
curl -L "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${DOWNLOAD_NAME}.zip" -o "$FONT_ZIP"
unzip -oq "$FONT_ZIP" -d "$FONT_DIR"
fc-cache -fv
rm "$FONT_ZIP"
say_green "${DOWNLOAD_NAME} installed."
else
say_yellow "${DOWNLOAD_NAME} Nerd Font is already installed in $FONT_DIR. Skipping installation."
fi
# Enable basic services
sudo systemctl enable chrony
sudo systemctl enable fstrim.timer
# End of script
say_green "Minimal setup completed."

108
v2/arch-xfce.sh Executable file
View File

@@ -0,0 +1,108 @@
#!/bin/bash
set -euo pipefail
##########################
# Color helpers (printf-safe, no tput)
##########################
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
CYAN="\033[0;36m"
GRAY="\033[0;37m"
BOLD="\033[1m"
RESET="\033[0m"
# Disable colors if output is not a terminal
if [ ! -t 1 ]; then
RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi
say_red() { printf "\n"; printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
say_green() { printf "\n"; printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
say_yellow() { printf "\n"; printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
say_cyan() { printf "\n"; printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
say_gray() { printf "\n"; printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "\n"; printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
##########################
# Use exported variables from main detection script
##########################
OS="${DETECTED_OS}"
DDE="${DETECTED_DE}"
DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
##########################
# Helper functions
##########################
install_packages() {
sudo pacman -S --noconfirm --needed "$1"
}
remove_packages() {
sudo pacman -Rs --noconfirm "$1"
}
is_package_installed() {
pacman -Qi "$1" &>/dev/null
}
detect_de() {
if command -v xfce4-session >/dev/null 2>&1; then
echo "xfce"
else
echo ""
fi
}
detect_display_manager() {
if [ -f /etc/X11/default-display-manager ]; then
basename "$(cat /etc/X11/default-display-manager)"
else
echo ""
fi
}
enable_graphical_target() {
sudo systemctl enable sddm
sudo systemctl set-default graphical.target
}
##########################
# Start installation
##########################
say_yellow -e "Starting XFCE installation..."
CURRENT_DE="$(detect_de)"
CURRENT_DM="$(detect_display_manager)"
if [[ -z "$CURRENT_DE" ]]; then
say_cyan -e "No Desktop Environment detected. Installing XFCE (light setup with SDDM)..."
install_packages sddm xfce4 xfce4-goodies
enable_graphical_target
say_green -e "XFCE with SDDM installed successfully. You can reboot now to start XFCE."
else
say_cyan -e "Detected existing Desktop Environment: $CURRENT_DE"
if [[ "$CURRENT_DM" == "lightdm" ]]; then
say_yellow -e "LightDM is currently active. Replacing with SDDM..."
sudo systemctl disable lightdm
sudo apt purge -y lightdm lightdm-gtk-greeter
install_packages sddm
enable_graphical_target
say_green -e "LightDM removed and replaced with SDDM."
else
say_cyan -e "Current display manager: ${CURRENT_DM:-none}. Leaving unchanged."
fi
fi
# End of script
say_green -e "XFCE / SDDM setup completed."

View File

@@ -2,25 +2,27 @@
set -euo pipefail set -euo pipefail
########################## ##########################
# Color helpers (no tput) # Color helpers (printf-safe, no tput)
########################## ##########################
RED='\033[0;31m' RED="\033[0;31m"
GREEN='\033[0;32m' GREEN="\033[0;32m"
YELLOW='\033[0;33m' YELLOW="\033[0;33m"
CYAN='\033[0;36m' CYAN="\033[0;36m"
BOLD='\033[1m' GRAY="\033[0;37m"
RESET='\033[0m' BOLD="\033[1m"
RESET="\033[0m"
# Disable colors if output is not a terminal # Disable colors if output is not a terminal
if [ ! -t 1 ]; then if [ ! -t 1 ]; then
RED='' GREEN='' YELLOW='' CYAN='' BOLD='' RESET='' RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
fi fi
color_red() { printf '%b' "$RED"; } say_red() { printf "\n"; printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
color_green() { printf '%b' "$GREEN"; } say_green() { printf "\n"; printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
color_yellow() { printf '%b' "$YELLOW"; } say_yellow() { printf "\n"; printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
color_cyan() { printf '%b' "$CYAN"; } say_cyan() { printf "\n"; printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
color_reset() { printf '%b' "$RESET"; } say_gray() { printf "\n"; printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
say_bold() { printf "\n"; printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
########################## ##########################
# Use exported variables from main detection script # Use exported variables from main detection script
@@ -30,13 +32,25 @@ DDE="${DETECTED_DE}"
DE="${SELECTED_DE:-none}" DE="${SELECTED_DE:-none}"
TWM="${SELECTED_TWM:-none}" TWM="${SELECTED_TWM:-none}"
INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}" INSTALL_LEVEL="${INSTALL_LEVEL:-minimal}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
color_cyan
echo echo
echo "Starting Arch Linux setup..." say_cyan "Starting Debian setup..."
color_reset
echo echo
echo "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL" say_gray "DE: $DE, TWM: $TWM, Install Level: $INSTALL_LEVEL"
##########################
# Helper functions
##########################
install_packages() {
local packages=("$@")
sudo apt update
sudo apt install -y --no-install-recommends "${packages[@]}"
}
is_package_installed() {
dpkg -s "$1" &>/dev/null
}
########################## ##########################
# 0. Ensure base is ready for installation # 0. Ensure base is ready for installation
@@ -45,149 +59,120 @@ installed_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
pkg_dir="packages" pkg_dir="packages"
if [[ ! -d "$pkg_dir" ]]; then if [[ ! -d "$pkg_dir" ]]; then
echo "Directory not found: $pkg_dir" say_red "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
color_yellow say_yellow "curl is not installed. Installing..."
echo sudo pacman -Sy
echo "curl is not installed. Installing..." install_packages curl
color_reset
sudo pacman -Sy --noconfirm 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 repositories if missing # 1. Add repositories if missing and update system
########################## ##########################
color_yellow say_yellow "Checking pacman.conf and sources..."
echo
echo "Checking pacman.conf and sources..."
color_reset
sudo cp /etc/pacman.conf /etc/pacman.conf.bak.$(date +%s) sudo cp /etc/pacman.conf /etc/pacman.conf.bak.$(date +%s)
sudo cp -v "$installed_dir/config-files/pacman.conf" /etc/pacman.conf sudo cp -v "$installed_dir/config-files/pacman.conf" /etc/pacman.conf
# Update the system # Update the system
color_green say_gray "Updating the system - sudo pacman -Syyu"
echo
echo "################################################################################"
echo "Updating the system - sudo pacman -Syyu"
echo "################################################################################"
color_reset
echo echo
sudo pacman -Syyu --noconfirm sudo pacman -Syyu --noconfirm
########################## ##########################
# Fix missing console font # 2. Fix missing console font
########################## ##########################
color_yellow say_yellow "Fix missing console font"
echo
echo "################################################################"
echo "Fix missing console font"
echo "################################################################"
color_reset
if grep -q FONT= /etc/vconsole.conf; then if grep -q FONT= /etc/vconsole.conf; then
color_green say_green "Font is already set in /etc/vconsole.conf"
echo
echo "Font is already set in /etc/vconsole.conf"
color_reset
else else
color_green say_green "Setting console font in /etc/vconsole.conf"
echo
echo "Setting console font in /etc/vconsole.conf"
color_reset
echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf echo 'FONT=gr737c-8x14' | sudo tee -a /etc/vconsole.conf
fi fi
########################## ##########################
# Detected OS / DE / TWM info # 3. Detected OS / DE / TWM info
########################## ##########################
color_yellow say_yellow "Detected OS / Desktop Environment / Tiling Window Manager"
echo
echo "################################################################################"
echo "Detected OS / Desktop Environment / Tiling Window Manager"
echo "################################################################################"
color_reset
echo echo
say_gray "Installing OS-specific packages..."
say_gray "Selected DE: $DE"
say_gray "Selected TWM: $TWM"
say_gray "Installation Level: $INSTALL_LEVEL"
echo "Installing OS-specific packages..." ##########################
echo "Selected DE: $DE" # 4. Desktop Environment installation
echo "Selected TWM: $TWM" ##########################
echo "Installation Level: $INSTALL_LEVEL" case "$DE" in
xfce|plasma|gnome)
say_yellow "Preparing to install $DE..."
SCRIPT_NAME="$SCRIPT_DIR/${OS}-${DE}.sh"
if [[ -f "$SCRIPT_NAME" ]]; then
say_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME"
else
say_red "Error: $SCRIPT_NAME not found!"
exit 1
fi
;;
none)
say_gray "No Desktop Environment selected, skipping DE installation."
;;
esac
# Desktop Environment installation ##########################
if [[ "$DE" == "xfce" ]]; then # 5. Tiling Window Manager installation
color_green ##########################
echo case "$TWM" in
echo "################################################################################" chadwm|hyprland)
echo "Installing XFCE4" say_yellow "Installing $TWM..."
echo "################################################################################" SCRIPT_NAME="$SCRIPT_DIR/${OS}-${TWM}.sh"
color_reset if [[ -f "$SCRIPT_NAME" ]]; then
echo "Installing XFCE packages..." say_cyan "Running $SCRIPT_NAME..."
fi bash "$SCRIPT_NAME"
else
say_red "Error: $SCRIPT_NAME not found!"
exit 1
fi
;;
none)
say_gray "No tiling window manager selected."
;;
esac
if [[ "$DE" == "plasma" ]]; then ##########################
color_green # 6. Installation level handling
echo ##########################
echo "################################################################################" case "$INSTALL_LEVEL" in
echo "Installing KDE Plasma 6" minimal|full|workstation|server)
echo "################################################################################" say_cyan "Installation level: $INSTALL_LEVEL"
color_reset SCRIPT_NAME="$SCRIPT_DIR/${OS}-${INSTALL_LEVEL}.sh"
echo "Installing Plasma packages..." if [[ -f "$SCRIPT_NAME" ]]; then
fi say_cyan "Running $SCRIPT_NAME..."
bash "$SCRIPT_NAME"
else
say_red "Error: $SCRIPT_NAME not found!"
exit 1
fi
;;
esac
if [[ "$DE" == "gnome" ]]; then say_green "Arch setup complete."
color_green say_red "The installation has finished. A reboot is recommended before continuing."
echo read -rp "Reboot now? [y/N]: " reboot_choice
echo "################################################################################" case "${reboot_choice,,}" in
echo "Installing Gnome 48" y|yes)
echo "################################################################################" say_red "Rebooting now."
color_reset sudo reboot
echo "Installing Gnome packages..." ;;
fi *)
say_yellow "Skipping reboot. Make sure to reboot manually before continuing upgrades."
if [[ "$DE" == "none" ]]; then exit 0
color_green ;;
echo esac
echo "################################################################################"
echo "Installing no Desktop Environment"
echo "################################################################################"
color_reset
echo "Installing no Desktop Environment packages..."
fi
# Tiling Window Manager installation
if [[ "$TWM" == "chadwm" ]]; then
color_green
echo
echo "################################################################################"
echo "Installing Chadwm"
echo "################################################################################"
color_reset
echo "Installing CHADWM..."
fi
if [[ "$TWM" == "hyprland" ]]; then
color_green
echo
echo "################################################################################"
echo "Installing Hyprland"
echo "################################################################################"
color_reset
echo "Installing Hyprland..."
fi
if [[ "$TWM" == "none" ]]; then
color_green
echo
echo "################################################################################"
echo "Installing no Tiling Window Manager"
echo "################################################################################"
color_reset
echo "Installing no Tiling Window Manager packages..."
fi

View File

@@ -90,7 +90,7 @@ else
say_yellow -e "LightDM is currently active. Replacing with SDDM..." say_yellow -e "LightDM is currently active. Replacing with SDDM..."
sudo systemctl disable lightdm sudo systemctl disable lightdm
sudo apt purge -y lightdm lightdm-gtk-greeter sudo pacman -Rns lightdm lightdm-gtk-greeter
install_packages sddm install_packages sddm
enable_graphical_target enable_graphical_target