From ab4acaecbe8beceda2408c3fa6bff25261377199 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Thu, 11 Jul 2019 06:14:17 +0000 Subject: kiss: Make update actually update. FossilOrigin-Name: beb6a6497588e97c2899c591d207da2d5cba1790e563b83bea5d8c1715b5f321 --- kiss | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index ddff77b..eb1080d 100755 --- a/kiss +++ b/kiss @@ -370,7 +370,15 @@ pkg_build() { set -- $missing_deps set +f } + log "Building: $*." + log "Continue?: [y/n]." + + # POSIX 'read' has none of the "nice" options like '-n', '-p' + # etc etc. This is the most basic usage of 'read'. + read -r REPLY + [ "$REPLY" = y ] || exit + log "Checking to see if any dependencies have already been built..." log "Installing any pre-built dependencies..." @@ -746,9 +754,36 @@ pkg_updates() { read -r re_ver re_rel < "$repo_dir/version" # Compare installed packages to repository packages. - [ "$db_ver-$db_rel" != "$re_ver-$re_rel" ] && + [ "$db_ver-$db_rel" != "$re_ver-$re_rel" ] && { printf '%s\n' "${pkg##*/} $db_ver-$db_rel ==> $re_ver-$re_rel" + outdated="$outdated${pkg##*/} " + } done + + # End here if no packages have an update. + [ "$outdated" ] || { + log "Everything is up to date." + return + } + + # Disable globbing with 'set -f' to ensure that the unquoted + # variable doesn't expand into anything nasty. + # shellcheck disable=2086,2046 + { + set -f + set -- $outdated + set +f + } + + log "Packages to update: ${outdated% }." + log "Update packages?: [y/n]." + + # POSIX 'read' has none of the "nice" options like '-n', '-p' + # etc etc. This is the most basic usage of 'read'. + read -r REPLY + + # Update any outdated packages if 'y' was inputted above. + [ "$REPLY" = y ] && pkg_build "$@" } setup_caching() { -- cgit v1.2.3