cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 35a36f6143758002b30bce586c14ec04cedb8c28
parent 705e12a91601be213b5cba56b9a369b1b70d8feb
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Thu, 11 Jul 2019 09:14:17 +0300

kiss: Make update actually update.

Diffstat:
Mkiss | 37++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)

diff --git 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() {