Modification : $vm_ -> $local_ .
[lhc/ateliers.git] / etc / sv / postfix / local.sh
index 0f5b134..8d6230d 100644 (file)
@@ -1,43 +1,44 @@
-local hint="run before: ./vm_remote runit_configure postfix"
-assert "sudo test -f /etc/postfix/$vm_domainname/smtpd/x509/key.pem" hint
-#warn "lors de l'installation Debian, ne sélectionner aucune configuration pour postfix"
+sudo test -f /etc/postfix/$local_domainname/smtpd/x509/key.pem ||
+printf '%s\n' "$(tput rev)run before: remote/runit-configure dovecot$(tput sgr0)" && exit 1
+
 sudo debconf-set-selections <<-EOF
        postfix postfix/main_mailer_type        select  No configuration
        EOF
 "$tool"/local/apt-get-install postfix procmail postfix-pcre
 "$tool"/local/insserv-remove  postfix
+
 sudo install -m 640 -o root -g root /dev/stdin /etc/postfix/.gitignore <<-EOF
        *.db
        EOF
 sudo install -d -m 771 -o root -g root \
  /etc/postfix/ \
- /etc/postfix/$vm_domainname/ \
- /etc/postfix/$vm_domainname/smtp \
- /etc/postfix/$vm_domainname/smtp/x509 \
- /etc/postfix/$vm_domainname/smtp/x509/ca \
- /etc/postfix/$vm_domainname/smtpd \
- /etc/postfix/$vm_domainname/smtpd/x509 \
- /etc/postfix/$vm_domainname/smtpd/x509/ca
+ /etc/postfix/$local_domainname/ \
+ /etc/postfix/$local_domainname/smtp \
+ /etc/postfix/$local_domainname/smtp/x509 \
+ /etc/postfix/$local_domainname/smtp/x509/ca \
+ /etc/postfix/$local_domainname/smtpd \
+ /etc/postfix/$local_domainname/smtpd/x509 \
+ /etc/postfix/$local_domainname/smtpd/x509/ca
 sudo ln -fns \
  ../crt+crl.self-signed.pem \
- /etc/postfix/$vm_domainname/smtpd/x509/ca/crt.pem
+ /etc/postfix/$local_domainname/smtpd/x509/ca/crt.pem
 sudo install -m 400 -o root -g root \
- "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+crl.self-signed.pem \
-    /etc/postfix/$vm_domainname/smtpd/x509/crt+crl.self-signed.pem
+ "$tool"/var/pub/x509/smtpd.$local_domainname/crt+crl.self-signed.pem \
+    /etc/postfix/$local_domainname/smtpd/x509/crt+crl.self-signed.pem
 sudo install -m 400 -o root -g root \
- "$tool"/var/pub/x509/smtpd.$vm_domainname/crt.pem \
-    /etc/postfix/$vm_domainname/smtpd/x509/crt.pem
+ "$tool"/var/pub/x509/smtpd.$local_domainname/crt.pem \
+    /etc/postfix/$local_domainname/smtpd/x509/crt.pem
 sudo install -m 400 -o root -g root \
- "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+ca.pem \
-    /etc/postfix/$vm_domainname/smtpd/x509/crt+ca.pem
+ "$tool"/var/pub/x509/smtpd.$local_domainname/crt+ca.pem \
+    /etc/postfix/$local_domainname/smtpd/x509/crt+ca.pem
 sudo install -m 400 -o root -g root \
- "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+crl.self-signed.pem \
-    /etc/postfix/$vm_domainname/smtpd/x509/crt+crl.self-signed.pem
+ "$tool"/var/pub/x509/smtpd.$local_domainname/crt+crl.self-signed.pem \
+    /etc/postfix/$local_domainname/smtpd/x509/crt+crl.self-signed.pem
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/header_checks \
-        /etc/postfix/$vm_domainname/header_checks
+ "$tool"/etc/postfix/$local_domainname/header_checks \
+        /etc/postfix/$local_domainname/header_checks
 m4 \
