[OpenWrt-Devel] Postfix on OpenWRT

W. Michael Petullo mike at flyn.org
Sun Sep 28 18:04:13 EDT 2014


> Wow! I'm happy that someone new joined the party. Toes it mean that binary
> packages for Barrier Breaker are going to be available? I'm asking because
> during the compilation I get the following error:
> 
> /mnt/trash/barrier_breaker-14.07-rc3/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.8.3/../../../../mips-openwrt-linux-uclibc/bin/ld:
> skipping incompatible /usr/lib64/libc.so when searching for -lc
> collect2: error: ld returned 1 exit status
> Makefile:50: recipe for target 'master' failed

Postfix compiles fine on my build host (Fedora 20), but actually creating
the packages causes the following errors (here it looks like the script
is trying to manipulate my build host's root filesystem):

> Configuring postfix.
> postfix: error: to submit mail, use the Postfix sendmail command
> postfix: fatal: the postfix command is reserved for the superuser
> postfix: error: to submit mail, use the Postfix sendmail command
> postfix: fatal: the postfix command is reserved for the superuser
> postalias: fatal: open /etc/aliases.db: Permission denied
> grep: /etc/sysupgrade.conf: No such file or directory
> /home/mike/Source/openwrt/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/root-ar71xx//usr/lib/opkg/info/postfix.postinst: line 24: [: -eq: unary operator expected
> /home/mike/Source/openwrt/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/root-ar71xx//usr/lib/opkg/info/postfix.postinst: line 29: /etc/init.d/postfix: No such file or directory

The following is the postinst script, with some comments inline:
 
> define Package/postfix/postinst
> #!/bin/sh
> if [ `grep -c postfix /etc/passwd` -eq 0 ]
> then
>  echo "postfix:x:34:" >> /etc/group
>  echo "postdrop:x:35:" >> /etc/group
>  echo "postfix:!:34:34::/var:/bin/false" >> /etc/passwd
> fi

Adding users often goes in the init.d script where we can make use of some
common shell functions. See, for example, lighttpd's use of user_exists
in lighttpd.init at:

	https://github.com/openwrt/packages/blob/master/net/lighttpd/files/lighttpd.init

> if [ ! -f /etc/services ] || [ `grep -c smtp /etc/services` -eq 0 ]
> then
>  echo "smtp            25/tcp          mail" >> /etc/services
>  echo "smtp            25/udp          mail" >> /etc/services
> fi

I think /etc/services always includes smtp on OpenWrt. Is this not
correct?

> if [ ! -f /etc/aliases ]
> then
>  ln -s /etc/postfix/aliases /etc/aliases
> fi

Why do we need /etc/aliases?

> postfix set-permissions
> postfix upgrade-configuration
> newaliases
> if [ `ps | grep "postfix/master" | grep -cv grep` -gt 0 ]
> then
>  postfix reload
> fi
> if [ `grep -c aliases /etc/sysupgrade.conf` -eq 0 ]
> then
>  echo "/etc/postfix/main.cf" >> /etc/sysupgrade.conf
>  echo "/etc/postfix/aliases" >> /etc/sysupgrade.conf
> fi
> /etc/init.d/postfix enable
> endef

Thanks,

-- 
Mike

:wq
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list