aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-07-11 06:14:17 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-07-11 06:14:17 +0000
commitab4acaecbe8beceda2408c3fa6bff25261377199 (patch)
tree611361305809dff8a8f87c7f5484e7ec4325b86f
parent00e345bb3d2c1bdf3d5c9cbc3ffbcb26fa6b2905 (diff)
downloadcpt-ab4acaecbe8beceda2408c3fa6bff25261377199.tar.gz
kiss: Make update actually update.
FossilOrigin-Name: beb6a6497588e97c2899c591d207da2d5cba1790e563b83bea5d8c1715b5f321
-rwxr-xr-xkiss37
1 files changed, 36 insertions, 1 deletions
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() {