2022-09-24 16:44:39 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-10-09 15:24:42 +02:00
|
|
|
################################################################
|
|
|
|
# 📜 Arch Linux, Pacman Package Install / Update Script #
|
|
|
|
################################################################
|
|
|
|
# Installs listed packages on Arch-based systems via Pacman #
|
|
|
|
# Also updates the cache database and existing applications #
|
|
|
|
# Confirms apps arn't installed via different package manager #
|
|
|
|
# Doesn't include desktop apps, that're managed via Flatpak #
|
|
|
|
# Apps are sorted by category, and arranged alphabetically #
|
|
|
|
# Be sure to delete / comment out anything you do not need #
|
|
|
|
# For more info, see: https://wiki.archlinux.org/title/Pacman #
|
|
|
|
################################################################
|
|
|
|
# MIT Licensed (C) Alicia Sykes 2022 <https://aliciasykes.com> #
|
|
|
|
################################################################
|
2022-09-24 16:44:39 +02:00
|
|
|
|
|
|
|
# Apps to be installed via Pacman
|
|
|
|
pacman_apps=(
|
2022-10-09 01:14:20 +02:00
|
|
|
# Essentials
|
|
|
|
'git' # Version controll
|
|
|
|
'neovim' # Text editor
|
|
|
|
'ranger' # Directory browser
|
|
|
|
'tmux' # Term multiplexer
|
2022-10-09 02:06:44 +02:00
|
|
|
'wget' # Download files
|
2022-10-09 01:14:20 +02:00
|
|
|
|
2022-10-09 02:32:14 +02:00
|
|
|
# CLI Power Basics
|
2022-10-09 01:14:20 +02:00
|
|
|
'aria2' # Resuming download util (better wget)
|
|
|
|
'bat' # Output highlighting (better cat)
|
|
|
|
'broot' # Interactive directory navigation
|
|
|
|
'ctags' # Indexing of file info + headers
|
|
|
|
'diff-so-fancy' # Readable file compares (better diff)
|
|
|
|
'duf' # Get info on mounted disks (better df)
|
|
|
|
'exa' # Listing files with info (better ls)
|
|
|
|
'fzf' # Fuzzy file finder and filtering
|
|
|
|
'hyperfine' # Benchmarking for arbitrary commands
|
|
|
|
'just' # Powerful command runner (better make)
|
|
|
|
'jq' # JSON parser, output and query files
|
|
|
|
'most' # Multi-window scroll pager (better less)
|
|
|
|
'procs' # Advanced process viewer (better ps)
|
|
|
|
'ripgrep' # Searching within files (better grep)
|
2022-10-09 02:06:44 +02:00
|
|
|
'scrot' # Screenshots programmatically via CLI
|
2022-10-09 01:14:20 +02:00
|
|
|
'sd' # RegEx find and replace (better sed)
|
|
|
|
'thefuck' # Auto-correct miss-typed commands
|
2022-10-09 02:06:44 +02:00
|
|
|
'tealdeer' # Reader for command docs (better man)
|
2022-10-09 01:14:20 +02:00
|
|
|
'tree' # Directory listings as tree structure
|
2022-12-12 15:35:06 +01:00
|
|
|
'tokei' # Count lines of code (better cloc)
|
2022-10-09 01:14:20 +02:00
|
|
|
'trash-cli' # Record and restore removed files
|
|
|
|
'xsel' # Copy paste access to the X clipboard
|
|
|
|
'zoxide' # Auto-learning navigation (better cd)
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-10-09 02:06:44 +02:00
|
|
|
# Security Utilities
|
2022-10-09 02:32:14 +02:00
|
|
|
'clamav' # Open source virus scanning suite
|
|
|
|
'cryptsetup' # Reading / writing encrypted volumes
|
|
|
|
'gnupg' # PGP encryption, signing and verifying
|
|
|
|
'git-crypt' # Transparent encryption for git repos
|
|
|
|
'lynis' # Scan system for common security issues
|
|
|
|
'openssl' # Cryptography and SSL/TLS Toolkit
|
|
|
|
'rkhunter' # Search / detect potential root kits
|
|
|
|
|
|
|
|
# Monitoring, management and stats
|
|
|
|
'btop' # Live system resource monitoring
|
|
|
|
'bmon' # Bandwidth utilization monitor
|
|
|
|
'ctop' # Container metrics and monitoring
|
|
|
|
'gping' # Interactive ping tool, with graph
|
|
|
|
'glances' # Resource monitor + web and API
|
|
|
|
'goaccess' # Web log analyzer and viewer
|
|
|
|
'speedtest-cli' # Command line speed test utility
|
|
|
|
|
|
|
|
# CLI Fun
|
|
|
|
'cowsay' # Outputs message with ASCII art cow
|
|
|
|
'figlet' # Outputs text as 3D ASCII word art
|
|
|
|
'lolcat' # Rainbow coloured terminal output
|
|
|
|
'neofetch' # Show off distro and system info
|
2022-10-09 01:14:20 +02:00
|
|
|
)
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
# Colors
|
|
|
|
PURPLE='\033[0;35m'
|
2022-10-09 02:06:44 +02:00
|
|
|
YELLOW='\033[0;93m'
|
|
|
|
CYAN_B='\033[1;96m'
|
2022-09-26 00:07:53 +02:00
|
|
|
LIGHT='\x1b[2m'
|
2022-10-09 02:06:44 +02:00
|
|
|
RESET='\033[0m'
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
PROMPT_TIMEOUT=15 # When user is prompted for input, skip after x seconds
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-10-09 01:14:20 +02:00
|
|
|
# If set to auto-yes - then don't wait for user reply
|
|
|
|
if [[ $* == *"--auto-yes"* ]]; then
|
|
|
|
PROMPT_TIMEOUT=0
|
|
|
|
REPLY='Y'
|
|
|
|
fi
|
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
# Print intro message
|
2022-10-09 01:14:20 +02:00
|
|
|
echo -e "${PURPLE}Starting Arch package install / update script"
|
2022-09-26 00:07:53 +02:00
|
|
|
echo -e "${LIGHT}The following script is for Arch / Arch-based headless systems, and will"
|
|
|
|
echo -e "update database, upgrade packages, clear cache then install all listed CLI apps."
|
|
|
|
echo -e "${YELLOW}Before proceeding, ensure your happy with all the packages listed in \e[4m${0##*/}"
|
|
|
|
echo -e "${RESET}"
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
# Check if running as root, and prompt for password if not
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
|
|
echo -e "${PURPLE}Elevated permissions are required to adjust system settings."
|
|
|
|
echo -e "${CYAN_B}Please enter your password...${RESET}"
|
|
|
|
sudo -v
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo -e "${YELLOW}Exiting, as not being run as sudo${RESET}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
# Check pacman actually installed
|
|
|
|
if ! hash pacman 2> /dev/null; then
|
|
|
|
echo "${YELLOW_B}Pacman doesn't seem to be present on your system. Exiting...${RESET}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
# Prompt user to update package database
|
|
|
|
echo -e "${CYAN_B}Would you like to update package database? (y/N)${RESET}\n"
|
|
|
|
read -t $PROMPT_TIMEOUT -n 1 -r
|
|
|
|
echo
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
echo -e "${PURPLE}Updating dadatbase...${RESET}"
|
|
|
|
sudo pacman -Syy --noconfirm
|
|
|
|
fi
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
# Prompt user to upgrade currently installed packages
|
|
|
|
echo -e "${CYAN_B}Would you like to upgrade currently installed packages? (y/N)${RESET}\n"
|
|
|
|
read -t $PROMPT_TIMEOUT -n 1 -r
|
|
|
|
echo
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
echo -e "${PURPLE}Upgrading installed packages...${RESET}"
|
|
|
|
sudo pacman -Syu --noconfirm
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Prompt user to clear old package caches
|
|
|
|
echo -e "${CYAN_B}Would you like to clear unused package caches? (y/N)${RESET}\n"
|
|
|
|
read -t $PROMPT_TIMEOUT -n 1 -r
|
|
|
|
echo
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
echo -e "${PURPLE}Freeing up disk space...${RESET}"
|
|
|
|
sudo pacman -Sc --noconfirm
|
2022-10-09 01:14:20 +02:00
|
|
|
paccache -r
|
2022-09-26 00:07:53 +02:00
|
|
|
fi
|
2022-09-24 16:44:39 +02:00
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
# Prompt user to install all listed apps
|
|
|
|
echo -e "${CYAN_B}Would you like to install listed apps? (y/N)${RESET}\n"
|
|
|
|
read -t $PROMPT_TIMEOUT -n 1 -r
|
|
|
|
echo
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
echo -e "${PURPLE}Starting install...${RESET}"
|
2022-09-24 16:44:39 +02:00
|
|
|
for app in ${pacman_apps[@]}; do
|
2022-09-26 00:07:53 +02:00
|
|
|
if hash "${app}" 2> /dev/null; then
|
|
|
|
echo -e "${YELLOW}[Skipping]${LIGHT} ${app} is already installed${RESET}"
|
2022-10-09 01:14:20 +02:00
|
|
|
elif [[ $(echo $(pacman -Qk $(echo $app | tr 'A-Z' 'a-z') 2> /dev/null )) == *"total files"* ]]; then
|
|
|
|
echo -e "${YELLOW}[Skipping]${LIGHT} ${app} is already installed via Pacman${RESET}"
|
2022-09-26 00:07:53 +02:00
|
|
|
elif hash flatpak 2> /dev/null && [[ ! -z $(echo $(flatpak list --columns=ref | grep $app)) ]]; then
|
|
|
|
echo -e "${YELLOW}[Skipping]${LIGHT} ${app} is already installed via Flatpak${RESET}"
|
|
|
|
else
|
|
|
|
echo -e "${PURPLE}[Installing]${LIGHT} Downloading ${app}...${RESET}"
|
2022-10-09 02:06:44 +02:00
|
|
|
sudo pacman -S ${app} --needed --noconfirm
|
2022-09-26 00:07:53 +02:00
|
|
|
fi
|
2022-09-24 16:44:39 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2022-09-26 00:07:53 +02:00
|
|
|
echo -e "${PURPLE}Finished installing / updating Arch packages.${RESET}"
|
2022-10-09 01:14:20 +02:00
|
|
|
|
|
|
|
# EOF
|