From d58eb983bffe18c7babb83a5469f6a20bd6a5a1e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 31 Aug 2021 17:19:54 +0300 Subject: [PATCH] kiss: add KISS_BUILD_INSTALL This option defaults to '1' and controls the installation prompt at the end of the build process. Setting this to '0' will disable the installation of packages post-build. Closes #265 --- kiss | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kiss b/kiss index 1340727..f1f6332 100755 --- a/kiss +++ b/kiss @@ -868,6 +868,7 @@ pkg_tar() { pkg_build_all() { # Build packages and turn them into packaged tarballs. # Order the argument list and filter out duplicates. + export KISS_BUILD_INSTALL=${KISS_BUILD_INSTALL:=1} # Mark packages passed on the command-line explicit. # Also resolve dependencies for all explicit packages. @@ -878,7 +879,7 @@ pkg_build_all() { # If this is an update, don't always build explicitly passsed packages # and instead install pre-built binaries if they exist. - ok "$pkg_update" || explicit_build=$explicit + ok "$prefer_cache" || explicit_build=$explicit set -- @@ -948,7 +949,7 @@ pkg_build_all() { pkg_etcsums pkg_tar "$pkg" - if ok "$pkg_update" || ! contains "$explicit" "$pkg"; then + if equ "$KISS_BUILD_INSTALL" 1 || ! contains "$explicit" "$pkg"; then log "$pkg" "Needed as a dependency or has an update, installing" # Intended behavior. @@ -957,7 +958,7 @@ pkg_build_all() { fi done - case $pkg_update in '') + case $KISS_BUILD_INSTALL in 1) # Intentional, globbing disabled. # shellcheck disable=2046,2086 ! prompt "Install built packages? [$explicit]" || (args i $explicit) @@ -1675,7 +1676,8 @@ pkg_upgrade() { war "Packages without repository$_repo_orp" esac - pkg_update=1 + export KISS_BUILD_INSTALL=0 + prefer_cache=1 ! contains "$*" kiss || { log "Detected package manager update" @@ -1696,8 +1698,7 @@ pkg_upgrade() { # shellcheck disable=2046,2086 set -- $order - log "Packages to update ($#): $*" - prompt + prompt "Packages to update ($#): $*" pkg_build_all "$@" log "Updated all packages" return 0