From d1d553bb65c365769d726391706670c43a7ddaa1 Mon Sep 17 00:00:00 2001 From: Dalf Date: Thu, 11 Jul 2019 17:13:31 +0200 Subject: [PATCH] Update ... update.sh --- update.sh | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/update.sh b/update.sh index ea0a0e9..4d70ba9 100755 --- a/update.sh +++ b/update.sh @@ -2,6 +2,8 @@ . ./util.sh +SERVICE_NAME="searx-docker.service" + if [ ! -x "${which systemctl}" ]; then echo "systemctl not found" 1>&2 exit 1 @@ -15,26 +17,19 @@ fi # stop the systemd service systemctl stop searx-docker.service -# save local modification -git stash push +# update, change to 'git pull --rebase --autostash origin master' at your own risk +git pull --ff-only --autostash origin master -# update only if fast forward can be used, saver than "git pull --rebase" -git pull --ff-only || { - git stash pop - echo "The local and remote branches have diverged. Please update manually." - echo "Use\n systemctl start searx-docker.service\nto restart searx" - exit 1 -} +if [ $(git ls-files -u | wc -l) -gt 0 ]; then + echo "There are git conflicts" +else + # update docker images + docker-compose pull -# re-apply local modification -git stash pop - -# update docker images -docker-compose pull - -# update searx configuration -source ./.env -docker-compose run searx ${SEARX_COMMAND} -d + # update searx configuration + source ./.env + docker-compose run searx ${SEARX_COMMAND} -d +fi # let the user see -echo "Use\n systemctl start searx-docker.service\nto restart searx" +echo "Use\nsystemctl start searx-docker.service\nto restart searx"