aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-07-04 06:36:21 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-07-04 06:36:21 +0000
commit63a4f37a3315cba293a4f7cbbc530fe3cb988c03 (patch)
treee7f47786d886ddc201145b1c30e5a3531bd81c89
parent0a1eae5da559094e83c7a9b25d354cf194320d27 (diff)
downloadcpt-63a4f37a3315cba293a4f7cbbc530fe3cb988c03.tar.gz
kiss: Make update pull latest repositories.
FossilOrigin-Name: a95746e5da8ada6bdd3dc715c6cf864c71654d7bf62c6346d86f8db46f742141
-rwxr-xr-xkiss29
1 files changed, 28 insertions, 1 deletions
diff --git a/kiss b/kiss
index d4676b5..054ccb9 100755
--- a/kiss
+++ b/kiss
@@ -680,6 +680,29 @@ pkg_updates() {
# Check all installed packages for updates. So long as the installed
# version and the version in the repositories differ, it's considered
# an update.
+
+ # Disable globbing with 'set -f' to ensure that the unquoted
+ # variable doesn't expand into anything nasty.
+ # shellcheck disable=2086,2046
+ {
+ set -f
+ IFS=:
+ set -- $KISS_PATH
+ IFS=$old_ifs
+ set +f
+ }
+
+ log "Updating repositories..."
+
+ # Update each repository in '$KISS_PATH'. It is assumed that
+ # each repository is 'git' tracked.
+ for repo; do
+ log "[${repo##*/}]: Updating repository."
+ (cd "$repo"; git rev-parse --git-dir >/dev/null && git pull)
+ done
+
+ log "Checking for new package versions..."
+
for pkg in "$KISS_ROOT/var/db/kiss/"*; do
# Find the package's repository files. This needs to keep
# happening as we can't store this data in any kind of data
@@ -693,7 +716,7 @@ pkg_updates() {
# Compare installed packages to repository packages.
[ "$db_ver-$db_rel" != "$re_ver-$re_rel" ] &&
- printf '%s\n' "${pkg##*/} $re_ver-$re_rel"
+ printf '%s\n' "${pkg##*/} $db_ver-$db_rel ==> $re_ver-$re_rel"
done
}
@@ -837,6 +860,10 @@ main() {
# that it doesn't change beneath us.
pid=$$
+ # Store the original value of IFS so we can revert back to it if the
+ # variable is ever changed.
+ old_ifs=$IFS
+
# Catch errors and ensure that build files and directories are cleaned
# up before we die. This occurs on 'Ctrl+C' as well as sucess and error.
trap pkg_clean EXIT INT