From 05009d2414e3ccc18fb691eec4980e6bf3222870 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rault Date: Thu, 8 Dec 2016 16:12:16 +0100 Subject: [PATCH] =?UTF-8?q?Compliance=20with=20Yunohost=E2=80=99s=20packag?= =?UTF-8?q?e=20linter=20(except=20scripts/{backup,restore})?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 25 +++++++++++++++++++------ scripts/install | 11 +++++++---- scripts/remove | 2 +- scripts/upgrade | 12 ++++++------ 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/manifest.json b/manifest.json index e112e88..32a2bef 100644 --- a/manifest.json +++ b/manifest.json @@ -1,29 +1,42 @@ { "name": "Firefox Sync Server", "id": "ffsync", + "url": "https://github.com/abeudin/ffsync_ynh", + "packaging_format": 1, "description": { - "en": "", - "fr": "" + "en": "Mozilla’s Sync-Server to host your Firefox account data", + "fr": "Le serveur de synchronisation de Mozilla, pour héberger vos données Firefox" }, - "developer": { + "maintainer": { "name": "beudbeud", "email": "beudbeud@beudibox.fr", "url": "https://github.com/balu-/FSyncMS" }, - "multi_instance": "false", + "requirements": { + "yunohost": ">> 2.4.0" + }, + "license": "free", + "services": [ + "nginx" + ], + "multi_instance": false, "arguments": { "install" : [ { "name": "domain", + "type": "domain", "ask": { - "en": "Choose a domain for Firefox-Sync Server" + "en": "Choose a domain for Firefox-Sync Server", + "fr": "Choisissez un domaine pour Firefox-Sync" }, "example": "domain.org" }, { "name": "path", + "type": "path", "ask": { - "en": "Choose a path for Firefox-Sync Server" + "en": "Choose a path for Firefox-Sync Server", + "fr": "Choisissez un chemin pour Firefox-Sync" }, "example": "/ffsync", "default": "/ffsync" diff --git a/scripts/install b/scripts/install index 55cd2bd..0392e27 100644 --- a/scripts/install +++ b/scripts/install @@ -1,5 +1,8 @@ #!/bin/bash +# Source app helpers +. /usr/share/yunohost/helpers + # Retrieve arguments domain=$1 path=$2 @@ -7,7 +10,7 @@ path=$2 # Check domain/path availability sudo yunohost app checkurl $domain$path -a ffsync if [[ ! $? -eq 0 ]]; then - exit 1 + ynh_die fi # Generate random password @@ -18,11 +21,11 @@ db_user=ffsync # Initialize database and store mysql password for upgrade sudo yunohost app initdb $db_user -p $db_pwd -sudo yunohost app setting ffsync mysqlpwd -v $db_pwd +sudo ynh_app_setting_set ffsync mysqlpwd $db_pwd # Generate random password and save secret=$(head -c 20 /dev/urandom | sha1sum | cut -d " " -f1) -sudo yunohost app setting ffsync secret -v $secret +sudo ynh_app_setting_set ffsync secret $secret # Check depends installation sudo apt-get install make python-dev python-virtualenv -y @@ -93,4 +96,4 @@ sudo service ffsync restart sudo yunohost app ssowatconf sudo service nginx restart sudo yunohost service add ffsync -l /var/log/ffsync.log -sudo yunohost app setting ffsync skipped_uris -v "/" +sudo ynh_app_setting_set ffsync skipped_uris "/" diff --git a/scripts/remove b/scripts/remove index 01a9737..04429b0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -3,7 +3,7 @@ db_user=ffsync db_name=ffsync root_pwd=$(sudo cat /etc/yunohost/mysql) -domain=$(sudo yunohost app setting ffsync domain) +domain=$(sudo ynh_app_setting_get ffsync domain) mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" sudo rm -rf /opt/yunohost/ffsync diff --git a/scripts/upgrade b/scripts/upgrade index 396f0c9..da31a1b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,19 +1,19 @@ #!/bin/bash # Retrieve arguments -domain=$(sudo yunohost app setting ffsync domain) -path=$(sudo yunohost app setting ffsync path) -db_pwd=$(sudo yunohost app setting ffsync mysqlpwd) +domain=$(sudo ynh_app_setting_get ffsync domain) +path=$(sudo ynh_app_setting_get ffsync path) +db_pwd=$(sudo ynh_app_setting_get ffsync mysqlpwd) db_user=ffsync final_path=/opt/yunohost/ffsync # Get secret variable -secret=$(sudo yunohost app setting ffsync secret) +secret=$(sudo ynh_app_setting_get ffsync secret) # Get from conf file if not defined if [[ -z $secret ]] then secret=$(sudo grep "secret =" $final_path/syncserver.ini | cut -d" " -f3) - sudo yunohost app setting ffsync secret -v $secret + sudo ynh_app_setting_set ffsync secret $secret fi # Check Swap @@ -81,5 +81,5 @@ sudo service ffsync restart # Reload Nginx and regenerate SSOwat conf sudo service nginx reload -sudo yunohost app setting ffsync skipped_uris -v "/" +sudo ynh_app_setting_set ffsync skipped_uris "/" sudo yunohost app ssowatconf