diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-08-14 09:58:13 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-08-14 09:58:13 +0000 |
commit | 82905448ca82a5b84fd7268f55ef963264f894c7 (patch) | |
tree | 37eb50e90f50f74b057ce464cdd09730f15b0113 /kiss | |
parent | 504919309c7c0aae1d51fa9a6b61ee9a1cead320 (diff) | |
download | cpt-82905448ca82a5b84fd7268f55ef963264f894c7.tar.gz |
kiss: smarter updates
FossilOrigin-Name: fe84b63044264ff79217feca5761db042245585ade6ddf65424255663fdc8ac8
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -765,8 +765,32 @@ pkg_updates() { # 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) + cd "$repo" + + # Go to the root of the repository (if it exists). + cd "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null ||: + + [ -d .git ] || { + log "[$repo]: Not a git repository, skipping..." + continue + } + + case $repos in + # If the repository has already been updated, skip it. + *" $PWD "*) ;; + *) + repos="$repos $PWD " + + log "[$PWD]: Updating repository." + + if [ -w "$PWD" ]; then + git pull + else + log "[$PWD]: Need root to update." + sudo git pull + fi + ;; + esac done log "Checking for new package versions..." @@ -818,6 +842,8 @@ pkg_clean() { # to the build. [ "$KISS_DEBUG" = 1 ] && return + log "Cleaning cache directories..." + # Remove temporary directories. rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir" @@ -967,7 +993,7 @@ args() { # Print version and exit. v|ve|ver|vers|versi|versio|version) - log "kiss 0.6.0" + log "kiss 0.6.1" ;; # Print usage and exit. |