1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opensondage_ynh.git synced 2024-09-03 19:46:28 +02:00

[enh] 2.4 compatibility

This commit is contained in:
zamentur 2016-06-01 01:16:19 +02:00
parent e69b5bd37b
commit 933735e61a
6 changed files with 181 additions and 161 deletions

View file

@ -8,8 +8,11 @@
"de": "OpenSondage ist ein Online-Dienst, der Ihnen bei der Absprache von Terminen oder der Entscheidungsfindung hilft." "de": "OpenSondage ist ein Online-Dienst, der Ihnen bei der Absprache von Terminen oder der Entscheidungsfindung hilft."
}, },
"maintainer": { "maintainer": {
"name": "zamentur", "name": "ljf",
"email": "valentin@grimaud.me" "email": "ljf+yunohost@grimaud.me"
},
"requirements": {
"yunohost": ">> 2.3.12.1"
}, },
"multi_instance": "true", "multi_instance": "true",
"services": [ "services": [
@ -48,7 +51,7 @@
"fr": "Choisissez l'administrateur d'OpenSondage (doit être un utilisateur YunoHost)", "fr": "Choisissez l'administrateur d'OpenSondage (doit être un utilisateur YunoHost)",
"de": "Wählen Sie bitte den OpenSondageadministrator (muss ein vorhandener YunoHost Nutzer sein)" "de": "Wählen Sie bitte den OpenSondageadministrator (muss ein vorhandener YunoHost Nutzer sein)"
}, },
"example": "homer" "example": "johndoe"
}, },
{ {
"name": "language", "name": "language",
@ -61,14 +64,14 @@
"default": "en_GB" "default": "en_GB"
}, },
{ {
"name": "public_site", "name": "is_public",
"type": "boolean",
"ask": { "ask": {
"en": "Could non member create poll ?", "en": "Could non member create poll ?",
"fr": "Une personne non membre peut elle créer un sondage ?", "fr": "Une personne non membre peut elle créer un sondage ?",
"de": "Kann einen nicht eingeloggter Nutzer einen Umfrage erstellen?" "de": "Kann einen nicht eingeloggter Nutzer einen Umfrage erstellen?"
}, },
"choices": ["Yes", "No"], "default": true
"default": "Yes"
} }

View file

@ -1,28 +1,27 @@
#!/bin/bash #!/bin/bash
# The parameter $1 is the backup directory location dedicated to the app # Exit on command errors and treat unset variables as an error
backup_dir=$1 set -eu
# The parameter $2 is theid of the app instance # See comments in install script
app=$2 app=$YNH_APP_INSTANCE_NAME
domain=$(sudo yunohost app setting $app domain) # Source YunoHost helpers
path=$(sudo yunohost app setting $app path) . /usr/share/yunohost/helpers
admin=$(sudo yunohost app setting $app admin)
language=$(sudo yunohost app setting $app language)
public_site=$(sudo yunohost app setting $app public_site)
# Copy the app files # Backup sources & data
final_path=/var/www/$app ynh_backup "/var/www/${app}" "sources"
sudo mkdir -p ${backup_dir}/var/www
sudo cp -a $final_path "${backup_dir}/var/www/$app"
# Copy the conf files # Dump the database
sudo mkdir -p "${backup_dir}/conf" dbname=$app
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf "${backup_dir}/conf/nginx.conf" dbuser=$app
sudo cp -a /etc/php5/fpm/pool.d/$app.conf "${backup_dir}/conf/php-fpm.conf" dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
sudo cp -a /etc/php5/fpm/conf.d/20-$app.ini "${backup_dir}/conf/php-fpm.ini" mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
# Backup db # Copy NGINX configuration
db_pwd=$(sudo yunohost app setting $app mysqlpwd) domain=$(ynh_app_setting_get "$app" domain)
sudo su -c "mysqldump -u $app -p"$db_pwd" --no-create-db $app > ${backup_dir}/db.sql" ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
# Copy PHP-FPM pool configuration
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-${app}.ini" "php-fpm.ini"

View file

