fix mgmt for termux

This commit is contained in:
Robert Perce 2026-01-30 00:07:20 -06:00
parent 074131bb54
commit 21127d307d
4 changed files with 15 additions and 8 deletions

View file

@ -1,32 +0,0 @@
_os() {
if command -v termux-setup-storage >/dev/null; then
echo "termux"
else
grep '^ID=' /etc/os-release | cut -d= -f2
fi
}
missing=()
check_apply() {
while IFS= read -r package; do
cmd=$(echo "$package" | cut -d\; -f1)
pkg=$(echo "$package" | grep -Eo "$(_os):[^ ]+" || echo ":$cmd")
pkg=$(echo "$pkg" | cut -d: -f2)
[ -n "$pkg" ] || next
command -v "$cmd" >/dev/null || missing+=( "$pkg" )
done < ~/.config/mgmt/packages
[ ${#missing} -eq 0 ]
}
apply() {
case "$(_os)" in
ubuntu) manager="apt install" ;;
arch) manager="pacman -Syu" ;;
termux) manager="pkg install" ;;
*) return 1 ;;
esac
$manager "${missing[@]}"
}