Ajout : vm_hosted : rule_tmpfs_configure .
authorJulien Moutinho <julm+burette@autogeree.net>
Mon, 18 Mar 2013 20:01:54 +0000 (21:01 +0100)
committerJulien Moutinho <julm+burette@autogeree.net>
Tue, 19 Mar 2013 09:50:42 +0000 (10:50 +0100)
etc/init.d/tmpfs
vm_hosted

index adf6c72..3a9915c 100755 (executable)
@@ -24,14 +24,23 @@ do_start() {
                 /run/nginx \
                 /run/nginx/fastcgi
                
-               ! mountpoint -q /run/shm ||
-               ! test -f /run/shm/.tmpfs ||
-               sudo install -d -m 1777 -o root -g root \
-                /run/shm/cache &&
-               sudo install -d -m 660 -o www-data -g www-data \
-                /run/shm/cache/nginx \
-                /run/shm/cache/nginx/fastcgi \
-                /run/shm/cache/nginx/client_body
+               if mountpoint -q /run/shm &&
+                       test -f /run/shm/.tmpfs
+                then
+                       sudo install -d -m 1777 -o root -g root \
+                        /run/shm/cache
+                       
+                       ! getent passwd www-data ||
+                       sudo install -d -m 660 -o www-data -g www-data \
+                        /run/shm/cache/nginx \
+                        /run/shm/cache/nginx/fastcgi \
+                        /run/shm/cache/nginx/client_body
+                       
+                       ! getent passwd php5 ||
+                       sudo install -d -m 1667 -o php5 -g php5 \
+                        /run/shm/cache/php5 \
+                        /run/shm/cache/php5/fpm
+                fi
                
                ES=$?
                [ "$VERBOSE" != no ] && log_end_msg $ES
index 5915841..533ef85 100755 (executable)
--- a/vm_hosted
+++ b/vm_hosted
@@ -413,24 +413,7 @@ rule_filesystem_configure () {
                ${vm_lvm_lv}_home_deciphered /dev/$vm_lvm_vg/${vm_lvm_lv}_home ${vm_lvm_lv}_root_deciphered luks,lvm=$vm_lvm_vg,keyscript=/lib/cryptsetup/scripts/decrypt_derived
                ${vm_lvm_lv}_swap_deciphered /dev/$vm_lvm_vg/${vm_lvm_lv}_swap ${vm_lvm_lv}_root_deciphered luks,lvm=$vm_lvm_vg,keyscript=/lib/cryptsetup/scripts/decrypt_derived
                EOF
-       sudo install -m 644 -o root -g root /dev/stdin /etc/default/tmpfs <<-EOF
-               LOCK_SIZE=5242880 # NOTE: 5MiB
-               RAMLOCK=yes
-               RAMSHM=yes
-               RAMTMP=yes
-               RUN_SIZE=10%
-               SHM_SIZE=
-               TMP_MODE=1777,nr_inodes=1000k,noatime
-               TMP_OVERFLOW_LIMIT=1024
-                # NOTE: mount tmpfs on /tmp if there is less than the limit size (in kiB)
-                #       on the root filesystem (overriding RAMTMP).
-               TMP_SIZE=200m
-               TMPFS_SIZE=20%VM
-               EOF
-       sudo install -m 775 -o root -g root \
-        "$tool"/etc/init.d/tmpfs \
-               /etc/init.d/tmpfs
-       sudo update-rc.d tmpfs defaults
+       rule tmpfs_configure
  }
 rule_initramfs_configure () {
        sudo install -m 644 -o root -g root /dev/stdin /etc/initramfs-tools/initramfs.conf <<-EOF
@@ -1205,6 +1188,26 @@ rule_sysctl_configure () {
         done
        sudo sysctl --system
  }
+rule_tmpfs_configure () {
+       sudo install -m 644 -o root -g root /dev/stdin /etc/default/tmpfs <<-EOF
+               LOCK_SIZE=5242880 # NOTE: 5MiB
+               RAMLOCK=yes
+               RAMSHM=yes
+               RAMTMP=yes
+               RUN_SIZE=10%
+               SHM_SIZE=
+               TMP_MODE=1777,nr_inodes=1000k,noatime
+               TMP_OVERFLOW_LIMIT=1024
+                # NOTE: mount tmpfs on /tmp if there is less than the limit size (in kiB)
+                #       on the root filesystem (overriding RAMTMP).
+               TMP_SIZE=200m
+               TMPFS_SIZE=20%VM
+               EOF
+       sudo install -m 775 -o root -g root \
+        "$tool"/etc/init.d/tmpfs \
+               /etc/init.d/tmpfs
+       sudo update-rc.d tmpfs defaults
+ }
 rule_time_configure () {
        sudo install -m 644 -o root -g root /dev/stdin /etc/timezone <<-EOF
                Europe/Paris