Last active
August 2, 2022 11:57
-
-
Save Ogromny/af6ff358b0c9747c06652ca2781cb7cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh -e | |
# Ogromny <ogromnycoding@gmail.com> | |
TMP_FILE=$(mktemp) | |
PACKAGES_TO_UPDATE="" | |
# color | |
BLUE="\033[1;34m" | |
RESET="\033[0m" | |
log() { | |
printf "$BLUE[info] %s$RESET\n" "$@" | |
} | |
# get git package | |
kiss list > "$TMP_FILE" | |
while read -r package version; do | |
case "$version" in | |
git-*) log "Found package $package" ;; | |
*) continue ;; | |
esac | |
cd "$HOME/.cache/kiss/sources/$package/$package" | |
log "Checking if there's update available" | |
git fetch | |
# get remote/HEAD branch name | |
REMOTE_BRANCH=$(git remote show origin | grep "HEAD branch:" | xargs | cut -d" " -f3) | |
if [ $(git rev-list HEAD...origin/master --count) = "0" ]; then | |
log "No update available for $package" | |
continue | |
fi | |
log "Update available for $package" | |
PACKAGES_TO_UPDATE="${PACKAGES_TO_UPDATE}${package} " | |
done < "$TMP_FILE" | |
if [ -n $PACKAGES_TO_UPDATE ]; then | |
log "Everythings is up to date !" | |
else | |
log "Will update $PACKAGES_TO_UPDATE" | |
kiss build $PACKAGES_TO_UPDATE | |
fi | |
rm "$TMP_FILE" | |
log "See ya soon !" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment