Skip to content

Instantly share code, notes, and snippets.

@RoyCurtis
Created December 3, 2016 14:16
Show Gist options
  • Save RoyCurtis/b8c09882971bc60d81e4e006c9a5b322 to your computer and use it in GitHub Desktop.
Save RoyCurtis/b8c09882971bc60d81e4e006c9a5b322 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Minecraft beta Skript update script by Roy Curtis
# CONFIGURATION:
# Path to Skript directory. DO NOT LEAVE EMPTY!
SKRIPT=/path/to/your/server/plugins/Skript/scripts
# FUNCTIONS:
function onError
{
if [ $? -ne 0 ]; then
echo -e "*** $1 ***"
exit 1
fi
}
# OPTIONS:
while test $# -gt 0
do
case "$1" in
--skip-commit) skipCommit=true
;;
--skip-push) skipPush=true
;;
*) echo "[SKRIPT] Unknown param '$1'"
echo "Usage: updateSkript.sh [OPTIONS]"
echo ""
echo " --skip-commit Don't commit changes"
echo " --skip-push Don't push to origin"
exit 1
;;
esac
shift
done
# SCRIPT:
cd $SKRIPT
echo -e "[SKRIPT] Working in directory $SKRIPT"
if [ -z $skipCommit ]; then
echo -e "[SKRIPT] Adding all changes..."
git add -Ai
onError "Could not git add; see above!"
echo -e "[SKRIPT] Creating commit..."
git commit
onError "Could not commit; was it aborted?"
fi
if [ -z $skipPush ]; then
echo -e "[SKRIPT] Pushing to origin..."
git push origin
onError "Could not push to origin; see above!"
fi
history -c
echo -e "[SKRIPT] Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment