Update ... update.sh

This commit is contained in:
Dalf 2019-07-11 17:13:31 +02:00
parent 518650fc80
commit d1d553bb65
1 changed files with 14 additions and 19 deletions

View File

@ -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"