Skip to content

Instantly share code, notes, and snippets.

@SathvikKS
Created December 25, 2018 01:58
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Auto Update script.
dir="/path/to/local/repo/"
cd $HOME/$dir
git checkout origin/master *
echo "Searching for updates. Please wait :)"
touch $HOME/.sksupdater
rm $HOME/.sksupdater
git fetch --dry-run 2>&1 > /dev/null| tee $HOME/.sksupdater
up=$HOME/.sksupdater
if grep -q origin/master "$up"; then
clear
echo "Updates are found. Now updating"
sleep 1
update=$(git fetch --all
git reset --hard origin/master
git pull)
clear
chmod +x *
echo "Update done. Restarting"
sleep 2
reload=$(readlink -f "$0")
exec "$reload"
else
chmod +x *
echo "No updates"
sleep 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment