From 709ac51d331853ad29c4f6de26c695a7aeeca125 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 1 Feb 2020 16:59:27 +0100 Subject: utils/filtron.sh: generalize systemd, accounts and golang tasks Signed-off-by: Markus Heiser --- utils/searx.sh | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'utils/searx.sh') diff --git a/utils/searx.sh b/utils/searx.sh index ad8515d4f..47aad286b 100755 --- a/utils/searx.sh +++ b/utils/searx.sh @@ -124,7 +124,7 @@ main() { shell) sudo_or_exit - interactive_shell + interactive_shell "${SERVICE_USER}" ;; inspect) case $2 in @@ -153,7 +153,7 @@ main() { sudo_or_exit case $2 in all) remove_all;; - user) remove_user ;; + user) drop_service_account "${SERVICE_USER}";; pyenv) remove_pyenv ;; searx-src) remove_searx ;; *) usage "$_usage"; exit 42;; @@ -250,7 +250,7 @@ cp -f ${SEARX_SETTINGS}.backup ${SEARX_SETTINGS} EOF ;; "start interactiv shell") - interactive_shell + interactive_shell "${SERVICE_USER}" ;; esac chown "${SERVICE_USER}:${SERVICE_USER}" "${SEARX_SETTINGS}" @@ -275,16 +275,12 @@ installations that were installed with this script." fi remove_searx_uwsgi wait_key - remove_user + drop_service_account "${SERVICE_USER}" if service_is_available "${PUBLIC_URL}"; then MSG="** Don't forgett to remove your public site! (${PUBLIC_URL}) **" wait_key 10 fi } -user_is_available() { - sudo -i -u "$SERVICE_USER" echo \$HOME &>/dev/null -} - assert_user() { rst_title "user $SERVICE_USER" section echo @@ -299,15 +295,6 @@ EOF #echo "export SERVICE_HOME=$SERVICE_HOME" } -remove_user() { - rst_title "Drop $SERVICE_USER HOME" section - if ask_yn "Do you really want to drop $SERVICE_USER home folder?"; then - userdel -r -f "$SERVICE_USER" 2>&1 | prefix_stdout - else - rst_para "Leave HOME folder $(du -sh "$SERVICE_HOME") unchanged." - fi -} - clone_is_available() { [[ -f "$SEARX_SETTINGS" ]] } @@ -445,11 +432,6 @@ deactivate_service() { uWSGI_restart } -interactive_shell(){ - echo "// exit with ${_BCyan}CTRL-D${_creset}" - sudo -H -u ${SERVICE_USER} -i -} - git_diff() { sudo -H -u "${SERVICE_USER}" -i <