@ -1,50 +1,56 @@
#!/bin/bash #!/bin/bash
set -eu
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments # Retrieve arguments
domain=$1 domain=$YNH_APP_ARG_DOMAIN
path=$2 path=$YNH_APP_ARG_PATH
admin=$3 admin=$YNH_APP_ARG_ADMIN
language=$4 language=$YNH_APP_ARG_LANGUAGE
public_site=$5 is_public=$YNH_APP_ARG_IS_PUBLIC
legal='no' legal='no'
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Check if admin exists # Check if admin exists
sudo yunohost user list --json | grep -q "\"username\": \"$admin\"" sudo yunohost user list --json | grep -q "\"username\": \"$admin\"" \
if [[ ! $? -eq 0 ]]; then || ynh_die "Wrong admin"
echo "Wrong admin"
exit 1 ynh_app_setting_set "$app" admin "$admin"
fi ynh_app_setting_set "$app" language "$language"
sudo yunohost app setting opensondage admin -v $admin ynh_app_setting_set "$app" legal "$legal"
sudo yunohost app setting opensondage language -v $language ynh_app_setting_set "$app" is_public "$is_public"
sudo yunohost app setting opensondage legal -v $legal # Deprecated
sudo yunohost app setting opensondage public_site -v $public_site ynh_app_setting_set "$app" public_site "$is_public"
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a opensondage sudo yunohost app checkurl "${domain}${path}" -a "$app" \
if [[ ! $? -eq 0 ]]; then || ynh_die "Path not available: ${domain}${path}"
exit 1
fi
# Generate random password
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
# Use 'opensondage' as database name and user
db_user=opensondage
# Initialize database and store mysql password for upgrade
sudo yunohost app initdb $db_user -p $db_pwd
sudo yunohost app setting opensondage mysqlpwd -v $db_pwd
# Copy files to the right place # Copy files to the right place
final_path=/var/www/opensondage final_path=/var/www/$app
sudo mkdir -p $final_path sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path sudo cp -a ../sources/. $final_path
sudo cp ../conf/constants.php.template $final_path/app/inc/constants.php sudo cp ../conf/constants.php.template $final_path/app/inc/constants.php
# Change variables in OpenSondage configuration # Generate MySQL password and create database
sudo sed -i "s/yunouser/$db_user/g" $final_path/app/inc/constants.php dbuser=$app
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/app/inc/constants.php dbname=$app
sudo sed -i "s/yunobase/$db_user/g" $final_path/app/inc/constants.php dbpass=$(ynh_string_random 12)
ynh_app_setting_set "$app" mysqlpwd "$dbpass"
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
# Load initial SQL into the new database
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \
< $final_path/install.mysql.sql
# Change variables in configuration
sudo sed -i "s/yunouser/$dbuser/g" $final_path/app/inc/constants.php
sudo sed -i "s/yunopass/$dbpass/g" $final_path/app/inc/constants.php
sudo sed -i "s/yunobase/$dbname/g" $final_path/app/inc/constants.php
sudo sed -i "s/yunoadmin/$admin/g" $final_path/app/inc/constants.php sudo sed -i "s/yunoadmin/$admin/g" $final_path/app/inc/constants.php
sudo sed -i "s/I18NTOCHANGE/$language/g" $final_path/app/inc/constants.php sudo sed -i "s/I18NTOCHANGE/$language/g" $final_path/app/inc/constants.php
sudo sed -i "s@yunourl@$domain$path@g" $final_path/app/inc/constants.php sudo sed -i "s@yunourl@$domain$path@g" $final_path/app/inc/constants.php
@ -57,17 +63,14 @@ sudo chmod 700 $final_path/admin/logs_studs.txt
# Set permissions # Set permissions
sudo chown -R www-data: $final_path sudo chown -R www-data: $final_path
# Db installation # Modify PHP-FPM pool configuration and copy it to the pool directory
mysql -u $db_user -p$db_pwd $db_user < $final_path/install.mysql.sql sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
sed -i "s@NAMETOCHANGE@opensondage@g" ../conf/php-fpm.conf
finalphpconf=/etc/php5/fpm/pool.d/opensondage.conf
sudo cp ../conf/php-fpm.conf $finalphpconf sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf sudo chmod 644 $finalphpconf
finalphpini=/etc/php5/fpm/conf.d/20-opensondage.ini finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
sudo cp ../conf/php-fpm.ini $finalphpini sudo cp ../conf/php-fpm.ini $finalphpini
sudo chown root: $finalphpini sudo chown root: $finalphpini
sudo chmod 644 $finalphpini sudo chmod 644 $finalphpini
@ -76,19 +79,19 @@ sudo chmod 644 $finalphpini
sudo service php5-fpm restart sudo service php5-fpm restart
sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -y --force-yes -qq install php-fpdf sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -y --force-yes -qq install php-fpdf
sudo yunohost app addaccess opensondage -u $admin sudo yunohost app addaccess $app -u $admin
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/opensondage.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Reload Nginx and regenerate SSOwat conf # Reload Nginx and regenerate SSOwat conf
sudo service nginx reload sudo service nginx reload
sudo yunohost app setting opensondage skipped_uris -v "/" ynh_app_setting_set "$app" skipped_uris "/"
if [ $public_site = "No" ]; if [[ $is_public -eq 0 ]];
then then
sudo yunohost app setting opensondage protected_uris -v "/admin,/index.php,/choix_date.php,/choix_autre.php,/infos_sondage.php,/scripts" ynh_app_setting_set "$app" protected_uris "/admin,/index.php,/choix_date.php,/choix_autre.php,/infos_sondage.php,/scripts"
else else
sudo yunohost app setting opensondage protected_uris -v "/admin/index.php,/admin/logs_studs.txt,/scripts" ynh_app_setting_set "$app" protected_uris "/admin/index.php,/admin/logs_studs.txt,/scripts"
fi fi
sudo yunohost app ssowatconf sudo yunohost app ssowatconf

