mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
searx: Fix installation issue for 0.16.0
- The Debian package doesn't ship a gzip compressed settings file anymore. - Tested both the cases - settings.yml.gz and settings.yml Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net> [sunil: Create parent directory before simple copy of settings.yml] [sunil: Use pathlib for simpler code] Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
ffb4e141bb
commit
9876c153ba
@ -21,6 +21,7 @@ Configuration helper for searx.
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import secrets
|
import secrets
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
@ -142,14 +143,26 @@ def write_settings(settings):
|
|||||||
yaml.dump(settings, settings_file)
|
yaml.dump(settings, settings_file)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_example_settings_file():
|
||||||
|
searx_doc_dir = pathlib.Path('/usr/share/doc/searx/examples/')
|
||||||
|
if (searx_doc_dir / 'settings.yml').exists():
|
||||||
|
return searx_doc_dir / 'settings.yml'
|
||||||
|
|
||||||
|
return searx_doc_dir / 'settings.yml.gz'
|
||||||
|
|
||||||
|
|
||||||
def subcommand_setup(_):
|
def subcommand_setup(_):
|
||||||
"""Post installation actions for Searx"""
|
"""Post installation actions for Searx"""
|
||||||
_copy_uwsgi_configuration()
|
_copy_uwsgi_configuration()
|
||||||
_update_uwsgi_configuration()
|
_update_uwsgi_configuration()
|
||||||
|
|
||||||
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'
|
example_settings_file = _get_example_settings_file()
|
||||||
gunzip(example_settings_file, SETTINGS_FILE)
|
if example_settings_file.suffix == '.gz':
|
||||||
|
gunzip(str(example_settings_file), SETTINGS_FILE)
|
||||||
|
else:
|
||||||
|
pathlib.Path(SETTINGS_FILE).parent.mkdir(mode=0o755)
|
||||||
|
shutil.copy(example_settings_file, SETTINGS_FILE)
|
||||||
|
|
||||||
settings = read_settings()
|
settings = read_settings()
|
||||||
_generate_secret_key(settings)
|
_generate_secret_key(settings)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user