From 95473534a3960f3c1748c763e3b0c89167903b80 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sat, 18 Sep 2021 11:56:36 -0400 Subject: [PATCH] [+] Create automatic update script --- scripts/includes/update.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/includes/update.sh diff --git a/scripts/includes/update.sh b/scripts/includes/update.sh new file mode 100644 index 0000000..6b0b291 --- /dev/null +++ b/scripts/includes/update.sh @@ -0,0 +1,21 @@ +pushd $SCR + +prefix="&7[&3zshrc&7]" + +# Check for updates +git fetch origin +reslog=$(git log HEAD..origin/master --oneline) +if [[ "${reslog}" != "" ]] ; then + + # Has updates + color "$prefix &cYour zshrc is outdated. Automatically updating..." + + # Try to pull + if git pull; then + color "$prefix &aUpdated!" + else + color "$prefix &cUpdate failed!" + fi +fi + +popd