View file

@ -1,15 +1,25 @@
#!/bin/bash #!/bin/bash
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
. /usr/share/yunohost/helpers
db_user=opensondage # Retrieve app settings
db_name=opensondage domain=$(ynh_app_setting_get "$app" domain)
root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting opensondage domain) # Remove sources
sudo rm -rf /var/www/$app
# Remove configuration files
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
sudo rm -f /etc/php5/fpm/pool.d/$app.conf
sudo rm -f /etc/php5/fpm/conf.d/20-$app.ini
sudo service php5-fpm reload
# Drop MySQL database and user
dbname=$app
dbuser=$app
ynh_mysql_drop_db "$dbname" || true
ynh_mysql_drop_user "$dbuser" || true
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
sudo rm -rf /var/www/opensondage
sudo rm -f /etc/nginx/conf.d/$domain.d/opensondage.conf
sudo rm -f /etc/php5/fpm/pool.d/opensondage.conf
sudo rm -f /etc/php5/fpm/conf.d/20-opensondage.ini
sudo service php5-fpm restart
sudo service nginx reload sudo service nginx reload
sudo yunohost ssowatconf

View file

@ -1,81 +1,75 @@
#!/bin/bash #!/bin/bash
# This restore script is adapted to Yunohost >=2.4
# The parameter $1 is the backup directory location dedicated to the app # Exit on command errors and treat unset variables as an error
backup_dir=$1 set -eu
# The parameter $2 is the id of the app instance ex: ynhexample__2 # See comments in install script
app=$2 app=$YNH_APP_INSTANCE_NAME
# Get old parameter of the app # Source YunoHost helpers
domain=$(sudo yunohost app setting $app domain) . /usr/share/yunohost/helpers
path=$(sudo yunohost app setting $app path)
admin_wordpress=$(sudo yunohost app setting $app admin) # Retrieve old app settings
language=$(sudo yunohost app setting $app language) domain=$(ynh_app_setting_get "$app" domain)
public_site=$(sudo yunohost app setting $app public_site) path=$(ynh_app_setting_get "$app" path)
admin=$(ynh_app_setting_get "$app" admin)
is_public=$(ynh_app_setting_get "$app" is_public)
public_site=$(ynh_app_setting_get "$app" public_site)
legal=$(ynh_app_setting_get "$app" legal)
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a $app sudo yunohost app checkurl $domain$path -a $app \
if [[ ! $? -eq 0 ]]; then || ynh_die "Path not available: ${domain}${path}"
echo "There is already an app on this URL : $domain$path" | sudo tee /dev/stderr
exit 1
fi
final_path=/var/www/$app final_path=/var/www/$app
if [ -d $final_path ]; then if [ -d $final_path ]; then
echo "There is already a directory: $final_path " | sudo tee /dev/stderr ynh_die "There is already a directory: $final_path "
exit 1
fi fi
conf=/etc/nginx/conf.d/$domain.d/$app.conf conf=/etc/nginx/conf.d/$domain.d/$app.conf
if [ -f $conf ]; then if [ -f $conf ]; then
echo "There is already a nginx conf file at this path: $conf " | sudo tee /dev/stderr ynh_die "There is already a nginx conf file at this path: $conf "
exit 1
fi fi
phpconf=/etc/php5/fpm/pool.d/$app.conf phpconf=/etc/php5/fpm/pool.d/$app.conf
if [ -f $phpconf ]; then if [ -f $phpconf ]; then
echo "There is already a php-fpm conf file at this path: $phpconf " | sudo tee /dev/stderr ynh_die "There is already a php-fpm conf file at this path: $phpconf "
exit 1
fi fi
phpini=/etc/php5/fpm/conf.d/20-$app.ini phpini=/etc/php5/fpm/conf.d/20-$app.ini
if [ -f $phpini ]; then if [ -f $phpini ]; then
echo "There is already a php-fpm ini file at this path: $phpini " | sudo tee /dev/stderr ynh_die "There is already a php-fpm ini file at this path: $phpini "
exit 1
fi fi
# Dependences # Dependences
sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -y --force-yes -qq install php-fpdf sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -y --force-yes -qq install php-fpdf
# Restore sources & data # Restore sources & data
sudo cp -a "${backup_dir}/var/www/$app" $final_path sudo cp -a ./sources $final_path
dbname=$app
db_pwd=$(sudo yunohost app setting $app mysqlpwd) dbuser=$app
db_user=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
sudo yunohost app initdb $db_user -p $db_pwd ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
sudo su -c "mysql -u $db_user -p$db_pwd $app < ${backup_dir}/db.sql" ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
sudo rm -f "${backup_dir}/db.sql"
sudo sed -i -e "s/'DB_USER', *'[^']*'/'DB_USER', '$app'/g" $final_path/wp-config.php
sudo sed -i -e "s/'DB_NAME', *'[^']*'/'DB_NAME', '$app'/g" $final_path/wp-config.php
# Set permissions # Set permissions
sudo chmod 700 $final_path/admin/logs_studs.txt sudo chmod 700 $final_path/admin/logs_studs.txt
sudo chown -R www-data:www-data $final_path sudo chown -R www-data:www-data $final_path
# Restore conf files # Restore conf files
sudo cp -a "${backup_dir}/conf/nginx.conf" $conf sudo cp -a ./nginx.conf $conf
sudo cp -a "${backup_dir}/conf/php-fpm.conf" $phpconf sudo cp -a ./php-fpm.conf $phpconf
sudo chown root: $phpconf sudo chown root: $phpconf
sudo chmod 644 $phpconf sudo chmod 644 $phpconf
sudo cp -a "${backup_dir}/conf/php-fpm.ini" $phpini sudo cp -a ./php-fpm.ini $phpini
sudo chown root: $phpini sudo chown root: $phpini
sudo chmod 644 $phpini sudo chmod 644 $phpini
# Set Administrator # Set Administrator
if sudo yunohost user info test > /dev/null; then if sudo yunohost user info $admin > /dev/null; then
sudo yunohost app addaccess opensondage -u $admin sudo yunohost app addaccess $app -u $admin
fi fi
# Reload Nginx # Reload Nginx
@ -83,11 +77,11 @@ sudo service php5-fpm restart
sudo service nginx reload sudo service nginx reload
# Set ssowat config # Set ssowat config
sudo yunohost app setting opensondage skipped_uris -v "/" ynh_app_setting_set "$app" skipped_uris "/"
if [ $public_site = "No" ]; if [[ $is_public -eq 0 ]];
then then
sudo yunohost app setting opensondage protected_uris -v "/admin,/index.php,/choix_date.php,/choix_autre.php,/infos_sondage.php,/scripts" ynh_app_setting_set "$app" protected_uris "/admin,/index.php,/choix_date.php,/choix_autre.php,/infos_sondage.php,/scripts"
else else
sudo yunohost app setting opensondage protected_uris -v "/admin/index.php,/admin/logs_studs.txt,/scripts" ynh_app_setting_set "$app" protected_uris "/admin/index.php,/admin/logs_studs.txt,/scripts"
fi fi
sudo yunohost app ssowatconf sudo yunohost app ssowatconf

