From a24e66e7d220924f2d98d8bf0e16cd4cd60fa632 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Tue, 22 May 2018 22:32:24 +0200 Subject: [PATCH 1/3] Fix upgrade process, stretch support and linter --- manifest.json | 6 +++--- scripts/backup | 7 +++++++ scripts/install | 15 ++++++++++++--- scripts/restore | 7 +++++++ scripts/upgrade | 21 +++++++++++++++++++-- 5 files changed, 48 insertions(+), 8 deletions(-) diff --git a/manifest.json b/manifest.json index e168c92..0fd0b35 100644 --- a/manifest.json +++ b/manifest.json @@ -7,15 +7,15 @@ "fr": "Un méta-moteur de recherche respectueux de la vie privée et bidouillable", "de": "Eine Meta-Suchmaschine, die den Privatsphäre wahrt und 'hackable' ist." }, - "version": "0.13.1-1", + "version": "0.13.1~ynh1", "url": "https://asciimoo.github.io/searx/", - "license": "AGPLv3", + "license": "AGPL-3.0-or-later", "maintainer": { "name": "opi", "email": "opi@zeropi.net" }, "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 2.7.12" }, "multi_instance": false, "services": [ diff --git a/scripts/backup b/scripts/backup index 96afb05..9c08491 100755 --- a/scripts/backup +++ b/scripts/backup @@ -21,6 +21,13 @@ set -eu # source _common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # LOAD SETTINGS #================================================= diff --git a/scripts/install b/scripts/install index b068236..1341f5f 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ ynh_app_setting_set $app is_public $is_public # INSTALL DEPENDENCIES #================================================= -ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-pybabel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python +ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv zlib1g-dev libffi-dev libssl-dev uwsgi uwsgi-plugin-python #================================================= # NGINX CONFIGURATION @@ -93,8 +93,17 @@ ynh_setup_source "$final_path" # INSTALL SEARX IN A VIRTUALENV #================================================= -virtualenv --system-site-packages "$final_path" -bash -c "source $final_path/bin/activate && pip install -U pip setuptools && pip install --requirement $final_path/requirements-ynh.txt" +virtualenv "$final_path" +#run source in a 'sub shell' +( + set +o nounset + source "$final_path/bin/activate" + set -o nounset + pip install --upgrade pip + pip install --upgrade setuptools + pip install --requirement "$final_path/requirements-ynh.txt" + pip install lxml babel +) #================================================= # CONFIGURE SEARX diff --git a/scripts/restore b/scripts/restore index ddbe66f..442b572 100755 --- a/scripts/restore +++ b/scripts/restore @@ -21,6 +21,13 @@ set -eu # source _common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # LOAD SETTINGS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c6fca67..701caac 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,6 +58,12 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS +#================================================= +# INSTALL DEPENDENCIES +#================================================= + +ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv zlib1g-dev libffi-dev libssl-dev uwsgi uwsgi-plugin-python + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -97,8 +103,19 @@ ynh_system_user_create $app #================================================= rm -r $final_path/lib/python2.7/site-packages/{pip,setuptools} $final_path/lib/python2.7/site-packages/setuptools-* $final_path/lib/python2.7/site-packages/pip-* -virtualenv --system-site-packages "$final_path" -bash -c "source $final_path/bin/activate && pip install -U pip setuptools && pip install --requirement $final_path/requirements-ynh.txt --upgrade" +virtualenv "$final_path" + +#run source in a 'sub shell' +( + set +o nounset + source "$final_path/bin/activate" + set -o nounset + pip install --upgrade pip + pip install --upgrade setuptools + pip install --requirement "$final_path/requirements-ynh.txt" + pip install lxml babel +) + #================================================= # CONFIGURE SEARX From a0af9eec9bd8acfdafaff898485c5748d6c39a4f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Tue, 22 May 2018 23:03:39 +0200 Subject: [PATCH 2/3] Last fixes for upgrade and restore --- scripts/restore | 2 +- scripts/upgrade | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 442b572..bbef000 100755 --- a/scripts/restore +++ b/scripts/restore @@ -66,7 +66,7 @@ ynh_restore_file "$final_path" # INSTALL DEPENDENCIES #================================================= -ynh_install_app_dependencies libxslt-dev virtualenv python-pybabel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python +ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv zlib1g-dev libffi-dev libssl-dev uwsgi uwsgi-plugin-python #================================================= # RECREATE OF THE DEDICATED USER diff --git a/scripts/upgrade b/scripts/upgrade index 701caac..ba72cc8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -102,7 +102,6 @@ ynh_system_user_create $app # UPGRADE SEARX IN ITS VIRTUALENV #================================================= -rm -r $final_path/lib/python2.7/site-packages/{pip,setuptools} $final_path/lib/python2.7/site-packages/setuptools-* $final_path/lib/python2.7/site-packages/pip-* virtualenv "$final_path" #run source in a 'sub shell' From c5ce7bf953bd7493fe5ad2a286f50c39ef4744d9 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Wed, 23 May 2018 19:56:05 +0200 Subject: [PATCH 3/3] restore version number --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 0fd0b35..448588e 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "fr": "Un méta-moteur de recherche respectueux de la vie privée et bidouillable", "de": "Eine Meta-Suchmaschine, die den Privatsphäre wahrt und 'hackable' ist." }, - "version": "0.13.1~ynh1", + "version": "0.14.0~ynh1", "url": "https://asciimoo.github.io/searx/", "license": "AGPL-3.0-or-later", "maintainer": {