diff --git a/src/env.sh b/src/env.sh index 30b2a17..361f691 100644 --- a/src/env.sh +++ b/src/env.sh @@ -1,5 +1,8 @@ #!/bin/sh +_OUTPUT=/dev/stdin +[ "$_ZPKG_SELF_UPGRADE" = "y" ] && _OUTPUT=/dev/null + config_path=/etc/zpkg fname="$(basename "$0")" ALLOW_ROOT=false diff --git a/src/main.sh b/src/main.sh index 9bdaa77..3c464f4 100644 --- a/src/main.sh +++ b/src/main.sh @@ -55,7 +55,7 @@ info) fi ;; install) - fetch_pkglist $sudo || exit $? + fetch_pkglist $sudo > $_OUTPUT || exit $? if [ -z "$2" ] then echo "No package specified" >&2 @@ -63,7 +63,7 @@ install) shift 1 pkglist=$(LOG=true resolve_packages $*) || exit $? pkglist=$(INCLUDE_PACKAGES=true resolve_deps $* | tr '\n' ' ') - echo "Installing packages: $pkglist" + echo "Installing packages: $pkglist" > $_OUTPUT for I in $pkglist do if is_installed $I @@ -133,4 +133,4 @@ deploy) *) usage && exit 1 ;; esac -[ -n "$_self_update" ] && gen_self_update && exec "$_tmpzpkg" -R install zpkg +[ -n "$_self_update" ] && gen_self_update && _ZPKG_SELF_UPGRADE=y exec "$_tmpzpkg" -R install zpkg diff --git a/src/upgrade.sh b/src/upgrade.sh index ffb0678..539fb26 100644 --- a/src/upgrade.sh +++ b/src/upgrade.sh @@ -41,9 +41,9 @@ upgrade_package() ## self upgrading mitigation unset _self_update -_tmpzpkg="/tmp/zpkg_bin_$(random_string 5)" gen_self_update() { + _tmpzpkg="/tmp/zpkg_bin_$(random_string 5)" # copy current file cp "$0" "$_tmpzpkg" || return $? # make new script self-delete