diff --git a/instalee b/instalee index bb4d852..044f80e 100755 --- a/instalee +++ b/instalee @@ -8,7 +8,7 @@ get() { result=$(cat "$home/sources" | while read source do find "$home/packages/$1" -name "$source*" 2>/dev/null done) - test "$result" || (echo "No source for package '$1'" >>/dev/stderr && exit 1) + test ! "$result" && echo "No source for package '$1'" >>/dev/stderr && exit 1 echo "$result" } @@ -23,16 +23,23 @@ case $1 in -a) dir="$home/packages/$2" mkdir -p "$dir" - echo "$4">"$dir/$3" + test $# -gt 3 && echo "$4">"$dir/$3" || $EDITOR "$dir/$3" + ;; *) - get "$1" | while read pkg; do + set -e + pkgs=$(get "$1") + echo "$pkgs" | while read pkg; do underline "$pkg" name="$(basename $pkg)" base="${name%_*}" + test "$base" = "custom" && $pkg && exit 0 + ext="${name##$base}" mgr="$home/managers/$base" args="$(getcontent "$pkg")" - (test "$base" = "manual" && echo "$args") || (install="$(find "$mgr" -name "install$ext" | head -1)" && echo $install $args && $install $args) + install="$(find "$mgr" -name "install$ext" | head -1)" && echo "Invoking '$install $args'" && $install $args + exit 0 done + ;; esac