Ajout : vm_hosted : rule_sysctl_configure
[lhc/ateliers.git] / vm_hosted
index 6e43c25..df9e348 100755 (executable)
--- a/vm_hosted
+++ b/vm_hosted
@@ -404,10 +404,6 @@ 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/sysctl.d/local-swap.conf <<-EOF
-               vm.swappiness = 10 # NOTE: n'utilise le swap qu'en cas d'absolue nécessité
-               vm.vfs_cache_pressure=50
-               EOF
  }
 rule_initramfs_configure () {
        sudo install -m 644 -o root -g root /dev/stdin /etc/initramfs-tools/initramfs.conf <<-EOF
@@ -1008,6 +1004,16 @@ rule_ssh_configure () {
                EOF
        sudo service ssh restart
  }
+rule_sysctl_configure () {
+       local -; set +f
+       for conf in "$tool"/etc/sysctl.d/*.conf
+        do conf=${conf#"$tool"/etc/sysctl.d/}
+               sudo install -m 660 -o root -g root \
+                "$tool"/etc/sysctl.d/"$conf" \
+                /etc/sysctl.d/"$conf"
+        done
+       sudo sysctl --system
+ }
 rule_user_add () { # SYNTAX: $user
        rule user_configure
        local user=$1
@@ -1125,6 +1131,7 @@ rule_configure () {
        rule ssh_configure
        rule user_root_configure
        rule boot_configure
+       rule sysctl_configure
        rule user_configure
        rule mail_configure
        #rule apache2_configure