From 1b63122dd097c575896b4c4158ed5439eeca1563 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 11 Apr 2013 20:18:51 +0200 Subject: [PATCH] Correction : vm_hosted : etc/init.d/tmpfs -> etc/sv/*/run . --- etc/init.d/tmpfs | 90 ---------------------------------------- etc/nsd3/nsd.conf | 2 +- etc/sv/gitweb/run | 4 ++ etc/sv/lhc-remorque/run | 2 + etc/sv/mysql/run | 3 ++ etc/sv/nginx/run | 6 +++ etc/sv/nsd3/run | 2 + etc/sv/php5-fpm/run | 6 +++ etc/sv/postgres/run | 2 + etc/sv/postgrey/run | 2 + etc/sv/sshd/run | 4 ++ vm_hosted | 92 ++++++++++++++--------------------------- 12 files changed, 63 insertions(+), 152 deletions(-) delete mode 100755 etc/init.d/tmpfs diff --git a/etc/init.d/tmpfs b/etc/init.d/tmpfs deleted file mode 100755 index 8e46d00..0000000 --- a/etc/init.d/tmpfs +++ /dev/null @@ -1,90 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: tmpfs -# Required-Start: $local_fs -# Required-Stop: $local_fs -# X-Start-Before: nginx -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Initialise tmpfs file systems -### END INIT INFO - -PATH=/sbin:/usr/sbin:/bin:/usr/bin - -. /lib/init/vars.sh -. /lib/lsb/init-functions - -do_start() { - if [ -x /etc/rc.local ] - then - [ "$VERBOSE" != no ] && log_begin_msg "Initialising tmpfs file systems" - - ! mountpoint -q /run || - sudo install -d -m 770 -o www-data -g www-data \ - /run/nginx \ - /run/nginx/fastcgi - - if mountpoint -q /run/shm && - test -f /run/shm/.tmpfs - then - set -x - sudo install -d -m 1777 -o root -g root \ - /run/shm/cache \ - /run/shm/tmp - - ! getent passwd www-data >/dev/null || - sudo install -d -m 770 -o www-data -g www-data \ - /run/shm/cache/nginx \ - /run/shm/cache/nginx/fastcgi \ - /run/shm/cache/nginx/client_body - - ! getent passwd php5 >/dev/null || - sudo install -d -m 1771 -o php5 -g php5 \ - /run/php5 \ - /run/php5/fpm \ - /run/shm/cache/php5 \ - /run/shm/cache/php5/fpm \ - /run/shm/tmp/php5 - - ! getent passwd fcgi-gitweb >/dev/null || - sudo install -d -m 1771 -o fcgi-gitweb -g fcgi-gitweb \ - /run/shm/tmp/gitweb - - ! getent passwd mysql >/dev/null || - sudo install -d -m 1771 -o mysql -g mysql \ - /run/mysqld \ - /run/mysqld/sock - - ! getent passwd postgres >/dev/null || - sudo install -d -m 710 -o postgres -g postgres-data \ - /run/postgresql - - ! getent passwd postgrey >/dev/null || - sudo install -d -m 2710 -o postgrey -g postfix \ - /run/postgrey - - sudo install -d -m 1771 -o root -g root \ - /run/spawn-fcgi - fi - - ES=$? - [ "$VERBOSE" != no ] && log_end_msg $ES - return $ES - fi - } - -case "$1" in - (start|restart) - do_start - ;; - (reload|force-reload) - echo "Error: argument '$1' not supported" >&2 - exit 3 - ;; - (stop) - ;; - (*) - echo "Usage: $0 start|restart|stop" >&2 - exit 3 - ;; - esac diff --git a/etc/nsd3/nsd.conf b/etc/nsd3/nsd.conf index 316af64..35e05b9 100644 --- a/etc/nsd3/nsd.conf +++ b/etc/nsd3/nsd.conf @@ -10,7 +10,7 @@ ipv4-edns-size: 4096 # ipv6-edns-size: 4096 # logfile: "/var/log/nsd.log" # nsid: "aabbccdd" -# pidfile: "/run/nsd3.pid" +pidfile: "/dev/null" port: 53 rrl-ratelimit: 200 rrl-size: 10000 diff --git a/etc/sv/gitweb/run b/etc/sv/gitweb/run index 3f78af2..150854d 100755 --- a/etc/sv/gitweb/run +++ b/etc/sv/gitweb/run @@ -1,6 +1,10 @@ #!/bin/sh -eux exec 2>&1 sv=${PWD#/etc/sv/} +install -d -m 1771 -o root -g root \ + /run/spawn-fcgi +install -d -m 1771 -o fcgi-gitweb -g fcgi-gitweb \ + /run/shm/tmp/gitweb exec /usr/bin/spawn-fcgi \ -u fcgi-"$sv" \ -g fcgi-"$sv" \ diff --git a/etc/sv/lhc-remorque/run b/etc/sv/lhc-remorque/run index 23bfe9e..0f2c6bb 100755 --- a/etc/sv/lhc-remorque/run +++ b/etc/sv/lhc-remorque/run @@ -2,6 +2,8 @@ exec 2>&1 sv=${PWD#/etc/sv/} /usr/bin/sv -w 3 start sshd +install -d -m 1771 -o root -g root \ + /run/spawn-fcgi exec /usr/bin/spawn-fcgi \ -u fcgi-"$sv" \ -g fcgi-"$sv" \ diff --git a/etc/sv/mysql/run b/etc/sv/mysql/run index 6a4b625..84bf3b3 100755 --- a/etc/sv/mysql/run +++ b/etc/sv/mysql/run @@ -1,6 +1,9 @@ #!/bin/sh -eux exec 2>&1 sv=${PWD#/etc/sv/} +install -d -m 1771 -o mysql -g mysql \ + /run/mysqld \ + /run/mysqld/sock eval "home=~$sv" exec /usr/bin/chpst \ -u "$sv":"$sv" \ diff --git a/etc/sv/nginx/run b/etc/sv/nginx/run index 4cb7f40..aa49fd8 100755 --- a/etc/sv/nginx/run +++ b/etc/sv/nginx/run @@ -5,6 +5,12 @@ sv=${PWD#/etc/sv/} lhc-remorque \ gitweb \ php5-fpm +install -d -m 770 -o www-data -g www-data \ + /run/nginx \ + /run/nginx/fastcgi \ + /run/shm/cache/nginx \ + /run/shm/cache/nginx/fastcgi \ + /run/shm/cache/nginx/client_body exec /usr/sbin/nginx \ -c /etc/nginx/nginx.conf \ -g 'daemon off;' diff --git a/etc/sv/nsd3/run b/etc/sv/nsd3/run index a59c393..9989289 100755 --- a/etc/sv/nsd3/run +++ b/etc/sv/nsd3/run @@ -1,6 +1,8 @@ #!/bin/sh -eux exec 2>&1 sv=${PWD#/etc/sv/} +install -d -m 770 -o root -g root \ + /run/nsd3 exec /usr/sbin/nsd \ -c /etc/nsd3/nsd.conf \ -d diff --git a/etc/sv/php5-fpm/run b/etc/sv/php5-fpm/run index c1c042f..4af1b26 100755 --- a/etc/sv/php5-fpm/run +++ b/etc/sv/php5-fpm/run @@ -1,6 +1,12 @@ #!/bin/sh -eux exec 2>&1 sv=${PWD#/etc/sv/} +install -d -m 1771 -o php5 -g php5 \ + /run/php5 \ + /run/php5/fpm \ + /run/shm/cache/php5 \ + /run/shm/cache/php5/fpm \ + /run/shm/tmp/php5 exec /usr/sbin/php5-fpm \ --fpm-config /etc/php5/fpm/php-fpm.conf \ --php-ini /etc/php5/fpm/php.ini diff --git a/etc/sv/postgres/run b/etc/sv/postgres/run index d8eedca..addd8eb 100755 --- a/etc/sv/postgres/run +++ b/etc/sv/postgres/run @@ -1,6 +1,8 @@ #!/bin/sh -eux exec 2>&1 sv=${PWD#/etc/sv/} +install -d -m 710 -o postgres -g postgres-data \ + /run/postgresql eval "home=~$sv" exec /usr/bin/chpst \ -u "$sv":"$sv":"$sv"-data \ diff --git a/etc/sv/postgrey/run b/etc/sv/postgrey/run index fba506a..38725ef 100755 --- a/etc/sv/postgrey/run +++ b/etc/sv/postgrey/run @@ -1,6 +1,8 @@ #!/bin/sh -eux exec 2>&1 sv=${PWD#/etc/sv/} +install -d -m 2710 -o postgrey -g postfix \ + /run/postgrey exec /usr/bin/chpst \ -u "$sv":"$sv" \ /usr/sbin/postgrey \ diff --git a/etc/sv/sshd/run b/etc/sv/sshd/run index 477eebe..6a287a0 100755 --- a/etc/sv/sshd/run +++ b/etc/sv/sshd/run @@ -1,4 +1,8 @@ #!/bin/sh -eux exec 2>&1 sv=${PWD#/etc/sv/} +install -d -m 755 -o root -g root /run/sshd +install -d -m 1777 -o root -g root \ + /run/shm/cache \ + /run/shm/tmp exec /usr/sbin/sshd -D diff --git a/vm_hosted b/vm_hosted index ed42445..3259ef1 100755 --- a/vm_hosted +++ b/vm_hosted @@ -299,7 +299,7 @@ rule_boot_configure () { } rule_dovecot_configure () { rule apt_get_install dovecot-imapd dovecot-managesieved dovecot-sieve - rule insserv_remove dovecot + rule insserv_remove dovecot local hint="run vm_remote dovecot_key_send before" assert "sudo test -f /etc/dovecot/\"$vm_domainname\"/imap/x509/key.pem" hint sudo install -m 400 -o root -g root \ @@ -324,8 +324,7 @@ rule_dovecot_configure () { \$USER:\$(/usr/bin/doveadm pw -s SHA512-CRYPT)::::::: _EOF EOF - rule runit_sv_configure dovecot - rule runit_sv_restart dovecot + rule runit_configure dovecot } rule_etckeeper_configure () { sudo install -m 644 -o root -g root /dev/stdin /etc/etckeeper/etckeeper.conf <<-EOF @@ -418,8 +417,9 @@ rule_initramfs_configure () { } rule_insserv_remove () { # SYNTAX: $sv local sv="$1" - sudo chmod u+x /etc/init.d/"$sv" + #sudo chmod u+x /etc/init.d/"$sv" sudo insserv --force --remove "$sv" + sudo test ! -x /etc/init.d/"$sv" || sudo /etc/init.d/"$sv" stop sudo chmod ugo-x /etc/init.d/"$sv" } @@ -528,7 +528,6 @@ rule_gitolite_configure () { do test ! -d /home/git/etc/gitolite/"$d" || rmdir /home/git/etc/gitolite/"$d" done - rule tmpfs_configure } rule_locales_configure () { sudo debconf-set-selections <<-EOF @@ -568,7 +567,7 @@ rule_mail_configure () { } rule_mysql_configure () { rule apt_get_install mysql-server-5.5 - rule insserv_remove mysql + rule insserv_remove mysql rule adduser mysql \ --disabled-login \ --disabled-password \ @@ -607,9 +606,7 @@ rule_mysql_configure () { --datadir=/home/mysql/data \ --no-defaults fi - rule tmpfs_configure - rule runit_sv_configure mysql - rule runit_sv_restart mysql + rule runit_configure mysql while ! sudo -u mysql mysql -u mysql