Updater script for Pleroma
Just a quick bash script I wrote. Just tested and confirmed working it will update and compile on its own although if you are running as a service you still need to manually restart that. Note: This should be ran as the pleroma user.
#!/bin/bash
echo -e "Checking for update.."
git remote update
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
if [ $LOCAL = $REMOTE ]; then
echo "Up-to-date. No need to continue."
exit 0
elif [ $LOCAL = $BASE ]; then
echo "Need to pull"
echo "Pulling in 10 seconds. CTRL+C to cancel.."
sleep 10
git pull
mix clean
mix compile
elif [ $REMOTE = $BASE ]; then
echo "You are AHEAD of this branch! (oops!)"
exit 0
else
echo "Diverged. Oops."
exit 0
fi
exit 0
Edited by Hyper! (Stitch)