on master help sign in
bash scripts: source code cleaned up (shellcheck)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit67afa6b1fbb635626f278958980b87d3e8fed12c authorMarkus Heiser <markus.heiser@darmarit.de> dateFri 10 Apr 2020, 14:00 (7 years ago) parentebde9d1
2 files changed+5−15
utils/lib.sh+5−8 utils/searx.sh−7
utils/lib.sh+5−8
@@ -767,14 +767,10 @@ apache_dissable_site() {
767767 sudo -H a2dissite -q "${CONF}"
768768 ;;
769769 arch-*)
770− mkdir -p "${APACHE_SITES_ENABLED}"
771770 rm -f "${APACHE_SITES_ENABLED}/${CONF}"
772− ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
773771 ;;
774772 fedora-*)
775− mkdir -p "${APACHE_SITES_ENABLED}"
776773 rm -f "${APACHE_SITES_ENABLED}/${CONF}"
777− ln -s "${APACHE_SITES_AVAILABLE}/${CONF}" "${APACHE_SITES_ENABLED}/${CONF}"
778774 ;;
779775 esac
780776 apache_reload
@@ -1314,11 +1310,11 @@ primary_ip() {
13141310
13151311 case $DIST_ID in
13161312 arch)
1317− echo "$(ip -o addr show \
1318− | sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\2/p' \
1319− | head -n 1)"
1313+ ip -o addr show \
1314+ | sed -nr 's/[0-9]*:\s*([a-z0-9]*).*inet[6]?\s*([a-z0-9.:]*).*scope global.*/\2/p' \
1315+ | head -n 1
13201316 ;;
1321− *) echo "$(hostname -I | cut -d' ' -f1)" ;;
1317+ *) hostname -I | cut -d' ' -f1 ;;
13221318 esac
13231319}
13241320
@@ -1334,5 +1330,6 @@ url_replace_hostname(){
13341330 # url_replace_hostname http://searx-ubu1604/morty $(primary_ip)
13351331 # http://10.246.86.250/morty
13361332
1333+ # shellcheck disable=SC2001
13371334 echo "$1" | sed "s|\(http[s]*://\)[^/]*\(.*\)|\1$2\2|"
13381335}
utils/searx.sh−7
@@ -580,13 +580,6 @@ EOF
580580
581581set_result_proxy() {
582582 info_msg "try to set result proxy ..."
583− local line
584− local stage=0
585− local url=" url: $1"
586− local key=" key: $2"
587− if [[ -z $2 ]]; then
588− key=
589− fi
590583 cp "${SEARX_SETTINGS_PATH}" "${SEARX_SETTINGS_PATH}.bak"
591584 _set_result_proxy "$1" "$2" > "${SEARX_SETTINGS_PATH}"
592585}