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:
parent
e69b5bd37b
commit
933735e61a
6 changed files with 181 additions and 161 deletions
|
@ -8,8 +8,11 @@
|
|||
"de": "OpenSondage ist ein Online-Dienst, der Ihnen bei der Absprache von Terminen oder der Entscheidungsfindung hilft."
|
||||
},
|
||||
"maintainer": {
|
||||
"name": "zamentur",
|
||||
"email": "valentin@grimaud.me"
|
||||
"name": "ljf",
|
||||
"email": "ljf+yunohost@grimaud.me"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">> 2.3.12.1"
|
||||
},
|
||||
"multi_instance": "true",
|
||||
"services": [
|
||||
|
@ -48,7 +51,7 @@
|
|||
"fr": "Choisissez l'administrateur d'OpenSondage (doit être un utilisateur YunoHost)",
|
||||
"de": "Wählen Sie bitte den OpenSondageadministrator (muss ein vorhandener YunoHost Nutzer sein)"
|
||||
},
|
||||
"example": "homer"
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
|
@ -61,14 +64,14 @@
|
|||
"default": "en_GB"
|
||||
},
|
||||
{
|
||||
"name": "public_site",
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Could non member create poll ?",
|
||||
"fr": "Une personne non membre peut elle créer un sondage ?",
|
||||
"de": "Kann einen nicht eingeloggter Nutzer einen Umfrage erstellen?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
"default": true
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# The parameter $1 is the backup directory location dedicated to the app
|
||||
backup_dir=$1
|
||||
# Exit on command errors and treat unset variables as an error
|
||||
set -eu
|
||||
|
||||
# The parameter $2 is theid of the app instance
|
||||
app=$2
|
||||
# See comments in install script
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
path=$(sudo yunohost app setting $app path)
|
||||
admin=$(sudo yunohost app setting $app admin)
|
||||
language=$(sudo yunohost app setting $app language)
|
||||
public_site=$(sudo yunohost app setting $app public_site)
|
||||
# Source YunoHost helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
|
||||
# Copy the app files
|
||||
final_path=/var/www/$app
|
||||
sudo mkdir -p ${backup_dir}/var/www
|
||||
sudo cp -a $final_path "${backup_dir}/var/www/$app"
|
||||
# Backup sources & data
|
||||
ynh_backup "/var/www/${app}" "sources"
|
||||
|
||||
# Copy the conf files
|
||||
sudo mkdir -p "${backup_dir}/conf"
|
||||
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf "${backup_dir}/conf/nginx.conf"
|
||||
sudo cp -a /etc/php5/fpm/pool.d/$app.conf "${backup_dir}/conf/php-fpm.conf"
|
||||
sudo cp -a /etc/php5/fpm/conf.d/20-$app.ini "${backup_dir}/conf/php-fpm.ini"
|
||||
# Dump the database
|
||||
dbname=$app
|
||||
dbuser=$app
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
||||
|
||||
# Backup db
|
||||
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
|
||||
sudo su -c "mysqldump -u $app -p"$db_pwd" --no-create-db $app > ${backup_dir}/db.sql"
|
||||
# Copy NGINX configuration
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
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"
|
||||
|
|
|
@ -1,50 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
admin=$3
|
||||
language=$4
|
||||
public_site=$5
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
legal='no'
|
||||
|
||||
# Source YunoHost helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
|
||||
# Check if admin exists
|
||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
echo "Wrong admin"
|
||||
exit 1
|
||||
fi
|
||||
sudo yunohost app setting opensondage admin -v $admin
|
||||
sudo yunohost app setting opensondage language -v $language
|
||||
sudo yunohost app setting opensondage legal -v $legal
|
||||
sudo yunohost app setting opensondage public_site -v $public_site
|
||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\"" \
|
||||
|| ynh_die "Wrong admin"
|
||||
|
||||
ynh_app_setting_set "$app" admin "$admin"
|
||||
ynh_app_setting_set "$app" language "$language"
|
||||
ynh_app_setting_set "$app" legal "$legal"
|
||||
ynh_app_setting_set "$app" is_public "$is_public"
|
||||
# Deprecated
|
||||
ynh_app_setting_set "$app" public_site "$is_public"
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a opensondage
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
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
|
||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||
|| ynh_die "Path not available: ${domain}${path}"
|
||||
|
||||
# Copy files to the right place
|
||||
final_path=/var/www/opensondage
|
||||
final_path=/var/www/$app
|
||||
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
|
||||
|
||||
# Change variables in OpenSondage configuration
|
||||
sudo sed -i "s/yunouser/$db_user/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/yunobase/$db_user/g" $final_path/app/inc/constants.php
|
||||
# Generate MySQL password and create database
|
||||
dbuser=$app
|
||||
dbname=$app
|
||||
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/I18NTOCHANGE/$language/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
|
||||
sudo chown -R www-data: $final_path
|
||||
|
||||
# Db installation
|
||||
mysql -u $db_user -p$db_pwd $db_user < $final_path/install.mysql.sql
|
||||
|
||||
|
||||
sed -i "s@NAMETOCHANGE@opensondage@g" ../conf/php-fpm.conf
|
||||
finalphpconf=/etc/php5/fpm/pool.d/opensondage.conf
|
||||
# Modify PHP-FPM pool configuration and copy it to the pool directory
|
||||
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
||||
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||
sudo cp ../conf/php-fpm.conf $finalphpconf
|
||||
sudo chown root: $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 chown root: $finalphpini
|
||||
sudo chmod 644 $finalphpini
|
||||
|
@ -76,19 +79,19 @@ sudo chmod 644 $finalphpini
|
|||
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 yunohost app addaccess opensondage -u $admin
|
||||
sudo yunohost app addaccess $app -u $admin
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sed -i "s@PATHTOCHANGE@$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
|
||||
sudo service nginx reload
|
||||
sudo yunohost app setting opensondage skipped_uris -v "/"
|
||||
if [ $public_site = "No" ];
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
if [[ $is_public -eq 0 ]];
|
||||
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
|
||||
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
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
#!/bin/bash
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
# Source YunoHost helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
|
||||
db_user=opensondage
|
||||
db_name=opensondage
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
domain=$(sudo yunohost app setting opensondage domain)
|
||||
# Retrieve app settings
|
||||
domain=$(ynh_app_setting_get "$app" 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 yunohost ssowatconf
|
||||
|
|
|
@ -1,81 +1,75 @@
|
|||
#!/bin/bash
|
||||
# This restore script is adapted to Yunohost >=2.4
|
||||
|
||||
# The parameter $1 is the backup directory location dedicated to the app
|
||||
backup_dir=$1
|
||||
# Exit on command errors and treat unset variables as an error
|
||||
set -eu
|
||||
|
||||
# The parameter $2 is the id of the app instance ex: ynhexample__2
|
||||
app=$2
|
||||
# See comments in install script
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Get old parameter of the app
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
path=$(sudo yunohost app setting $app path)
|
||||
admin_wordpress=$(sudo yunohost app setting $app admin)
|
||||
language=$(sudo yunohost app setting $app language)
|
||||
public_site=$(sudo yunohost app setting $app public_site)
|
||||
# Source YunoHost helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
|
||||
# Retrieve old app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
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
|
||||
sudo yunohost app checkurl $domain$path -a $app
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
echo "There is already an app on this URL : $domain$path" | sudo tee /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
sudo yunohost app checkurl $domain$path -a $app \
|
||||
|| ynh_die "Path not available: ${domain}${path}"
|
||||
|
||||
|
||||
final_path=/var/www/$app
|
||||
if [ -d $final_path ]; then
|
||||
echo "There is already a directory: $final_path " | sudo tee /dev/stderr
|
||||
exit 1
|
||||
ynh_die "There is already a directory: $final_path "
|
||||
fi
|
||||
|
||||
conf=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
if [ -f $conf ]; then
|
||||
echo "There is already a nginx conf file at this path: $conf " | sudo tee /dev/stderr
|
||||
exit 1
|
||||
ynh_die "There is already a nginx conf file at this path: $conf "
|
||||
fi
|
||||
|
||||
phpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||
if [ -f $phpconf ]; then
|
||||
echo "There is already a php-fpm conf file at this path: $phpconf " | sudo tee /dev/stderr
|
||||
exit 1
|
||||
ynh_die "There is already a php-fpm conf file at this path: $phpconf "
|
||||
fi
|
||||
|
||||
phpini=/etc/php5/fpm/conf.d/20-$app.ini
|
||||
if [ -f $phpini ]; then
|
||||
echo "There is already a php-fpm ini file at this path: $phpini " | sudo tee /dev/stderr
|
||||
exit 1
|
||||
ynh_die "There is already a php-fpm ini file at this path: $phpini "
|
||||
fi
|
||||
|
||||
# Dependences
|
||||
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
|
||||
sudo cp -a "${backup_dir}/var/www/$app" $final_path
|
||||
sudo cp -a ./sources $final_path
|
||||
|
||||
|
||||
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
|
||||
db_user=$app
|
||||
sudo yunohost app initdb $db_user -p $db_pwd
|
||||
sudo su -c "mysql -u $db_user -p$db_pwd $app < ${backup_dir}/db.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
|
||||
dbname=$app
|
||||
dbuser=$app
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
||||
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
|
||||
|
||||
# Set permissions
|
||||
sudo chmod 700 $final_path/admin/logs_studs.txt
|
||||
sudo chown -R www-data:www-data $final_path
|
||||
|
||||
# Restore conf files
|
||||
sudo cp -a "${backup_dir}/conf/nginx.conf" $conf
|
||||
sudo cp -a "${backup_dir}/conf/php-fpm.conf" $phpconf
|
||||
sudo cp -a ./nginx.conf $conf
|
||||
sudo cp -a ./php-fpm.conf $phpconf
|
||||
sudo chown root: $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 chmod 644 $phpini
|
||||
|
||||
# Set Administrator
|
||||
if sudo yunohost user info test > /dev/null; then
|
||||
sudo yunohost app addaccess opensondage -u $admin
|
||||
if sudo yunohost user info $admin > /dev/null; then
|
||||
sudo yunohost app addaccess $app -u $admin
|
||||
fi
|
||||
|
||||
# Reload Nginx
|
||||
|
@ -83,11 +77,11 @@ sudo service php5-fpm restart
|
|||
sudo service nginx reload
|
||||
|
||||
# Set ssowat config
|
||||
sudo yunohost app setting opensondage skipped_uris -v "/"
|
||||
if [ $public_site = "No" ];
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
if [[ $is_public -eq 0 ]];
|
||||
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
|
||||
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
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -1,49 +1,60 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Source YunoHost helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting opensondage domain)
|
||||
path=$(sudo yunohost app setting opensondage path)
|
||||
admin=$(sudo yunohost app setting opensondage admin)
|
||||
legal=$(sudo yunohost app setting opensondage legal)
|
||||
language=$(sudo yunohost app setting opensondage language)
|
||||
public_site=$(sudo yunohost app setting opensondage public_site)
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path=$(ynh_app_setting_get "$app" path)
|
||||
admin=$(ynh_app_setting_get "$app" admin)
|
||||
public_site=$(ynh_app_setting_get "$app" public_site)
|
||||
legal=$(ynh_app_setting_get "$app" legal)
|
||||
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
|
||||
db_name=opensondage
|
||||
|
||||
|
||||
if [[ "$language" = "" ]];
|
||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||
if [[ "$is_public" = "" ]];
|
||||
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
|
||||
|
||||
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
|
||||
if [[ "$admin" = "" || "$language" = "" ]]; then
|
||||
echo "Unable to upgrade, please contact support"
|
||||
exit 1
|
||||
ynh_die "Unable to upgrade, please contact support"
|
||||
fi
|
||||
|
||||
# Generate random password
|
||||
db_pwd=$(sudo yunohost app setting opensondage mysqlpwd)
|
||||
# Remove trailing "/" for next commands
|
||||
path=${path%/}
|
||||
|
||||
# Use 'opensondage' as database name and user
|
||||
db_user=opensondage
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
dbname=$app
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
dbuser=$app
|
||||
|
||||
### Execute potential SQL statements here
|
||||
# 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 rm -Rf $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
|
||||
|
||||
# Change variables in OpenSondage configuration
|
||||
sudo sed -i "s/yunouser/$db_user/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/yunobase/$db_user/g" $final_path/app/inc/constants.php
|
||||
# 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/I18NTOCHANGE/$language/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@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
||||
|
||||
sudo yunohost app addaccess opensondage -u $admin
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/opensondage.conf
|
||||
sudo yunohost app addaccess $app -u $admin
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
sed -i "s@NAMETOCHANGE@opensondage@g" ../conf/php-fpm.conf
|
||||
finalphpconf=/etc/php5/fpm/pool.d/opensondage.conf
|
||||
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
||||
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||
sudo cp ../conf/php-fpm.conf $finalphpconf
|
||||
sudo chown root: $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 chown root: $finalphpini
|
||||
sudo chmod 644 $finalphpini
|
||||
|
@ -78,11 +89,11 @@ sudo chmod 644 $finalphpini
|
|||
sudo service php5-fpm restart
|
||||
# Reload Nginx
|
||||
sudo service nginx reload
|
||||
sudo yunohost app setting opensondage skipped_uris -v "/"
|
||||
if [ $public_site = "No" ];
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
if [ $is_public -eq 0 ];
|
||||
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
|
||||
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
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
Loading…
Add table
Reference in a new issue