Ajout : vm_hosted : rule_runit_configure .
authorJulien Moutinho <julm+burette@autogeree.net>
Mon, 18 Mar 2013 09:48:49 +0000 (10:48 +0100)
committerJulien Moutinho <julm+burette@autogeree.net>
Tue, 19 Mar 2013 09:50:42 +0000 (10:50 +0100)
etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure [new file with mode: 0755]
etc/sv/git-daemon.9418.git.heureux-cyclage.org/log/run [new file with mode: 0644]
etc/sv/git-daemon.9418.git.heureux-cyclage.org/run [new file with mode: 0644]
etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/log/run [deleted file]
etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run [deleted file]
etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run.sh [deleted file]
etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/configure [new file with mode: 0755]
etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/run [new file with mode: 0755]
etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run [deleted file]
etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run.sh [deleted file]
vm_hosted

diff --git a/etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure
new file mode 100755 (executable)
index 0000000..dceee35
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh -efux
+run_user=git-daemon
+id "$run_user" >/dev/null ||
+sudo adduser \
+ --disabled-login \
+ --disabled-password \
+ --group \
+ --home /home/git/pub \
+ --shell /bin/false \
+ --system \
+ "$run_user"
+log_user=git-daemon-log
+id "$log_user" >/dev/null ||
+sudo adduser \
+ --disabled-login \
+ --disabled-password \
+ --group \
+ --home /home/git/log/git-daemon \
+ --shell /bin/false \
+ --system \
+ "$log_user"
diff --git a/etc/sv/git-daemon.9418.git.heureux-cyclage.org/log/run b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/log/run
new file mode 100644 (file)
index 0000000..f556886
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh -efux
+install -d -m 770 -o log.git-daemon -g log.git-daemon /home/git/log/git-daemon/
+exec chpst -u log.git-daemon svlogd -tt /home/git/log/git-daemon/
diff --git a/etc/sv/git-daemon.9418.git.heureux-cyclage.org/run b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/run
new file mode 100644 (file)
index 0000000..c994c65
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh -efux
+exec 2>&1
+exec /usr/bin/chpst \
+ -u git-daemon:git-daemon \
+ /usr/bin/git daemon \
+ --base-path=/home/git/pub/git \
+ --interpolated-path=/home/git/srv/git/%H%D \
+ --reuseaddr \
+ --syslog \
+ --user-path=pub/git \
+ --verbose \
+ -- \
+ /home/git/pub/git
diff --git a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/log/run b/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/log/run
deleted file mode 100644 (file)
index f556886..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh -efux
-install -d -m 770 -o log.git-daemon -g log.git-daemon /home/git/log/git-daemon/
-exec chpst -u log.git-daemon svlogd -tt /home/git/log/git-daemon/
diff --git a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run b/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run
deleted file mode 100644 (file)
index c994c65..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh -efux
-exec 2>&1
-exec /usr/bin/chpst \
- -u git-daemon:git-daemon \
- /usr/bin/git daemon \
- --base-path=/home/git/pub/git \
- --interpolated-path=/home/git/srv/git/%H%D \
- --reuseaddr \
- --syslog \
- --user-path=pub/git \
- --verbose \
- -- \
- /home/git/pub/git
diff --git a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run.sh b/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run.sh
deleted file mode 100644 (file)
index c319358..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-local run_user="$user"-daemon
-id "$run_user" >/dev/null ||
-sudo adduser \
- --disabled-login \
- --disabled-password \
- --group \
- --home /home/git/pub \
- --shell /bin/false \
- --system \
- "$run_user"
-log_user=git-daemon-log
-id "$log_user" >/dev/null ||
-sudo adduser \
- --disabled-login \
- --disabled-password \
- --group \
- --home /home/git/log/git-daemon \
- --shell /bin/false \
- --system \
- "$log_user"
diff --git a/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/configure b/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/configure
new file mode 100755 (executable)
index 0000000..b563226
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh -efux
+run_user=spawn-fcgi.80.git.heureux-cyclage.org
+id "$run_user" >/dev/null ||
+sudo adduser \
+ --disabled-login \
+ --disabled-password \
+ --group \
+ --home /no-home \
+ --shell /bin/false \
+ --system \
+ "$run_user"
diff --git a/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/run b/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/run
new file mode 100755 (executable)
index 0000000..6b97f39
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh -efux
+exec 2>&1
+run_user=spawn-fcgi.80.git.heureux-cyclage.org
+sock_user=www-data
+exec /usr/bin/spawn-fcgi
+ -g "$run_user" \
+ -G "$sock_user" \
+ -M 0660 \
+ -n \
+ -s /run/nginx/fastcgi/spawn-fcgi.80.git.heureux-cyclage.org \
+ -u "$run_user" \
+ -U "$sock_user" \
+ -- /usr/bin/multiwatch \
+ --forks 10 \
+ -- /usr/sbin/fcgiwrap
diff --git a/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run b/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run
deleted file mode 100755 (executable)
index 3e598b4..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh -efux
-exec 2>&1
-run_user=git-spawn-fcgi-80
-sock_user=www-data
-exec /usr/bin/spawn-fcgi
- -g "$run_user" \
- -G "$sock_user" \
- -M 0660 \
- -n \
- -s /run/nginx/fastcgi/spawn-fcgi.git.80.git.heureux-cyclage.org \
- -u "$run_user" \
- -U "$sock_user" \
- -- /usr/bin/multiwatch \
- --forks 10 \
- -- /usr/sbin/fcgiwrap
diff --git a/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run.sh b/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run.sh
deleted file mode 100644 (file)
index e69de29..0000000
index 8ffc922..b4a73b5 100755 (executable)
--- a/vm_hosted
+++ b/vm_hosted
@@ -660,6 +660,10 @@ rule_login_configure () {
                # Xen hypervisor console
                hvc:2345:respawn:/sbin/getty 38400 hvc0
                #xvc:2345:respawn:/sbin/getty 38400 xvc0
+               
+               #-- runit begin
+               SV:123456:respawn:/usr/sbin/runsvdir-start
+               #-- runit end
                EOF
        sudo install -m 644 -o root -g root /dev/stdin /etc/login.defs <<-EOF
                MAIL_DIR         /var/mail
@@ -1111,6 +1115,34 @@ rule_procmail_configure () {
         "$tool"/etc/skel/etc/mail/delivery.procmailrc \
                /etc/skel/etc/mail/delivery.procmailrc
  }
+rule_runit_configure () {
+       rule apt_get_install runit
+       local -; set +f
+       rm -f /etc/service/*
+        # NOTE: runsvdir éteindra les services qui n'apparaîtront plus ici.
+       for sv in "$tool"/etc/sv/*
+        do sv=${sv#"$tool"/etc/sv/}
+               sudo install -d -m 770 -o root -g root \
+                /etc/sv/"$sv"
+               sudo install -m 770 -o root -g root \
+                "$tool"/etc/sv/"$sv"/run \
+                       /etc/sv/"$sv"/run
+               if test -e "$tool"/etc/sv/"$sv"/log/run
+                then
+                       sudo install -d -m 770 -o root -g root \
+                        /etc/sv/"$sv"/log
+                       sudo install -m 770 -o root -g root \
+                        "$tool"/etc/sv/"$sv"/log/run \
+                               /etc/sv/"$sv"/log/run
+                fi
+               if test ! -x "$tool"/etc/sv/"$sv"/configure ||
+                       "$tool"/etc/sv/"$sv"/configure
+                then
+                       ln -fns ../sv/"$sv" /etc/service/"$sv"
+                       sv restart "$sv"
+                else
+        done
+ }
 rule_ssh_configure () {
        ssh-keygen -F "$vm_fqdn" -f "$tool"/etc/openssh/known_hosts |
        ( while IFS= read -r line
@@ -1309,6 +1341,7 @@ rule_configure () {
        rule nginx_configure
        rule php5_fpm_configure
        rule gitolite_configure
+       rule runit_configure
  }
 
 rule_luks_key_change () {