View file

@ -1,49 +1,60 @@
#!/bin/bash #!/bin/bash
set -eu
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Retrieve arguments # Retrieve arguments
domain=$(sudo yunohost app setting opensondage domain) domain=$(ynh_app_setting_get "$app" domain)
path=$(sudo yunohost app setting opensondage path) path=$(ynh_app_setting_get "$app" path)
admin=$(sudo yunohost app setting opensondage admin) admin=$(ynh_app_setting_get "$app" admin)
legal=$(sudo yunohost app setting opensondage legal) public_site=$(ynh_app_setting_get "$app" public_site)
language=$(sudo yunohost app setting opensondage language) legal=$(ynh_app_setting_get "$app" legal)
public_site=$(sudo yunohost app setting opensondage public_site)
root_pwd=$(sudo cat /etc/yunohost/mysql) is_public=$(ynh_app_setting_get "$app" is_public)
if [[ "$is_public" = "" ]];
db_name=opensondage
if [[ "$language" = "" ]];
then then
language=$(sudo grep LANGUE /var/www/opensondage/variables.php | grep -Po "'.*?'" | cut -d"'" -f2) if [ $public_site = "No" ];
then
is_public=0
else
is_public=1
fi
fi fi
language=$(ynh_app_setting_get "$app" language)
if [[ "$language" = "" ]];
then
language=$(sudo grep LANGUE /var/www/$app/variables.php | grep -Po "'.*?'" | cut -d"'" -f2)
fi
# Check if admin is not null # Check if admin is not null
if [[ "$admin" = "" || "$language" = "" ]]; then if [[ "$admin" = "" || "$language" = "" ]]; then
echo "Unable to upgrade, please contact support" ynh_die "Unable to upgrade, please contact support"
exit 1
fi fi
# Generate random password # Remove trailing "/" for next commands
db_pwd=$(sudo yunohost app setting opensondage mysqlpwd) path=${path%/}
# Use 'opensondage' as database name and user root_pwd=$(sudo cat /etc/yunohost/mysql)
db_user=opensondage dbname=$app
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
dbuser=$app
### Execute potential SQL statements here ### Execute potential SQL statements here
# Copy files to the right place # Copy files to the right place
final_path=/var/www/opensondage final_path=/var/www/$app
sudo cp $final_path/admin/logs_studs.txt ../conf/ sudo cp $final_path/admin/logs_studs.txt ../conf/
sudo rm -Rf $final_path sudo rm -Rf $final_path
sudo mkdir -p $final_path sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path sudo cp -a ../sources/. $final_path
sudo cp ../conf/constants.php.template $final_path/app/inc/constants.php sudo cp ../conf/constants.php.template $final_path/app/inc/constants.php
# Change variables in OpenSondage configuration # Change variables in configuration
sudo sed -i "s/yunouser/$db_user/g" $final_path/app/inc/constants.php sudo sed -i "s/yunouser/$dbuser/g" $final_path/app/inc/constants.php
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/app/inc/constants.php sudo sed -i "s/yunopass/$dbpass/g" $final_path/app/inc/constants.php
sudo sed -i "s/yunobase/$db_user/g" $final_path/app/inc/constants.php sudo sed -i "s/yunobase/$dbname/g" $final_path/app/inc/constants.php
sudo sed -i "s/yunoadmin/$admin/g" $final_path/app/inc/constants.php sudo sed -i "s/yunoadmin/$admin/g" $final_path/app/inc/constants.php
sudo sed -i "s/I18NTOCHANGE/$language/g" $final_path/app/inc/constants.php sudo sed -i "s/I18NTOCHANGE/$language/g" $final_path/app/inc/constants.php
sudo sed -i "s@yunourl@$domain$path@g" $final_path/app/inc/constants.php sudo sed -i "s@yunourl@$domain$path@g" $final_path/app/inc/constants.php
@ -61,16 +72,16 @@ sudo chown -R www-data: $final_path
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo yunohost app addaccess opensondage -u $admin sudo yunohost app addaccess $app -u $admin
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/opensondage.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
sed -i "s@NAMETOCHANGE@opensondage@g" ../conf/php-fpm.conf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
finalphpconf=/etc/php5/fpm/pool.d/opensondage.conf finalphpconf=/etc/php5/fpm/pool.d/$app.conf
sudo cp ../conf/php-fpm.conf $finalphpconf sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf sudo chmod 644 $finalphpconf
finalphpini=/etc/php5/fpm/conf.d/20-opensondage.ini finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
sudo cp ../conf/php-fpm.ini $finalphpini sudo cp ../conf/php-fpm.ini $finalphpini
sudo chown root: $finalphpini sudo chown root: $finalphpini
sudo chmod 644 $finalphpini sudo chmod 644 $finalphpini
@ -78,11 +89,11 @@ sudo chmod 644 $finalphpini
sudo service php5-fpm restart sudo service php5-fpm restart
# Reload Nginx # Reload Nginx
sudo service nginx reload sudo service nginx reload
sudo yunohost app setting opensondage skipped_uris -v "/" ynh_app_setting_set "$app" skipped_uris "/"
if [ $public_site = "No" ]; if [ $is_public -eq 0 ];
then then
sudo yunohost app setting opensondage protected_uris -v "/admin,/index.php,/choix_date.php,/choix_autre.php,/infos_sondage.php,/scripts" ynh_app_setting_set "$app" protected_uris "/admin,/index.php,/choix_date.php,/choix_autre.php,/infos_sondage.php,/scripts"
else else
sudo yunohost app setting opensondage protected_uris -v "/admin/index.php,/admin/logs_studs.txt,/scripts" ynh_app_setting_set "$app" protected_uris "/admin/index.php,/admin/logs_studs.txt,/scripts"
fi fi
sudo yunohost app ssowatconf sudo yunohost app ssowatconf