bash scripts: source code cleaned up (shellcheck)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-04-10 14:00:52 +02:00
parent ebde9d10fd
commit 67afa6b1fb
2 changed files with 5 additions and 15 deletions

View File

@ -767,14 +767,10 @@ apache_dissable_site() {
sudo -H a2dissite -q "${CONF}" sudo -H a2dissite -q "${CONF}"
;; ;;
arch-*) arch-*)
mkdir -p "${APACHE_SITES_ENABLED}"
rm -f "${APACHE_SITES_ENABLED}/${CONF}" rm -f "${APACHE_SITES_ENABLED}/${CONF}"
ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
;; ;;
fedora-*) fedora-*)
mkdir -p "${APACHE_SITES_ENABLED}"
rm -f "${APACHE_SITES_ENABLED}/${CONF}" rm -f "${APACHE_SITES_ENABLED}/${CONF}"
ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
;; ;;
esac esac
apache_reload apache_reload
@ -1314,11 +1310,11 @@ primary_ip() {
case $DIST_ID in case $DIST_ID in
arch) arch)
echo "$(ip -o addr show \ ip -o addr show \
| sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\2/p' \ | sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\2/p' \
| head -n 1)" | head -n 1
;; ;;
*) echo "$(hostname -I | cut -d' ' -f1)" ;; *) hostname -I | cut -d' ' -f1 ;;
esac esac
} }
@ -1334,5 +1330,6 @@ url_replace_hostname(){
# url_replace_hostname http://searx-ubu1604/morty $(primary_ip) # url_replace_hostname http://searx-ubu1604/morty $(primary_ip)
# http://10.246.86.250/morty # http://10.246.86.250/morty
# shellcheck disable=SC2001
echo "$1" | sed "s|\(http[s]*://\)[^/]*\(.*\)|\1$2\2|" echo "$1" | sed "s|\(http[s]*://\)[^/]*\(.*\)|\1$2\2|"
} }

View File

@ -580,13 +580,6 @@ EOF
set_result_proxy() { set_result_proxy() {
info_msg "try to set result proxy ..." info_msg "try to set result proxy ..."
local line
local stage=0
local url=" url: $1"
local key=" key: $2"
if [[ -z $2 ]]; then
key=
fi
cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak" cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak"
_set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}" _set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}"
} }