X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=etc%2Fsv%2Fnginx%2Fconfigure.sh;h=7c2943af89bb650bcd3881d82fd459a12b379c7d;hp=c41397931f42667efc5f1747688d419215accb08;hb=b27661cf8e40872543f86a00922d18573ef83612;hpb=7c02698fa11a13fd332c2e95986339241aaa79a6 diff --git a/etc/sv/nginx/configure.sh b/etc/sv/nginx/configure.sh index c413979..7c2943a 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 -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