Extract pkg cmd abstractions and clean up all migrations (#1291)

* No using custom chromium.desktop any more

* Spacing

* Rely on $OMARCHY_PATH

* Add common pkg and cmd functions for use in migrations and elsewhere

* Simple pkg-adds

* Later migration does it

* Ensure running migrations on older installs have the new pkg/cmds available

* Spacing

* Use new abstractions

* Installed in later migration

* Needless comment

* Use new commands

* Fix package name from 'batt' to 'bat'
This commit is contained in:
David Heinemeier Hansson
2025-08-30 07:41:05 +02:00
committed by GitHub
parent 4f6f92b2cc
commit a3c5e589f6
65 changed files with 132 additions and 153 deletions

View File

@@ -66,3 +66,53 @@ img2png() {
"${1%.*}.png"
}
pkg-present() {
for pkg in "$@"; do
pacman -Q "$pkg" &>/dev/null || return 1
done
return 0
}
pkg-missing() {
for pkg in "$@"; do
if ! pacman -Q "$pkg" &>/dev/null; then
return 0
fi
done
return 1
}
pkg-add() {
for pkg in "$@"; do
if ! pacman -Q "$pkg" &>/dev/null; then
sudo pacman -S --noconfirm --needed "$pkg"
fi
done
}
pkg-remove() {
for pkg in "$@"; do
if pacman -Q "$pkg" &>/dev/null; then
sudo pacman -Rns --noconfirm "$pkg"
fi
done
}
cmd-present() {
for cmd in "$@"; do
command -v "$cmd" &>/dev/null || return 1
done
return 0
}
cmd-missing() {
for cmd in "$@"; do
if ! command -v "$cmd" &>/dev/null; then
return 0
fi
done
return 1
}