fix(instalee): ignore invalid package entries

This commit is contained in:
xeruf 2022-07-05 11:24:56 +02:00
parent 410eb0576d
commit 3c7542ca8f

View file

@ -4,7 +4,7 @@
name="$(basename "$0")" name="$(basename "$0")"
home="$(find "$INSTALEE_HOME" "${XDG_CONFIG_HOME:-$HOME/.config}/$name" "$HOME/.$name" "$PWD" -maxdepth 0 2>/dev/null | head -1)" home="$(find "$INSTALEE_HOME" "${XDG_CONFIG_HOME:-$HOME/.config}/$name" "$HOME/.$name" "$PWD" -maxdepth 0 2>/dev/null | head -1)"
highlight() { echo "$1"; } highlight() { echo "$1"; }
destress() { echo "$1"; } destress() { echo "$1"; }
# Get the content of a file or the output of its execution # Get the content of a file or the output of its execution
@ -13,7 +13,7 @@ getcontent() { test -x "$1" && "$1" || cat "$1"; }
# Get available package entries for given package # Get available package entries for given package
getentries() { getentries() {
cat "$home/handlers.available" | while read handler cat "$home/handlers.available" | while read handler
do find "$home/packages/$1" -name "$handler*" 2>/dev/null do find "$home/packages/$1/" -type f -name "$handler*" 2>/dev/null
done done
} }
@ -22,7 +22,7 @@ installpkg() {
test "$1" = "--quiet" && local quiet=true && shift test "$1" = "--quiet" && local quiet=true && shift
local pkgs=$(getentries "$1") local pkgs=$(getentries "$1")
if test -z "$pkgs"; then if test -z "$pkgs"; then
local handlers=$(find "$home/packages/$1" -type f -printf "%f\n" 2>/dev/null) local handlers=$(find "$home/packages/$1/" -type f -printf "%f\n" 2>/dev/null)
for handler in $handlers for handler in $handlers
do installpkg --quiet "$handler" && do installpkg --quiet "$handler" &&
echo "$handler" >> "$home/handlers.available" && echo "$handler" >> "$home/handlers.available" &&