ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/external/subpack/mail/postfix/files/postfix.init b/external/subpack/mail/postfix/files/postfix.init
new file mode 100644
index 0000000..161c371
--- /dev/null
+++ b/external/subpack/mail/postfix/files/postfix.init
@@ -0,0 +1,61 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2014 OpenWrt.org
+
+START=72
+STOP=50
+
+extra_command "status" "Display the service status"
+extra_command "abort" "Stop the service abruptly. Running processes are signaled to stop immediately"
+extra_command "flush" "Force delivery: attempt to deliver every message in the deferred mail queue"
+extra_command "postinst" "Force running a script that checks for users, group, configuration, permissions, etc"
+
+postinst() {
+ if [ -z "$(postconf -nh myhostname)" ]; then
+ postconf -e "myhostname = $(uci get system.@system[0].hostname)"
+ fi
+ if [ -z "$(postconf -nh mydomain)" ]; then
+ postconf -e "mydomain = $(uci get dhcp.@dnsmasq[0].domain)"
+ fi
+ if [ -z "$(postconf -nh mynetworks_style)" ]; then
+ postconf -e "mynetworks_style = subnet"
+ fi
+ mail_spool_directory=$(postconf -h mail_spool_directory)
+ if [ ! -d $mail_spool_directory ]; then
+ mkdir -p -m 0755 $mail_spool_directory
+ chown -R postfix $mail_spool_directory
+ fi
+
+ postfix set-permissions
+ postfix post-install upgrade-source
+ postfix upgrade-configuration
+ newaliases
+ postmap $(postconf -h config_directory)/virtual
+ postfix check
+}
+
+start() {
+ if [ -z "$(postconf -nh myhostname)" ]; then
+ postinst
+ fi
+ postfix start
+}
+
+stop() {
+ postfix stop
+}
+
+reload() {
+ postfix reload
+}
+
+status() {
+ postfix status
+}
+
+abort() {
+ postfix abort
+}
+
+flush() {
+ postfix flush
+}