diff --git a/actions/searx b/actions/searx index 10f70cb53..3f34ffdb0 100755 --- a/actions/searx +++ b/actions/searx @@ -25,9 +25,11 @@ import os import secrets import shutil -from plinth import action_utils +from plinth import action_utils, cfg from plinth.utils import YAMLFile, gunzip +SETTINGS_FILE = '/etc/searx/settings.yml' + def parse_arguments(): """Return parsed command line arguments as dictionary.""" @@ -60,25 +62,33 @@ def _copy_uwsgi_configuration(): def _generate_secret_key(): """ Generate a secret key for the Searx installation.""" - settings_file = '/etc/searx/settings.yml' - # Create settings file if not exists - if not os.path.exists(settings_file): + if not os.path.exists(SETTINGS_FILE): example_settings_file = '/usr/share/doc/searx/examples/settings.yml.gz' - gunzip(example_settings_file, settings_file) + gunzip(example_settings_file, SETTINGS_FILE) # Generate and set a secret key - with YAMLFile(settings_file) as settings: + with YAMLFile(SETTINGS_FILE) as settings: secret_key = secrets.token_hex(32) settings['server']['secret_key'] = secret_key action_utils.service_restart('uwsgi') +def _set_title(): + """Set the page title to '{box_name} Web Search'.""" + with YAMLFile(SETTINGS_FILE) as settings: + title = 'FreedomBox Web Search' + settings['general']['instance_name'] = title + + action_utils.service_restart('uwsgi') + + def subcommand_setup(_): """Post installation actions for Searx""" _copy_uwsgi_configuration() _generate_secret_key() + _set_title() def subcommand_enable(_):