diff --git a/etc/functions b/etc/functions index 5f02974..5c7e729 100644 --- a/etc/functions +++ b/etc/functions @@ -8,11 +8,13 @@ header() { if [ "$DEBUG" -ge "1" ]; then echo please enter enter read a - if [ "$a" -ge "2" ]; then - set -x - fi - if [ "$a" == "0" ]; then - DEBUG=0 + if [ "${a}" ]; then + if [ "$a" -ge "2" ]; then + set -x + fi + if [ "$a" == "0" ]; then + DEBUG=0 + fi fi fi clear diff --git a/main.sh b/main.sh index 5bde146..969d802 100755 --- a/main.sh +++ b/main.sh @@ -376,8 +376,16 @@ add_arg_pkg() { for i in "${@}"; do if xbps-query -Rs ${i}|awk '{print $2}'|grep "^${i}" >/dev/null; then addpkg "${@}" + else + na_pkg+=("${i}") fi done + if [ "${#na_pkg[@]}" -gt "0" ]; then + echo "package$(if [ ${#na_pkg[@]} -gt 1 ]; then printf "s"; fi) ${na_pkg[@]} not available" + if ! yesno "exit?" n; then + exit 1 + fi + fi } target_phy_disk @@ -394,6 +402,7 @@ base profile network printing +add_arg_pkg "${@}" header "Do installation" if [ "${DEBUG}" -ge "1" ]; then @@ -403,7 +412,6 @@ if ! yesno "Do you really wanna install?" n; then exit fi -add_arg_pkg "${@}" do_partition do_install