Ensure that key and base url remain unchanged after updates

This commit is contained in:
Bob Mottram 2016-03-04 18:15:45 +00:00
parent 1cfe374210
commit cdf3e2d6ce
1 changed files with 7 additions and 0 deletions

View File

@ -9170,6 +9170,13 @@ function install_search_engine {
# update to a new commit if needed
set_repo_commit $SEARCH_ENGINE_PATH/searx "Search engine commit" "$SEARCH_ENGINE_COMMIT" $SEARCH_ENGINE_REPO
if grep "Search engine key" $COMPLETION_FILE; then
if [ -f ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml ]; then
SEARCH_ENGINE_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
sed -i "s|secret_key.*|secret_key : \"${SEARCH_ENGINE_SECRET_KEY}\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
sed -i "s|base_url.*|base_url : \"http://${SEARCH_ENGINE_ONION_HOSTNAME}\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
fi
fi
if grep -Fxq "install_search_engine" $COMPLETION_FILE; then
return