From a60ecde57ad531f2fe16d4b77ad5e363935f01aa Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 9 Oct 2022 00:14:20 +0100 Subject: [PATCH] Arch Linux package installation script --- installs/arch.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/installs/arch.sh b/installs/arch.sh index 13b106d..af1990c 100644 --- a/installs/arch.sh +++ b/installs/arch.sh @@ -2,6 +2,8 @@ ############################################################### # 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 # @@ -13,10 +15,45 @@ # Apps to be installed via Pacman pacman_apps=( + # Essentials + 'git' # Version controll + 'neovim' # Text editor + 'ranger' # Directory browser + 'tmux' # Term multiplexer + + # CLI Basics + 'aria2' # Resuming download util (better wget) + 'bat' # Output highlighting (better cat) + 'broot' # Interactive directory navigation + 'cloc' # Count lines of code in file / dir + '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) + 'sd' # RegEx find and replace (better sed) + 'thefuck' # Auto-correct miss-typed commands + 'tldr' # Community-maintained docs (better man) + 'tree' # Directory listings as tree structure + 'trash-cli' # Record and restore removed files + 'xsel' # Copy paste access to the X clipboard + 'zoxide' # Auto-learning navigation (better cd) + + # CLI Fun + 'cowsay' # Have an ASCII cow say your message + 'figlet' # Output text as big ASCII art text + 'lolcat' # Make console output raibow colored + 'neofetch' # Show system data and ditstro info + 'pv' # Pipe viewer, with animation options + ) - - # Colors CYAN_B='\033[1;96m' YELLOW='\033[0;93m' @@ -27,8 +64,14 @@ LIGHT='\x1b[2m' PROMPT_TIMEOUT=15 # When user is prompted for input, skip after x seconds +# If set to auto-yes - then don't wait for user reply +if [[ $* == *"--auto-yes"* ]]; then + PROMPT_TIMEOUT=0 + REPLY='Y' +fi + # Print intro message -echo -e "${PURPLE}Starting Arch app install / update script" +echo -e "${PURPLE}Starting Arch package install / update script" 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##*/}" @@ -76,6 +119,7 @@ echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo -e "${PURPLE}Freeing up disk space...${RESET}" sudo pacman -Sc --noconfirm + paccache -r fi # Prompt user to install all listed apps @@ -87,13 +131,17 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then for app in ${pacman_apps[@]}; do if hash "${app}" 2> /dev/null; then echo -e "${YELLOW}[Skipping]${LIGHT} ${app} is already installed${RESET}" + 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}" 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}" - # pacman -S ${app} --noconfirm + sudo pacman -S ${app} --noconfirm fi done fi echo -e "${PURPLE}Finished installing / updating Arch packages.${RESET}" + +# EOF