Update ... update.sh

This commit is contained in:
Dalf 2019-07-11 17:13:31 +02:00
parent 518650fc80
commit d1d553bb65

View file

@ -2,6 +2,8 @@
. ./util.sh . ./util.sh
SERVICE_NAME="searx-docker.service"
if [ ! -x "${which systemctl}" ]; then if [ ! -x "${which systemctl}" ]; then
echo "systemctl not found" 1>&2 echo "systemctl not found" 1>&2
exit 1 exit 1
@ -15,26 +17,19 @@ fi
# stop the systemd service # stop the systemd service
systemctl stop searx-docker.service systemctl stop searx-docker.service
# save local modification # update, change to 'git pull --rebase --autostash origin master' at your own risk
git stash push git pull --ff-only --autostash origin master
# update only if fast forward can be used, saver than "git pull --rebase" if [ $(git ls-files -u | wc -l) -gt 0 ]; then
git pull --ff-only || { echo "There are git conflicts"
git stash pop else
echo "The local and remote branches have diverged. Please update manually." # update docker images
echo "Use\n systemctl start searx-docker.service\nto restart searx" docker-compose pull
exit 1
}
# re-apply local modification # update searx configuration
git stash pop source ./.env
docker-compose run searx ${SEARX_COMMAND} -d
# update docker images fi
docker-compose pull
# update searx configuration
source ./.env
docker-compose run searx ${SEARX_COMMAND} -d
# let the user see # 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"