From 1a05ea84454625156b9b98e0569f0ee71afc2c72 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 16 Jan 2023 18:47:47 +0100 Subject: [PATCH] bootstrap: Split packages into stable and testing lists Split the lists into two, with testing getting automatically updated on packages added (and removed, but only if the package to be removed is *not* in stable packages already). This way, I can always be sure that I have my stable setup in the repository, but packages that I am temporarily testing have a place without being forgotten and I can more easily change them around until they find a place in stable or get thrown out. --- .githooks/prepare-commit-msg | 2 +- .../{packages.tsv => packages_stable.tsv} | 7 ++- bootstrap/packages_testing.tsv | 7 +++ bootstrap/update_package_list.sh | 54 +++++++++++-------- 4 files changed, 43 insertions(+), 27 deletions(-) rename bootstrap/{packages.tsv => packages_stable.tsv} (98%) create mode 100644 bootstrap/packages_testing.tsv diff --git a/.githooks/prepare-commit-msg b/.githooks/prepare-commit-msg index 410b6ca..c8a6b77 100755 --- a/.githooks/prepare-commit-msg +++ b/.githooks/prepare-commit-msg @@ -4,7 +4,7 @@ COMMIT_MSG_FILE="$1" COMMIT_SOURCE="$2" BOOTSTRAPDIR="bootstrap" -pkg_committed="$(cat $(git rev-parse --show-toplevel)/$BOOTSTRAPDIR/packages.tsv | tail +2 | cut -f1 | sort)" +pkg_committed="$(cat "$(git rev-parse --show-toplevel)"/$BOOTSTRAPDIR/packages*.tsv | grep -v -e '^Name Description Source Target' | cut -f1 | sort)" pkg_onsystem=$(pacman -Qqett | grep -v "$(pacman -Qqg base-devel)" | sort) # get files only in repo, and only on machine diff --git a/bootstrap/packages.tsv b/bootstrap/packages_stable.tsv similarity index 98% rename from bootstrap/packages.tsv rename to bootstrap/packages_stable.tsv index 30da719..ce731dd 100644 --- a/bootstrap/packages.tsv +++ b/bootstrap/packages_stable.tsv @@ -69,7 +69,6 @@ ffmpegthumbnailer Lightweight video thumbnailer that can be used by file manager firefox Standalone web browser from mozilla.org R fonts-cjk Linux 下的免费商用字体包 A freerdp Free implementation of the Remote Desktop Protocol (RDP) R -fvextra Extensions to fancyvrb, including automatic line breaking and improved math mode R fwupd Simple daemon to allow session software to update firmware R fzf-tab-bin-git Replace zsh's default completion selection menu with fzf (git version). This package also compiles the optional binary module. A gallery-dl Command-line program to download image-galleries and collections from several image hosting sites A @@ -107,7 +106,6 @@ iputils Network monitoring tools, including ping R ipython An enhanced Interactive Python shell. R iucode-tool Tool to manipulate Intel® IA-32/X86-64 microcode bundles R iwd Internet Wireless Daemon R -jabref-latest GUI frontend for BibTeX, written in Java; latest main (master) version from git A jiq-bin Interactive JSON query tool using jq expressions A jmtpfs FUSE and libmtp based filesystem for accessing MTP (Media Transfer Protocol) devices A jpdftweak A Swiss Army Knife GUI application for PDF documents A @@ -147,6 +145,7 @@ maim Utility to take a screenshot using imlib2 R mako Lightweight notification daemon for Wayland R man-db A utility for reading man pages R man-pages Linux man pages R +markdownlint-cli MarkdownLint Command Line Interface A masterpdfeditor-free A complete solution for creation and editing PDF files - Free version without watermark A mbsync-git free (GPL) mailbox synchronization program A mediainfo Supplies technical and tag information about a video or audio file (CLI interface) R @@ -183,7 +182,6 @@ newsboat RSS/Atom feed reader for text terminals R nextcloud-client Nextcloud desktop client R nfs-utils Support programs for Network File Systems R nmap Utility for network discovery and security auditing R -nodejs-markdownlint-cli MarkdownLint Command Line Interface A nodejs-pandiff Prose diffs for any document format supported by Pandoc A noto-fonts-emoji Google Noto emoji fonts R npm A package manager for javascript R @@ -312,12 +310,13 @@ vagrant Build and distribute virtualized development environments R vale-bin A customizable, syntax-aware linter for prose A vdirsyncer Synchronize CalDAV and CardDAV. R viddy A modern watch command A -vifm-git Ncurses based file manager with vi like keybindings A +vifm A file manager with curses interface, which provides Vi[m]-like environment R vim-language-server VimScript language server A virt-manager Desktop user interface for managing virtual machines R virtualbox Powerful x86 virtualization for enterprise as well as home use R virtualbox-guest-iso The official VirtualBox Guest Additions ISO image R visidata Terminal spreadsheet multitool for discovering and arranging data R +wallabag-client Command line client for the self hosted read-it-later app Wallabag A wavemon Ncurses-based monitoring application for wireless network devices R waybar Highly customizable Wayland bar for Sway and Wlroots based compositors R waylock-git A simple screenlocker for Wayland compositors A diff --git a/bootstrap/packages_testing.tsv b/bootstrap/packages_testing.tsv new file mode 100644 index 0000000..081b461 --- /dev/null +++ b/bootstrap/packages_testing.tsv @@ -0,0 +1,7 @@ +Name Description Source Target +most A terminal pager similar to 'more' and 'less' R +netbird-bin A WireGuard-based mesh network that connects your devices into a single private network A +odysseyra1n Bootstraps Procursus and install Sileo/libhooker on devices jailbroken with checkra1n. A +shadow-tech Desktop client for Shadow Tech cloud gaming service. A +signal-desktop Signal Private Messenger for Linux R +vifm A file manager with curses interface, which provides Vi[m]-like environment R diff --git a/bootstrap/update_package_list.sh b/bootstrap/update_package_list.sh index 8d35bf0..bb37f4d 100755 --- a/bootstrap/update_package_list.sh +++ b/bootstrap/update_package_list.sh @@ -1,16 +1,18 @@ #!/usr/bin/env bash -BOOTSTRAP_DIR=~/.dotfiles/bootstrap -OUTPUT=${BOOTSTRAP_DIR}/packages.tsv +BOOTSTRAP_DIR=${BOOTSTRAP_DIR:-$(pwd)/bootstrap} +INPUTFILES=$(find "${BOOTSTRAP_DIR}" -type f -name 'packages*.tsv') +OUTPUTFILE=${BOOTSTRAP_DIR}/packages_testing.tsv pkg_all=$(pacman -Qqett | grep -v "$(pacman -Qqg base-devel)") pkg_repo=$(pacman -Qqn) pkg_aur=$(pacman -Qqm) -while getopts "nvh" opt; do +while getopts "nvhf:" opt; do case "$opt" in n) DRYRUN=true ;; v) VERBOSE=true ;; + f) OUTPUTFILE="$OPTARG" ;; h | *) { printf "\nUpdate the list of installed packages.\n\nWill compare packages committed to the dotfile repository\nand those currently installed (on an Arch system, using pacman).\nUpdates the list of committed packages in repository\nand prints out the differences as a diff.\n\nOptions:\n\n\t-h\tDisplay this help.\n\t-v\tShow verbose information.\n\t-n\tPrint out changes without changing anything (dry-run).\n" @@ -20,6 +22,13 @@ while getopts "nvh" opt; do esac done +# get all existing written packages +if [ -n "$INPUTFILES" ]; then + INPUT=$(cat $INPUTFILES | grep -v -e '^Name Description Source Target' | sort) +else + INPUT="" +fi + print_msg() { # shellcheck disable=2059 [ -n "$VERBOSE" ] && printf "$@" @@ -29,10 +38,10 @@ print_msg() { # packagename, description, source, target # toot a toot manager A D -if [ -f "${OUTPUT}_TEMP" ]; then - rm "${OUTPUT}_TEMP" +if [ -f "${OUTPUTFILE}_TEMP" ]; then + rm "${OUTPUTFILE}_TEMP" fi -touch "${OUTPUT}_TEMP" +touch "${OUTPUTFILE}_TEMP" # create new package list for pkg in $pkg_all; do @@ -52,9 +61,7 @@ for pkg in $pkg_all; do desc="${desc#"${desc%%[![:space:]]*}"}" target="" - if [ -f "$OUTPUT" ]; then - found_line=$(grep -e "^$pkg" "$OUTPUT") - fi + found_line=$(echo "$INPUT" | grep -e "^$pkg") if [ -n "$found_line" ]; then target=$(echo "$found_line" | cut -f4) print_msg "Updating pkg: %s:%s from: %s, for: %s\n" "$pkg" "$desc" "$source" "$target" @@ -62,26 +69,29 @@ for pkg in $pkg_all; do print_msg "Adding pkg: %s:%s from: %s, for: %s\n" "$pkg" "$desc" "$source" "$target" fi - printf "%s\t%s\t%s\t%s\n" "$pkg" "$desc" "$source" "$target" >>"${OUTPUT}_TEMP" + printf "%s\t%s\t%s\t%s\n" "$pkg" "$desc" "$source" "$target" >>"${OUTPUTFILE}_TEMP" done # notify on any removed packages -if [ -f "$OUTPUT" ]; then - while read -r line; do - if ! echo "$line" | cut -f1 | xargs -I _ grep -F -q -x _ <(echo "$pkg_all"); then - printf "REMOVED: %s\n" "$line" - fi - done <<<"$(tail +2 $OUTPUT)" -fi +while read -r line; do + if ! echo "$line" | cut -f1 | xargs -I _ grep -F -q -x _ <(echo "$pkg_all"); then + printf "REMOVED: %s\n" "$line" + fi +done <<<"<(echo $INPUT | tail +2)" # show file changes -if [ -f "$OUTPUT" ] && [ -f "$OUTPUT"_TEMP ]; then - changes=$(diff --color=always -y --suppress-common-lines "$OUTPUT" "$OUTPUT"_TEMP | tail -n+2) +if [ -f "$OUTPUTFILE"_TEMP ]; then + changes=$(diff --color=always -y --suppress-common-lines <(echo "$INPUT") <(sort "$OUTPUTFILE"_TEMP | tail -n+2)) printf "FILE CHANGES:\n=============\n%s" "$changes" fi -# actually write to file +# actually write changes to file if [ -z "$DRYRUN" ]; then - cat <(printf "Name\tDescription\tSource\tTarget\n") "${OUTPUT}_TEMP" >"$OUTPUT" + + while IFS= read -r line; do + sed -i -e "/^${line//\//\\/}$/d" "$OUTPUTFILE"_TEMP + done <<< "$INPUT" + + cat <(printf "Name\tDescription\tSource\tTarget\n") "${OUTPUTFILE}_TEMP" > "$OUTPUTFILE" fi -rm "${OUTPUT}_TEMP" +rm "${OUTPUTFILE}_TEMP"