[OpenWrt-Devel] Postfix on OpenWRT

Denis Shulyaka shulyaka at gmail.com
Sun Sep 28 19:20:29 EDT 2014


> It can be redefined in the user config file. I was going to write a
patch but thought /etc/aliases is where users would look for it, so I
made a soft link. Do you think it is wrong?

OK, did that also. Same link.

2014-09-29 3:03 GMT+04:00 Denis Shulyaka <shulyaka at gmail.com>:
> Hi,
>
> I'm currently packaging a 2.11.1 version. Here is the link:
>
> http://shulyaka.org.ru/pub/tinycdb.tar.gz
> http://shulyaka.org.ru/pub/postfix.tar.gz
>
> 2014-09-29 2:04 GMT+04:00 W. Michael Petullo <mike at flyn.org>:
>>> 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:
>
> This has been fixed (with the help from Reinhard Schu) in the 2.11.1
> package. It was a bug in postinst script.
>
>>> 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
>
> Thanks for the hint! I've applied it.
>
>>> 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?
>
> I think I just had a broken setup some time ago, it was completely
> empty. However now I can see a lot of services there so I think it is
> safe to remove. Thanks again for the hint!
>
>>> if [ ! -f /etc/aliases ]
>>> then
>>>  ln -s /etc/postfix/aliases /etc/aliases
>>> fi
>>
>> Why do we need /etc/aliases?
>
> This is a default location hard built into postfix in src/util/sys_defs.h file:
>
> #define ALIAS_DB_MAP    DEF_DB_TYPE ":/etc/aliases"
>
> It can be redefined in the user config file. I was going to write a
> patch but thought /etc/aliases is where users would look for it, so I
> made a soft link. Do you think it is wrong?
>
>>> 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
>
> Best regards,
> Denis Shulyaka
_______________________________________________
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