-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 \
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 \
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