X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=etc%2Fsv%2Fnginx%2Fconfigure.sh;h=7b2b5466d0fd7801243360f0efe976fd03d988ca;hp=c41397931f42667efc5f1747688d419215accb08;hb=eefc410c23df14d9e47bfc1eedcfb500d557c5a8;hpb=5ce6d51b9c15b2e316d60fad4ecfa1ea1b32bf7b diff --git a/etc/sv/nginx/configure.sh b/etc/sv/nginx/configure.sh index c413979..7b2b546 100644 --- a/etc/sv/nginx/configure.sh +++ b/etc/sv/nginx/configure.sh @@ -1,13 +1,11 @@ -rule runit_configure php5-fpm +rule _runit_sv_configure php5-fpm '*' +rule _runit_sv_restart php5-fpm rule apt_get_install nginx spawn-fcgi fcgiwrap rule insserv_remove nginx rule insserv_remove fcgiwrap -rule www_configure +rule _www_configure -sudo rm -rf \ - /etc/nginx/conf.d \ - /etc/nginx/site.d sudo install -d -m 770 -o www -g www \ /etc/nginx \ /etc/nginx/conf.d \ @@ -19,16 +17,22 @@ sudo ln -fns \ sudo install -m 660 -o www -g www \ "$tool"/etc/nginx/nginx.conf \ /etc/nginx/nginx.conf -local conf -for conf in "$tool"/etc/nginx/conf.d/*.conf - do conf=${conf#"$tool"/etc/nginx/conf.d/} + +for conf in $(find "$tool"/etc/nginx/conf.d \ + -mindepth 1 -maxdepth 1 -type f \ + -name '*.conf' \ + -printf '%f\n') + do sudo install -m 660 -o www -g www \ "$tool"/etc/nginx/conf.d/"$conf" \ /etc/nginx/conf.d/"$conf" done -for conf in "$tool"/etc/nginx/site.d/*/site.conf - do conf=${conf#"$tool"/etc/nginx/site.d/} - local site="${conf%/site.conf}" + +for site in $(find "$tool"/etc/nginx/site.d \ + -mindepth 1 -maxdepth 1 -type d \ + -false ${@:+$(printf -- '-or -name %s\n' "$@")} \ + -printf '%f\n') + do rule adduser www-"$site" \ --disabled-login \ --disabled-password \ @@ -70,6 +74,8 @@ for conf in "$tool"/etc/nginx/site.d/*/site.conf include /etc/nginx/site.d/$site/site.inc; } EOF + ( test ! -r "$tool"/etc/nginx/site.d/"$site"/configure.sh || - . "$tool"/etc/nginx/site.d/"$site"/configure.sh + . "$tool"/etc/nginx/site.d/"$site"/configure.sh || return 1 + ) done