Modification : etc/sv/ : polissage et généralise un peu.
authorJulien Moutinho <julm+burette@autogeree.net>
Tue, 19 Mar 2013 22:03:15 +0000 (23:03 +0100)
committerJulien Moutinho <julm+burette@autogeree.net>
Tue, 19 Mar 2013 22:03:15 +0000 (23:03 +0100)
etc/sv/fcgi.80.git.heureux-cyclage.org/configure
etc/sv/fcgi.80.git.heureux-cyclage.org/run
etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure [deleted file]
etc/sv/git-daemon.9418.git.heureux-cyclage.org/log/run [deleted file]
etc/sv/git-daemon.9418.git.heureux-cyclage.org/run [deleted file]
etc/sv/git-daemon/configure [new file with mode: 0755]
etc/sv/git-daemon/log/run [new file with mode: 0755]
etc/sv/git-daemon/run [new file with mode: 0755]
etc/sv/mysql.3306/run

index c01e6d0..ee22eba 100755 (executable)
@@ -1,11 +1,15 @@
 #!/bin/sh -efux
-run_user=fcgi.80.git.heureux-cyclage.org
-id "$run_user" >/dev/null ||
+sv=$(basename "$(cd "$(dirname "$0")" && cd -)")
+IFS=. read -r service site <<-EOF
+       $sv
+       EOF
+user=$sv
+getent passwd "$user" >/dev/null ||
 sudo adduser \
  --disabled-login \
  --disabled-password \
  --group \
- --home /no-home \
+ --home /home/www/pub/"$site" \
  --shell /bin/false \
  --system \
- "$run_user"
+ "$user"
index 5e19e1f..fc32089 100755 (executable)
@@ -1,6 +1,10 @@
 #!/bin/sh -efux
 exec 2>&1
-run_user=fcgi.80.git.heureux-cyclage.org
+sv=$(basename "$(cd "$(dirname "$0")" && cd -)")
+IFS=. read -r service site <<-EOF
+       $sv
+       EOF
+run_user=$sv
 sock_user=www-data
 exec /usr/bin/spawn-fcgi \
  -g "$run_user" \
diff --git a/etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure
deleted file mode 100755 (executable)
index dceee35..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/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
deleted file mode 100755 (executable)
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.9418.git.heureux-cyclage.org/run b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/run
deleted file mode 100755 (executable)
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/configure b/etc/sv/git-daemon/configure
new file mode 100755 (executable)
index 0000000..8c3783b
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh -efux
+user=git-daemon
+getent passwd "$user" >/dev/null ||
+sudo adduser \
+ --disabled-login \
+ --disabled-password \
+ --group \
+ --home /home/git/pub \
+ --shell /bin/false \
+ --system \
+ "$user"
+getent passwd 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/log/run b/etc/sv/git-daemon/log/run
new file mode 100755 (executable)
index 0000000..bcecd63
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh -efux
+user=git-daemon
+install -d -m 770 -o log."$user" -g log."$user" /home/git/log/git-daemon/
+exec chpst -u log."$user" svlogd -tt /home/git/log/git-daemon/
diff --git a/etc/sv/git-daemon/run b/etc/sv/git-daemon/run
new file mode 100755 (executable)
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
index 4d9f5fa..f8597b2 100755 (executable)
@@ -5,8 +5,8 @@ exec /usr/bin/chpst \
  /usr/sbin/mysqld \
  --basedir=/usr \
  --datadir=/home/mysql \
- --plugin-dir=/usr/lib/mysql/plugin \
- --user=mysql \
  --pid-file=/var/run/mysqld/mysqld.pid \
+ --plugin-dir=/usr/lib/mysql/plugin \
+ --port=3306 \
  --socket=/var/run/mysqld/mysqld.sock \
- --port=3306
+ --user=mysql