1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-11-19 13:00:05 -07:00

kiss: Make update pull latest repositories.

This commit is contained in:
Dylan Araps 2019-07-04 09:36:22 +03:00
parent 750b779a96
commit 8f8042672e

29
kiss
View File

@ -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