kiss: cleanup update code

This commit is contained in:
Dylan Araps 2020-09-12 18:04:30 +03:00
parent 9f1bf8dd0e
commit e7c934167e
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 7 additions and 7 deletions

14
kiss
View File

@ -1251,11 +1251,14 @@ pkg_updates() {
# Create a list of all repositories. # Create a list of all repositories.
# See [1] at top of script. # See [1] at top of script.
# shellcheck disable=2046,2086 # shellcheck disable=2046,2086
{ IFS=:; set -- $KISS_PATH; unset IFS; } {
IFS=:
set -- $KISS_PATH
unset IFS
}
# Update each repository in '$KISS_PATH'. # Update each repository in '$KISS_PATH'.
for repo do for repo do
# Go to the root of the repository (if it exists).
cd "$repo" cd "$repo"
case $(git remote 2>/dev/null) in case $(git remote 2>/dev/null) in
@ -1265,12 +1268,9 @@ pkg_updates() {
;; ;;
*) *)
# Go to the repository's root directory.
cd "$(git rev-parse --show-toplevel)" cd "$(git rev-parse --show-toplevel)"
# Go to the real root directory if this is a submodule.
git_root=$(git rev-parse --show-superproject-working-tree) git_root=$(git rev-parse --show-superproject-working-tree)
cd "${git_root:-"$PWD"}" cd "${git_root:-.}"
contains "$repos" "$PWD" || { contains "$repos" "$PWD" || {
repos="$repos $PWD " repos="$repos $PWD "
@ -1343,7 +1343,7 @@ pkg_updates() {
# Compare installed packages to repository packages. # 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" printf '%s\n' "${pkg##*/} $db_ver-$db_rel -> $re_ver-$re_rel"
set -- "$@" "${pkg##*/}" set -- "$@" "${pkg##*/}"
} }
done done