mirror of
https://github.com/YunoHost-Apps/garradin_ynh.git
synced 2024-09-03 18:36:17 +02:00
cleaning syntax
This commit is contained in:
parent
7572a959cc
commit
35b475e068
4 changed files with 14 additions and 20 deletions
|
@ -43,14 +43,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
change_domain=0
|
change_domain=0
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
if [ "$old_domain" != "$new_domain" ]; then
|
||||||
then
|
|
||||||
change_domain=1
|
change_domain=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
change_path=0
|
change_path=0
|
||||||
if [ "$old_path" != "$new_path" ]
|
if [ "$old_path" != "$new_path" ]; then
|
||||||
then
|
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -76,19 +74,16 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# change the config.local.conf
|
# change the config.local.conf
|
||||||
if [ $change_path -eq 1 ] && [ "$new_path" == "/" ]
|
if [ $change_path -eq 1 ] && [ "$new_path" == "/" ]; then
|
||||||
then
|
|
||||||
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path';" --target_file="$final_path/config.local.php"
|
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path';" --target_file="$final_path/config.local.php"
|
||||||
elif [ $change_path -eq 1 ] && [ "$old_path" == "/" ]
|
elif [ $change_path -eq 1 ] && [ "$old_path" == "/" ]; then
|
||||||
then
|
|
||||||
ynh_replace_string --match_string="const WWW_URI = '$old_path';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
|
ynh_replace_string --match_string="const WWW_URI = '$old_path';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
|
||||||
else [ $change_path -eq 1 ]
|
else [ $change_path -eq 1 ]
|
||||||
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
|
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for nginx
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]; then
|
||||||
then
|
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
|
|
@ -121,11 +121,13 @@ systemctl reload nginx
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
key=$(ynh_string_random --length=50)
|
# copy config.dist.php creating config.local.php
|
||||||
cp -a $final_path/config.dist.php $final_path/config.local.php
|
cp -a $final_path/config.dist.php $final_path/config.local.php
|
||||||
|
# create a key for the secret key CSFR;
|
||||||
|
key=$(ynh_string_random --length=50)
|
||||||
|
# edit config.local.php
|
||||||
ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php"
|
ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php"
|
||||||
if [ "$path_url" == "/" ]
|
if [ "$path_url" == "/" ]; then
|
||||||
then
|
|
||||||
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php"
|
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php"
|
||||||
else
|
else
|
||||||
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php"
|
ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php"
|
||||||
|
|
|
@ -83,8 +83,7 @@ ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies php7.0-sqlite3
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -53,20 +53,18 @@ if [ -z "$final_path" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Backup squlite, config.local.php and squelettes directory
|
# Backup Data
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the data before upgrading (may take a while)..." --time --weight=1
|
ynh_script_progression --message="Backing up the data before upgrading (may take a while)..." --time --weight=1
|
||||||
|
|
||||||
bdd=$final_path/association.sqlite
|
bdd=$final_path/association.sqlite
|
||||||
squelettes=$final_path/www/squelettes
|
squelettes=$final_path/www/squelettes
|
||||||
|
|
||||||
if [ -d "$squelettes" ]
|
if [ -d "$squelettes" ]; then
|
||||||
then
|
|
||||||
cp -ar $squelettes /tmp/squelettes
|
cp -ar $squelettes /tmp/squelettes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$bdd" ]
|
if [ -e "$bdd" ]; then
|
||||||
then
|
|
||||||
cp -a $bdd /tmp/association.sqlite
|
cp -a $bdd /tmp/association.sqlite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue