diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2020-02-01 16:59:27 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-02-01 16:59:27 +0100 |
| commit | 709ac51d331853ad29c4f6de26c695a7aeeca125 (patch) | |
| tree | 0c8d5c4ca43287fe0e6ec940db284d6fcce3e02a /utils/searx.sh | |
| parent | 56a93ee77006499b869b2fa067b72b0171710c61 (diff) | |
utils/filtron.sh: generalize systemd, accounts and golang tasks
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/searx.sh')
| -rwxr-xr-x | utils/searx.sh | 28 |
1 files changed, 5 insertions, 23 deletions
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 <<EOF cd ${SEARX_REPO_FOLDER} @@ -491,7 +473,7 @@ EOF apache_is_installed && info_msg "Apache is installed." - if user_is_available; then + if service_account_is_available "$SERVICE_USER"; then info_msg "Service account $SERVICE_USER exists." else err_msg "Service account $SERVICE_USER does not exists!" |