#!/bin/bash # filepath: pacman-wrapper.sh # A helpful wrapper for Arch Linux's pacman package manager # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[0;33m' BLUE='\033[0;34m' CYAN='\033[0;36m' BOLD='\033[1m' NC='\033[0m' # No Color PACMAN_BIN="/usr/bin/pacman" # Function to display help function show_help() { echo -e "${BOLD}Pacman Wrapper Help${NC}" echo "This wrapper adds helpful features while preserving all pacman functionality." echo "" echo "Additional commands:" echo " --help-wrapper Show this help message" } # Function to display a message before executing function display_operation() { case "$1" in -S|-Sy|-S\ *) echo -e "${BLUE}Installing packages...${NC}" ;; -Syu|-Syyu) echo -e "${BLUE}Updating system...${NC}" ;; -R|-Rs|-Rns|-R\ *) echo -e "${YELLOW}Removing packages...${NC}" ;; -Ss|-Ss\ *) echo -e "${CYAN}Searching for packages...${NC}" ;; -Q|-Qs|-Qi|-Ql|-Q\ *) echo -e "${CYAN}Querying package database...${NC}" ;; -U|-U\ *) echo -e "${BLUE}Installing local packages...${NC}" ;; -Scc) echo -e "${YELLOW}Cleaning package cache...${NC}" ;; *) echo -e "${CYAN}Executing pacman command...${NC}" ;; esac } # Function to check if user is trying to install specific packages that require confirmation function check_for_steam() { # List of packages that require confirmation local restricted_packages=("steam" "freetube-bin" "seamonkey-bin" "seamonkey" "min-browser-bin" "min-browser" "beaker-browser" "catalyst-browser-bin" "hamsket" "min" "vieb-bin") # Check if the command is an installation command if [[ "$1" == "-S" || "$1" == "-Sy" || "$1" == "-Syu" || "$1" == "-Syyu" || "$1" == "-U" ]]; then # Check all arguments for arg in "$@"; do # Check if argument matches any restricted packageExecuting: /usr/bin/pacman.orig -U --config /etc/pacman.conf -- /home/kuhy/.cache/yay/seamonkey-bin/seamonkey-bin-2.53.20-1-x86_64.pkg.tar.zst /home/kuhy/.cache/yay/seamonkey-bin/seamonkey-bin-debug-2.53.20-1-x86_64.pkg.tar.zst for package in "${restricted_packages[@]}"; do if [[ "$arg" == "$package" ]]; then return 0 # Restricted package found fi done done fi return 1 # No restricted package found } # Function to prompt for solving a word unscrambling challenge function prompt_for_math_solution() { echo -e "${YELLOW}WARNING: You are trying to install a restricted package.${NC}" echo -e "${YELLOW}Challenge will begin shortly...${NC}" # Sleep for random 5-10 seconds sleep_duration=$((RANDOM % 10 + 10)) sleep $sleep_duration # Define path to words.txt (in the same directory as the script) script_dir="$(dirname "$(readlink -f "$0")")" words_file="$script_dir/words.txt" # Check if words.txt exists if [[ ! -f "$words_file" ]]; then echo -e "${RED}Error: words.txt file not found at $words_file${NC}" return 1 fi words_count=80 # Load ${words_count} random words mapfile -t selected_words < <(shuf -n $words_count "$words_file") # Convert all words to uppercase for i in "${!selected_words[@]}"; do selected_words[$i]=$(echo "${selected_words[$i]}" | tr '[:lower:]' '[:upper:]') done echo -e "${CYAN}Here are ${words_count} random words. Remember them:${NC}" # Display the words in a 5x4 grid (5 rows, 4 columns) for (( i=0; i