Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8b4f7c7

Browse files
committed
kiss: smarter updates
1 parent 5d773e9 commit 8b4f7c7

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

kiss

+29-3
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,32 @@ pkg_updates() {
765765
# Update each repository in '$KISS_PATH'. It is assumed that
766766
# each repository is 'git' tracked.
767767
for repo; do
768-
log "[${repo##*/}]: Updating repository."
769-
(cd "$repo"; git rev-parse --git-dir >/dev/null && git pull)
768+
cd "$repo"
769+
770+
# Go to the root of the repository (if it exists).
771+
cd "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null ||:
772+
773+
[ -d .git ] || {
774+
log "[$repo]: Not a git repository, skipping..."
775+
continue
776+
}
777+
778+
case $repos in
779+
# If the repository has already been updated, skip it.
780+
*" $PWD "*) ;;
781+
*)
782+
repos="$repos $PWD "
783+
784+
log "[$PWD]: Updating repository."
785+
786+
if [ -w "$PWD" ]; then
787+
git pull
788+
else
789+
log "[$PWD]: Need root to update."
790+
sudo git pull
791+
fi
792+
;;
793+
esac
770794
done
771795

772796
log "Checking for new package versions..."
@@ -818,6 +842,8 @@ pkg_clean() {
818842
# to the build.
819843
[ "$KISS_DEBUG" = 1 ] && return
820844

845+
log "Cleaning cache directories..."
846+
821847
# Remove temporary directories.
822848
rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir"
823849

@@ -967,7 +993,7 @@ args() {
967993

968994
# Print version and exit.
969995
v|ve|ver|vers|versi|versio|version)
970-
log "kiss 0.6.0"
996+
log "kiss 0.6.1"
971997
;;
972998

973999
# Print usage and exit.

0 commit comments

Comments
 (0)