ambevar-dotfiles/.local/bin/package-lister

45 lines
1009 B
Bash
Executable File

#!/bin/sh
## Create lists of system- and TeX Live packages.
## Variables
PKG_ROOT="$HOME/.package-lists"
mkdir -p "$PKG_ROOT"
## Arch Linux
if command -v pacman >/dev/null 2>&1; then
pacman -Qneq | LC_ALL=C sort >"$PKG_ROOT/arch-official"
pacman -Qmeq | LC_ALL=C sort >"$PKG_ROOT/arch-aur"
fi
## TeXlive
if ! command -v guix >/dev/null 2>&1; then
if command -v tlmgr >/dev/null 2>&1; then
tlctl l >"$PKG_ROOT/texlive"
fi
fi
## Guix
if command -v guix >/dev/null 2>&1; then
guile -s ~/.config/guix/profile-to-manifest.scm ~/.guix-profile >"$PKG_ROOT/guix-manifest.scm"
guix --version | awk '{print $4; exit}' >"$PKG_ROOT/guix-version"
fi
YELLOW='\033[0;33m\033[1m'
BOLD='\033[0m\033[1m'
NORMAL='\033[0m'
message() {
echo -e "$YELLOW:: $@$NORMAL"
}
status() {
local title=$1
local body=$2
[ -z "$body" ] && return
message "$title"
echo "$body"
}
status "Unpushed files" "$(git -C "$PKG_ROOT" diff --cached --name-only .)"
status "Unstaged files" "$(git -C "$PKG_ROOT" diff --name-only .)"