- --define=VM_DOMAINNAME="$vm_domainname" \
+ --define=LOCAL_DOMAINNAME="$local_domainname" \
  <"$tool"/etc/postfix/aliases.m4 |
 sudo install -m 644 -o root -g root /dev/stdin \
  /etc/postfix/aliases
@@ -46,11 +47,11 @@ sudo ln -fns \
  /etc/postfix/aliases \
  /etc/aliases
 cat /dev/stdin "$tool"/etc/postfix/main.cf <<-EOF |
-       mydomain      = $vm_domainname
+       mydomain      = $local_domainname
        myorigin      = \$mydomain
-       myhostname    = $vm_hostname.\$mydomain
+       myhostname    = $local_hostname.\$mydomain
        mail_name     = \$myhostname
-       mydestination = $vm_hostname \$myhostname \$myorigin
+       mydestination = $local_hostname \$myhostname \$myorigin
        EOF
 sudo install -m 644 -o root -g root /dev/stdin \
  /etc/postfix/main.cf
@@ -58,32 +59,32 @@ sudo install -m 640 -o root -g root \
  "$tool"/etc/postfix/master.cf \
         /etc/postfix/master.cf
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/smtp/x509/policy \
-        /etc/postfix/$vm_domainname/smtp/x509/policy
-sudo postmap hash:/etc/postfix/$vm_domainname/smtp/x509/policy
+ "$tool"/etc/postfix/$local_domainname/smtp/x509/policy \
+        /etc/postfix/$local_domainname/smtp/x509/policy
+sudo postmap hash:/etc/postfix/$local_domainname/smtp/x509/policy
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/smtp/header_checks \
-        /etc/postfix/$vm_domainname/smtp/header_checks
+ "$tool"/etc/postfix/$local_domainname/smtp/header_checks \
+        /etc/postfix/$local_domainname/smtp/header_checks
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/smtpd/sender_access \
-        /etc/postfix/$vm_domainname/smtpd/sender_access
-sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/sender_access
+ "$tool"/etc/postfix/$local_domainname/smtpd/sender_access \
+        /etc/postfix/$local_domainname/smtpd/sender_access
+sudo postmap hash:/etc/postfix/$local_domainname/smtpd/sender_access
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/smtpd/client_blacklist \
-        /etc/postfix/$vm_domainname/smtpd/client_blacklist
-sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/client_blacklist
+ "$tool"/etc/postfix/$local_domainname/smtpd/client_blacklist \
+        /etc/postfix/$local_domainname/smtpd/client_blacklist
+sudo postmap hash:/etc/postfix/$local_domainname/smtpd/client_blacklist
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/smtpd/relay_clientcerts \
-        /etc/postfix/$vm_domainname/smtpd/relay_clientcerts
-sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/relay_clientcerts
+ "$tool"/etc/postfix/$local_domainname/smtpd/relay_clientcerts \
+        /etc/postfix/$local_domainname/smtpd/relay_clientcerts
+sudo postmap hash:/etc/postfix/$local_domainname/smtpd/relay_clientcerts
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/transport \
-        /etc/postfix/$vm_domainname/transport
-sudo postmap hash:/etc/postfix/$vm_domainname/transport
+ "$tool"/etc/postfix/$local_domainname/transport \
+        /etc/postfix/$local_domainname/transport
+sudo postmap hash:/etc/postfix/$local_domainname/transport
 sudo install -m 640 -o root -g root \
- "$tool"/etc/postfix/$vm_domainname/virtual_alias \
-        /etc/postfix/$vm_domainname/virtual_alias
-sudo postmap hash:/etc/postfix/$vm_domainname/virtual_alias
+ "$tool"/etc/postfix/$local_domainname/virtual_alias \
+        /etc/postfix/$local_domainname/virtual_alias
+sudo postmap hash:/etc/postfix/$local_domainname/virtual_alias
 sudo install -d -m 770 -o root -g root \
  /etc/skel/etc/mail \
  /etc/skel/var/cache/mail \