1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/garradin_ynh.git synced 2024-09-03 18:36:17 +02:00
This commit is contained in:
Robles Rodolphe 2020-04-08 10:47:16 +02:00
commit 6e6bfca2ac
5 changed files with 10 additions and 13 deletions

View file

@ -6,7 +6,7 @@
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=0
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
@ -15,7 +15,7 @@
multi_instance=1
incorrect_path=1
port_already_use=0
change_url=1
change_url=0
;;; Levels
Level 1=auto
Level 2=auto

View file

@ -27,4 +27,4 @@ location __PATH__ {
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
}

View file

@ -37,13 +37,13 @@ old_path=$(ynh_normalize_url_path $old_path)
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
change_path=1
fi
#=================================================
@ -58,8 +58,6 @@ final_path=/var/www/$app
# Change the path in the nginx config file
if [ $change_path -eq 1 ]
then
# ynh_replace_string
ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php"
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path"
# Replace locations starting with old_path
@ -69,18 +67,18 @@ then
ynh_replace_string "return \([[:digit:]]\{3\}\) $old_path" "return \1 $new_path" "$nginx_conf_path"
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
fi
# ynh_replace_string
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
# Change the domain for nginx
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum "$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
# Store file checksum for the new config file location
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
# ynh_replace_string
fi
# GENERIC FINALISATION

View file

@ -87,7 +87,7 @@ ynh_setup_source --dest_dir="$final_path"
cp -a $final_path/config.dist.php $final_path/config.local.php
# ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin/;" --target_file="$final_path/config.local.php"
ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = true;" --target_file="$final_path/config.local.php"
# ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = true;" --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"
#=================================================

View file

@ -148,7 +148,6 @@ fi
cp -a $final_path/config.dist.php $final_path/config.local.php
# ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin/;" --target_file="$final_path/config.local.php"
ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = true;" --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"
#=================================================