This commit is contained in:
@@ -10,13 +10,36 @@ is_group_installed() {
|
||||
pacman -Qg "$1" &> /dev/null
|
||||
}
|
||||
|
||||
# Packages and Flatpaks you don't want, one name per line (# starts a comment).
|
||||
# install_packages and install-flatpaks.sh leave them out, so update doesn't
|
||||
# put back what you've removed.
|
||||
SKIP_PACKAGES="$HOME/.config/coredesktop/skip-packages"
|
||||
|
||||
# Print each argument that isn't in SKIP_PACKAGES, one per line
|
||||
without_skipped() {
|
||||
local -A skip=()
|
||||
local name
|
||||
if [ -f "$SKIP_PACKAGES" ]; then
|
||||
while read -r name _; do
|
||||
[[ -n "$name" && "$name" != \#* ]] && skip["$name"]=1
|
||||
done < "$SKIP_PACKAGES"
|
||||
fi
|
||||
for name in "$@"; do
|
||||
[ -n "${skip[$name]}" ] || echo "$name"
|
||||
done
|
||||
}
|
||||
|
||||
# Function to install packages if not already installed
|
||||
install_packages() {
|
||||
local packages=("$@")
|
||||
local packages=()
|
||||
local to_install=()
|
||||
|
||||
local as_deps=()
|
||||
|
||||
mapfile -t packages < <(without_skipped "$@")
|
||||
# pacman -Qdq with no names would list every dependency on the system
|
||||
[ ${#packages[@]} -ne 0 ] || return 0
|
||||
|
||||
for pkg in "${packages[@]}"; do
|
||||
if ! is_installed "$pkg" && ! is_group_installed "$pkg"; then
|
||||
to_install+=("$pkg")
|
||||
|
||||
Reference in New Issue
Block a user