Merge branch 'testing' into envvar

This commit is contained in:
Jérôme Lebleu 2016-04-26 16:13:03 +02:00
commit 8abe2a9325
7 changed files with 26 additions and 22 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*~
*.sw[op]

View File

@ -53,21 +53,21 @@
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean",
"ask": { "ask": {
"en": "Is it a public application?", "en": "Is it a public application?",
"fr": "Est-ce une application publique ?" "fr": "Est-ce une application publique ?"
}, },
"choices": ["Yes", "No"], "default": true
"default": "Yes"
}, },
{ {
"name": "my_boolean", "name": "language",
"type": "boolean",
"ask": { "ask": {
"en": "Do you want to check this boolean ?", "en": "Choose the application language",
"fr": "Tu veux cocher ce booléen ?" "fr": "Choisissez la langue de l'application"
}, },
"default": true "choices": ["fr", "en"],
"default": "fr"
} }
] ]
} }

View File

@ -5,10 +5,9 @@ set -e
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# The parameter $1 is the backup directory location # The first argument is the backup directory location for the app
# which will be compressed afterward # from where the script is executed and which will be compressed afterward
backup_dir=$1/apps/$app backup_dir=$1
sudo mkdir -p $backup_dir
# Backup sources & data # Backup sources & data
sudo cp -a /var/www/$app/. $backup_dir/sources sudo cp -a /var/www/$app/. $backup_dir/sources

View File

@ -20,10 +20,12 @@ domain=$YNH_APP_ARG_DOMAIN
path=$YNH_APP_ARG_PATH path=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
# Save app settings # Save app settings
sudo yunohost app setting $app admin -v "$admin" sudo yunohost app setting $app admin -v "$admin"
sudo yunohost app setting $app is_public -v "$is_public" sudo yunohost app setting $app is_public -v "$is_public"
sudo yunohost app setting $app language -v "$language"
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a $app \ sudo yunohost app checkurl $domain$path -a $app \
@ -65,7 +67,7 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
#sudo chmod 644 $finalphpconf #sudo chmod 644 $finalphpconf
# If app is public, add url to SSOWat conf as skipped_uris # If app is public, add url to SSOWat conf as skipped_uris
if [ "$is_public" = "Yes" ]; if [[ $is_public -eq 1 ]];
then then
# unprotected_uris allows SSO credentials to be passed anyway. # unprotected_uris allows SSO credentials to be passed anyway.
sudo yunohost app setting $app unprotected_uris -v "/" sudo yunohost app setting $app unprotected_uris -v "/"
@ -78,4 +80,3 @@ fi
# Restart services # Restart services
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
app=ynhexample
# The last argument is the app instance name
app=${!#}
# Retrieve arguments # Retrieve arguments
domain=$(sudo yunohost app setting $app domain) domain=$(sudo yunohost app setting $app domain)
@ -24,4 +26,3 @@ sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
# Restart services # Restart services
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf

View File

@ -5,11 +5,13 @@ set -e
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# The parameter $1 is the uncompressed restore directory location # The first argument is the backup directory location of the app
backup_dir=$1/apps/$app # from where the script is executed
backup_dir=$1
# Restore sources & data # 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 # Restore permissions to app files
# you may need to make some file and/or directory writeable by www-data (nginx user) # you may need to make some file and/or directory writeable by www-data (nginx user)

View File

@ -11,6 +11,7 @@ domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path) path=$(sudo yunohost app setting $app path)
admin=$(sudo yunohost app setting $app admin) admin=$(sudo yunohost app setting $app admin)
is_public=$(sudo yunohost app setting $app is_public) is_public=$(sudo yunohost app setting $app is_public)
language=$(sudo yunohost app setting $app language)
# Remove trailing "/" for next commands # Remove trailing "/" for next commands
path=${path%/} path=${path%/}
@ -43,7 +44,7 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
#sudo chmod 644 $finalphpconf #sudo chmod 644 $finalphpconf
# If app is public, add url to SSOWat conf as skipped_uris # If app is public, add url to SSOWat conf as skipped_uris
if [ "$is_public" = "Yes" ]; if [[ $is_public -eq 1 ]];
then then
# See install script # See install script
sudo yunohost app setting $app unprotected_uris -v "/" sudo yunohost app setting $app unprotected_uris -v "/"
@ -57,5 +58,3 @@ fi
# Restart services # Restart services
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf