#!/bin/bash -i # Print the logo print_logo() { cat << "EOF" ██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗ ██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝ ███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝ ██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗ ██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ EOF } # Parse command line arguments DEV_ONLY=false while [[ "$#" -gt 0 ]]; do case $1 in --dev-only) DEV_ONLY=true; shift ;; *) echo "Unknown parameter: $1"; exit 1 ;; esac done # Clear screen and show logo clear print_logo cd sudo -v echo "Getting the latest version of HamPack..." rm -rf ~/.local/share/HamPack git clone https://gitea.young.computer/david/HamPack.git ~/.local/share/HamPack >/dev/null SRC="$HOME/.local/share/HamPack/hampackupdate" DST="$HOME/.local/bin/hampackupdate" MAX_RETRIES=3 retries=0 while true; do if [ "$SRC" -nt "$DST" ]; then retries=$((retries + 1)) if [ "$retries" -ge "$MAX_RETRIES" ]; then echo "Error: failed to sync files after $MAX_RETRIES attempts, exiting." exit 1 fi echo "Source is newer than destination, updating (attempt $retries)..." sudo cp -p "$SRC" "$DST" continue fi echo "Destination is up to date, proceeding..." break done sudo cp ~/.local/share/coredesktop/hampackrefresh ~/.local/bin/hampackrefresh # Exit on any error set -e cd ~/.local/share/HamPack # Source the packages list if [ ! -f "packages.conf" ]; then echo "Error: packages.conf not found!" fi source packages.conf # Update the system first echo "Updating system..." sudo pacman -Syu --noconfirm cd ~/ # Install yay AUR helper if not present if ! command -v yay &> /dev/null; then echo "Installing yay AUR helper..." sudo pacman -S --needed git base-devel --noconfirm if [[ ! -d "yay" ]]; then echo "Cloning yay repository..." else echo "yay directory already exists, removing it..." rm -rf yay fi git clone https://aur.archlinux.org/yay.git cd yay echo "building yay.... yaaaaayyyyy" makepkg -si --noconfirm cd .. rm -rf yay else echo "yay is already installed" fi # Install packages by category if [[ "$DEV_ONLY" == true ]]; then # Only install essential development packages echo "Installing system utilities..." install_packages "${SYSTEM_UTILS[@]}" echo "Installing development tools..." install_packages "${DEV_TOOLS[@]}" else # Install all packages echo "Installing system utilities..." install_packages "${UTILITIES[@]}" echo "Installing development tools..." install_packages "${APPLICATIONS[@]}" cd ~/.local/share/HamPack # Install Flatpack applications echo "Installing Flatpack Applications..." . install-flatpacks.sh echo "Done."