mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix yunohost_admin.conf initialization
This commit is contained in:
parent
e2ea61aac2
commit
1fc9f7ddad
2 changed files with 22 additions and 10 deletions
|
@ -10,7 +10,25 @@ do_init_regen() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
do_pre_regen ""
|
||||
cd /usr/share/yunohost/templates/nginx
|
||||
|
||||
nginx_dir="/etc/nginx"
|
||||
nginx_conf_dir="${nginx_dir}/conf.d"
|
||||
mkdir -p "$nginx_conf_dir"
|
||||
|
||||
# install plain conf files
|
||||
cp plain/* "$nginx_conf_dir"
|
||||
|
||||
# probably run with init: just disable default site, restart NGINX and exit
|
||||
rm -f "${nginx_dir}/sites-enabled/default"
|
||||
|
||||
export compatibility="intermediate"
|
||||
ynh_render_template "yunohost_admin.conf" "${nginx_conf_dir}/yunohost_admin.conf"
|
||||
|
||||
# Restart nginx if conf looks good, otherwise display error and exit unhappy
|
||||
nginx -t 2>/dev/null && service nginx restart || (nginx -t && exit 1)
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
do_pre_regen() {
|
||||
|
@ -22,16 +40,9 @@ do_pre_regen() {
|
|||
nginx_conf_dir="${nginx_dir}/conf.d"
|
||||
mkdir -p "$nginx_conf_dir"
|
||||
|
||||
# install plain conf files
|
||||
# install / update plain conf files
|
||||
cp plain/* "$nginx_conf_dir"
|
||||
|
||||
# probably run with init: just disable default site, restart NGINX and exit
|
||||
if [[ -z "$pending_dir" ]]; then
|
||||
rm -f "${nginx_dir}/sites-enabled/default"
|
||||
service nginx restart
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# retrieve variables
|
||||
main_domain=$(cat /etc/yunohost/current_host)
|
||||
domain_list=$(sudo yunohost domain list --output-as plain --quiet)
|
||||
|
@ -60,7 +71,8 @@ do_pre_regen() {
|
|||
|| cp yunohost_local.conf "${domain_conf_dir}/yunohost_local.conf"
|
||||
|
||||
done
|
||||
ynh_render_template "plain/yunohost_admin.conf" "${nginx_conf_dir}/yunohost_admin.conf"
|
||||
|
||||
ynh_render_template "yunohost_admin.conf" "${nginx_conf_dir}/yunohost_admin.conf"
|
||||
|
||||
# remove old domain conf files
|
||||
conf_files=$(ls -1 /etc/nginx/conf.d \
|
||||
|
|
Loading…
Add table
Reference in a new issue