You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.3 KiB

postfix: fix uid/gid conflicts, general cleanup Fix uid/gid conflict with package icecast (uid=87, gid=87) and package pianod (uid=88, gid=88) by claiming uid/gid 25 for postfix instead of 87 and uid/gid 26 for postconf instead of 88. Remove main.cf.default that is not used by any Postfix module. The default configuration parameters are hardcoded into postconf and they are available via "postconf -d <parameter>". main.cf.default is therefore unnecessary. "mydomain" parameter should be deduced from the domain configuration setting in /e/c/dhcp rather than from "hostname" in /e/c/system which is often just a hostname without the domain name component. "mynetworks" parameter is unnecessary where "mynetworks_style" is defined. The change of the location of data_directory, queue_directory and mail_spool_directory from /var/lib/postfix, /var/spool/postfix and /var/mail to /data/postfix/lib, /data/postfix/spool and /data/postfix/mail has been postponed until the author of this commit and the maintainer of this package has had a meaningful opportunity to consult with LEDE/OpenWrt developers on the preferred mount point for the persistent data storage device. Change the criteria for executing the post-installation script. Invoke postinst() where the value of "myhostname" parameter in main.cf is not defined rather than where "$config_directory"/opkg_postinst is present with the value of "$config_directory" hardcoded to "$IPKG_INSTROOT"/etc/postfix in /etc/init.d/postfix. Enable PCRE support by default. Remove the code making entries in /etc/sysupgrade.conf and instead define configuration files to be saved during a sysupgrade in Makefile's Package/postfix/conffiles section. Move the creation of mail_spool_directory from host to target in order to enable change of directory ownership to 'postfix' when postinit() is executed on the target. Avoid postfix restart in postinst script that results in an error message during opkg install process. Enable Postfix autostart by creating a link in /etc/rc.d/ on installation. Make the code less verbose. Signed-off-by: Val Kulkov <val.kulkov@gmail.com>
7 years ago
postfix: fix uid/gid conflicts, general cleanup Fix uid/gid conflict with package icecast (uid=87, gid=87) and package pianod (uid=88, gid=88) by claiming uid/gid 25 for postfix instead of 87 and uid/gid 26 for postconf instead of 88. Remove main.cf.default that is not used by any Postfix module. The default configuration parameters are hardcoded into postconf and they are available via "postconf -d <parameter>". main.cf.default is therefore unnecessary. "mydomain" parameter should be deduced from the domain configuration setting in /e/c/dhcp rather than from "hostname" in /e/c/system which is often just a hostname without the domain name component. "mynetworks" parameter is unnecessary where "mynetworks_style" is defined. The change of the location of data_directory, queue_directory and mail_spool_directory from /var/lib/postfix, /var/spool/postfix and /var/mail to /data/postfix/lib, /data/postfix/spool and /data/postfix/mail has been postponed until the author of this commit and the maintainer of this package has had a meaningful opportunity to consult with LEDE/OpenWrt developers on the preferred mount point for the persistent data storage device. Change the criteria for executing the post-installation script. Invoke postinst() where the value of "myhostname" parameter in main.cf is not defined rather than where "$config_directory"/opkg_postinst is present with the value of "$config_directory" hardcoded to "$IPKG_INSTROOT"/etc/postfix in /etc/init.d/postfix. Enable PCRE support by default. Remove the code making entries in /etc/sysupgrade.conf and instead define configuration files to be saved during a sysupgrade in Makefile's Package/postfix/conffiles section. Move the creation of mail_spool_directory from host to target in order to enable change of directory ownership to 'postfix' when postinit() is executed on the target. Avoid postfix restart in postinst script that results in an error message during opkg install process. Enable Postfix autostart by creating a link in /etc/rc.d/ on installation. Make the code less verbose. Signed-off-by: Val Kulkov <val.kulkov@gmail.com>
7 years ago
postfix: fix uid/gid conflicts, general cleanup Fix uid/gid conflict with package icecast (uid=87, gid=87) and package pianod (uid=88, gid=88) by claiming uid/gid 25 for postfix instead of 87 and uid/gid 26 for postconf instead of 88. Remove main.cf.default that is not used by any Postfix module. The default configuration parameters are hardcoded into postconf and they are available via "postconf -d <parameter>". main.cf.default is therefore unnecessary. "mydomain" parameter should be deduced from the domain configuration setting in /e/c/dhcp rather than from "hostname" in /e/c/system which is often just a hostname without the domain name component. "mynetworks" parameter is unnecessary where "mynetworks_style" is defined. The change of the location of data_directory, queue_directory and mail_spool_directory from /var/lib/postfix, /var/spool/postfix and /var/mail to /data/postfix/lib, /data/postfix/spool and /data/postfix/mail has been postponed until the author of this commit and the maintainer of this package has had a meaningful opportunity to consult with LEDE/OpenWrt developers on the preferred mount point for the persistent data storage device. Change the criteria for executing the post-installation script. Invoke postinst() where the value of "myhostname" parameter in main.cf is not defined rather than where "$config_directory"/opkg_postinst is present with the value of "$config_directory" hardcoded to "$IPKG_INSTROOT"/etc/postfix in /etc/init.d/postfix. Enable PCRE support by default. Remove the code making entries in /etc/sysupgrade.conf and instead define configuration files to be saved during a sysupgrade in Makefile's Package/postfix/conffiles section. Move the creation of mail_spool_directory from host to target in order to enable change of directory ownership to 'postfix' when postinit() is executed on the target. Avoid postfix restart in postinst script that results in an error message during opkg install process. Enable Postfix autostart by creating a link in /etc/rc.d/ on installation. Make the code less verbose. Signed-off-by: Val Kulkov <val.kulkov@gmail.com>
7 years ago
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2014 OpenWrt.org
  3. START=72
  4. STOP=50
  5. extra_command "status" "Display the service status"
  6. extra_command "abort" "Stop the service abruptly. Running processes are signaled to stop immediately"
  7. extra_command "flush" "Force delivery: attempt to deliver every message in the deferred mail queue"
  8. extra_command "postinst" "Force running a script that checks for users, group, configuration, permissions, etc"
  9. postinst() {
  10. if [ -z "$(postconf -nh myhostname)" ]; then
  11. postconf -e "myhostname = $(uci get system.@system[0].hostname)"
  12. fi
  13. if [ -z "$(postconf -nh mydomain)" ]; then
  14. postconf -e "mydomain = $(uci get dhcp.@dnsmasq[0].domain)"
  15. fi
  16. if [ -z "$(postconf -nh mynetworks_style)" ]; then
  17. postconf -e "mynetworks_style = subnet"
  18. fi
  19. mail_spool_directory=$(postconf -h mail_spool_directory)
  20. if [ ! -d $mail_spool_directory ]; then
  21. mkdir -p -m 0755 $mail_spool_directory
  22. chown -R postfix $mail_spool_directory
  23. fi
  24. postfix set-permissions
  25. postfix post-install upgrade-source
  26. postfix upgrade-configuration
  27. newaliases
  28. postmap $(postconf -h config_directory)/virtual
  29. postfix check
  30. }
  31. start() {
  32. if [ -z "$(postconf -nh myhostname)" ]; then
  33. postinst
  34. fi
  35. postfix start
  36. }
  37. stop() {
  38. postfix stop
  39. }
  40. reload() {
  41. postfix reload
  42. }
  43. status() {
  44. postfix status
  45. }
  46. abort() {
  47. postfix abort
  48. }
  49. flush() {
  50. postfix flush
  51. }