From afeefc7f853e0298017a290454e7a82261d1c507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 15:14:23 +0200 Subject: [PATCH 1/6] [fix] Do not call ssowatconf which is already done at the end --- scripts/install | 1 - scripts/remove | 1 - scripts/upgrade | 2 -- 3 files changed, 4 deletions(-) diff --git a/scripts/install b/scripts/install index 118bbce..d7f2ae6 100755 --- a/scripts/install +++ b/scripts/install @@ -68,4 +68,3 @@ fi # Restart services sudo service nginx reload -sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove index bb1556d..6bf0b02 100755 --- a/scripts/remove +++ b/scripts/remove @@ -24,4 +24,3 @@ sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf # Restart services sudo service nginx reload -sudo yunohost app ssowatconf diff --git a/scripts/upgrade b/scripts/upgrade index e490def..1d7a349 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,5 +56,3 @@ fi # Restart services sudo service nginx reload -sudo yunohost app ssowatconf - From b822ff2cbab5ad5561cf9a9acd6e9cfeb49e12b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 15:26:27 +0200 Subject: [PATCH 2/6] [enh] Add a really simple gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..783a4ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +*.sw[op] From 760163f823900bef6ffe3e466395b5b319b98acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 15:30:49 +0200 Subject: [PATCH 3/6] [fix] Update arguments passed to the scripts --- scripts/backup | 10 +++++----- scripts/install | 3 ++- scripts/remove | 4 +++- scripts/restore | 8 +++++--- scripts/upgrade | 3 ++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/scripts/backup b/scripts/backup index f2bc33d..a87d461 100755 --- a/scripts/backup +++ b/scripts/backup @@ -3,12 +3,12 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} -# The parameter $1 is the backup directory location -# which will be compressed afterward -backup_dir=$1/apps/$app -sudo mkdir -p $backup_dir +# The first argument is the backup directory location for the app +# from where the script is executed and which will be compressed afterward +backup_dir=$1 # Backup sources & data sudo cp -a /var/www/$app/. $backup_dir/sources diff --git a/scripts/install b/scripts/install index d7f2ae6..3af9c08 100755 --- a/scripts/install +++ b/scripts/install @@ -3,7 +3,8 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} # Retrieve arguments domain=$1 diff --git a/scripts/remove b/scripts/remove index 6bf0b02..54028f3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,5 +1,7 @@ #!/bin/bash -app=ynhexample + +# The last argument is the app instance name +app=${!#} # Retrieve arguments domain=$(sudo yunohost app setting $app domain) diff --git a/scripts/restore b/scripts/restore index 1c20f2e..cde2e6b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -3,10 +3,12 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} -# The parameter $1 is the uncompressed restore directory location -backup_dir=$1/apps/$app +# The first argument is the backup directory location of the app +# from where the script is executed +backup_dir=$1 # Restore sources & data sudo cp -a $backup_dir/sources/. /var/www/$app diff --git a/scripts/upgrade b/scripts/upgrade index 1d7a349..e285496 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,7 +3,8 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} # Retrieve arguments domain=$(sudo yunohost app setting $app domain) From f34527ba0114d87e08cc0166741e1b3950c9fdc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 15:57:04 +0200 Subject: [PATCH 4/6] [fix] Use boolean type for the multi_instance manifest key --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 3b4060b..5b08d9c 100644 --- a/manifest.json +++ b/manifest.json @@ -12,7 +12,7 @@ "email": "john.doe@example.com", "url": "http://example.com" }, - "multi_instance": "false", + "multi_instance": false, "services": [ "nginx", "php5-fpm", From e4befaebe5fba42fb0aae036146caca7acd38ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 15:57:57 +0200 Subject: [PATCH 5/6] [enh] Use boolean for is_public and add a language choice argument --- manifest.json | 16 ++++++++-------- scripts/install | 4 +++- scripts/upgrade | 3 ++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/manifest.json b/manifest.json index 5b08d9c..347fbd8 100644 --- a/manifest.json +++ b/manifest.json @@ -50,21 +50,21 @@ }, { "name": "is_public", + "type": "boolean", "ask": { "en": "Is it a public application?", "fr": "Est-ce une application publique ?" }, - "choices": ["Yes", "No"], - "default": "Yes" + "default": true }, { - "name": "my_boolean", - "type": "boolean", - "ask": { - "en": "Do you want to check this boolean ?", - "fr": "Tu veux cocher ce booléen ?" + "name": "language", + "ask": { + "en": "Choose the application language", + "fr": "Choisissez la langue de l'application" }, - "default": true + "choices": ["fr", "en"], + "default": "fr" } ] } diff --git a/scripts/install b/scripts/install index 3af9c08..1b92cf1 100755 --- a/scripts/install +++ b/scripts/install @@ -11,10 +11,12 @@ domain=$1 path=$2 admin=$3 is_public=$4 +language=$5 # Save app settings sudo yunohost app setting $app admin -v "$admin" sudo yunohost app setting $app is_public -v "$is_public" +sudo yunohost app setting $app language -v "$language" # Check domain/path availability sudo yunohost app checkurl $domain$path -a $app \ @@ -56,7 +58,7 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf #sudo chmod 644 $finalphpconf # If app is public, add url to SSOWat conf as skipped_uris -if [ "$is_public" = "Yes" ]; +if [[ $is_public -eq 1 ]]; then # unprotected_uris allows SSO credentials to be passed anyway. sudo yunohost app setting $app unprotected_uris -v "/" diff --git a/scripts/upgrade b/scripts/upgrade index e285496..62b7716 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,6 +11,7 @@ domain=$(sudo yunohost app setting $app domain) path=$(sudo yunohost app setting $app path) admin=$(sudo yunohost app setting $app admin) is_public=$(sudo yunohost app setting $app is_public) +language=$(sudo yunohost app setting $app language) # Remove trailing "/" for next commands path=${path%/} @@ -43,7 +44,7 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf #sudo chmod 644 $finalphpconf # If app is public, add url to SSOWat conf as skipped_uris -if [ "$is_public" = "Yes" ]; +if [[ $is_public -eq 1 ]]; then # See install script sudo yunohost app setting $app unprotected_uris -v "/" From e926de87ae75cd74d71426d4540fa77e90c5d16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 16:08:00 +0200 Subject: [PATCH 6/6] [fix] Define final_path variable in restore script --- scripts/restore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index cde2e6b..dcea94c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -11,7 +11,8 @@ app=${!#} backup_dir=$1 # Restore sources & data -sudo cp -a $backup_dir/sources/. /var/www/$app +final_path=/var/www/$app +sudo cp -a $backup_dir/sources/. $final_path # Restore permissions to app files # you may need to make some file and/or directory writeable by www-data (nginx user)