diff options
| author | Yi Zhao <yi.zhao@windriver.com> | 2018-01-10 11:09:56 +0800 |
|---|---|---|
| committer | Joe MacDonald <joe_macdonald@mentor.com> | 2018-02-05 10:40:18 -0500 |
| commit | b5b95422e7be2cb65a652fc9477246469668ed9c (patch) | |
| tree | 8d48603f4787c895dd7bbc847209ac78727c6e96 /meta-networking/recipes-daemons/postfix/postfix.inc | |
| parent | 10b76743988fe73d81f7781f7412d3e3e1a81b91 (diff) | |
| download | meta-openembedded-b5b95422e7be2cb65a652fc9477246469668ed9c.tar.gz | |
postfix: fix generating aliases db files
When generating aliases db files, the newaliases tries to chdir
/var/spool/postfix on the host. It would cause a failure if the host
doesn't install postfix:
newaliases: fatal: chdir /var/spool/postfix: No such file or directory
Move this step from do_install to pkg_postinst to make sure newaliases
and postmap run during the image creation.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-daemons/postfix/postfix.inc')
| -rw-r--r-- | meta-networking/recipes-daemons/postfix/postfix.inc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-networking/recipes-daemons/postfix/postfix.inc index e48fc39f2e..fa5eef9f55 100644 --- a/meta-networking/recipes-daemons/postfix/postfix.inc +++ b/meta-networking/recipes-daemons/postfix/postfix.inc | |||
| @@ -150,7 +150,7 @@ do_install () { | |||
| 150 | install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/ | 150 | install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/ |
| 151 | install -d ${D}${sysconfdir}/init.d | 151 | install -d ${D}${sysconfdir}/init.d |
| 152 | install -m 644 ${WORKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf | 152 | install -m 644 ${WORKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf |
| 153 | sed -i 's#@LIBEXECDIR@#${libexecdir}/postfix#' ${D}${sysconfdir}/postfix/main.cf | 153 | sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf |
| 154 | 154 | ||
| 155 | install -m 755 ${WORKDIR}/check_hostname.sh ${D}${sbindir}/ | 155 | install -m 755 ${WORKDIR}/check_hostname.sh ${D}${sbindir}/ |
| 156 | 156 | ||
| @@ -159,7 +159,7 @@ do_install () { | |||
| 159 | 159 | ||
| 160 | install -d ${D}${systemd_unitdir}/system | 160 | install -d ${D}${systemd_unitdir}/system |
| 161 | install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system | 161 | install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system |
| 162 | sed -i -e 's#@LIBEXECDIR@#${libexecdir}/postfix#g' ${D}${systemd_unitdir}/system/postfix.service | 162 | sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/postfix.service |
| 163 | sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/postfix.service | 163 | sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/postfix.service |
| 164 | sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/postfix.service | 164 | sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/postfix.service |
| 165 | 165 | ||
| @@ -217,12 +217,6 @@ do_install_append_class-native() { | |||
| 217 | do_install_append_class-target() { | 217 | do_install_append_class-target() { |
| 218 | # Remove references to buildmachine paths in target makedefs.out | 218 | # Remove references to buildmachine paths in target makedefs.out |
| 219 | sed -i 's:-fdebug-prefix-map[^ ]*::g; s:--sysroot=${STAGING_DIR_TARGET}::g' ${D}/etc/postfix/makedefs.out | 219 | sed -i 's:-fdebug-prefix-map[^ ]*::g; s:--sysroot=${STAGING_DIR_TARGET}::g' ${D}/etc/postfix/makedefs.out |
| 220 | # Since we are building recipe postfix, newaliases and postmap come from our sysroot_native. | ||
| 221 | touch ${D}/etc/aliases | ||
| 222 | newaliases -C ${D}/etc/postfix/main.cf -oA${D}/etc/aliases | ||
| 223 | touch ${D}/etc/postfix/virtual_alias | ||
| 224 | postmap -c ${D}/etc/postfix ${D}/etc/postfix/virtual_alias | ||
| 225 | |||
| 226 | } | 220 | } |
| 227 | 221 | ||
| 228 | ALTERNATIVE_${PN} = "sendmail" | 222 | ALTERNATIVE_${PN} = "sendmail" |
| @@ -235,6 +229,7 @@ ALTERNATIVE_LINK_NAME[mailq.1] = "${mandir}/man1/mailq.1" | |||
| 235 | ALTERNATIVE_LINK_NAME[newaliases.1] = "${mandir}/man1/newaliases.1" | 229 | ALTERNATIVE_LINK_NAME[newaliases.1] = "${mandir}/man1/newaliases.1" |
| 236 | ALTERNATIVE_LINK_NAME[sendmail.1] = "${mandir}/man1/sendmail.1" | 230 | ALTERNATIVE_LINK_NAME[sendmail.1] = "${mandir}/man1/sendmail.1" |
| 237 | 231 | ||
| 232 | PACKAGE_WRITE_DEPS += "postfix-native" | ||
| 238 | pkg_postinst_${PN} () { | 233 | pkg_postinst_${PN} () { |
| 239 | if [ "x$D" = "x" ]; then | 234 | if [ "x$D" = "x" ]; then |
| 240 | touch /etc/aliases | 235 | touch /etc/aliases |
| @@ -244,6 +239,11 @@ pkg_postinst_${PN} () { | |||
| 244 | touch /etc/postfix/virtual_alias | 239 | touch /etc/postfix/virtual_alias |
| 245 | postmap /etc/postfix/virtual_alias | 240 | postmap /etc/postfix/virtual_alias |
| 246 | else | 241 | else |
| 242 | touch $D/etc/aliases | ||
| 243 | newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases | ||
| 244 | touch $D/etc/postfix/virtual_alias | ||
| 245 | postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias | ||
| 246 | |||
| 247 | if ${@'true' if 'linuxstdbase' in d.getVar('DISTROOVERRIDES', False) else 'false'}; then | 247 | if ${@'true' if 'linuxstdbase' in d.getVar('DISTROOVERRIDES', False) else 'false'}; then |
| 248 | # /usr/lib/sendmail is required by LSB core test | 248 | # /usr/lib/sendmail is required by LSB core test |
| 249 | [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail $D/usr/lib/ | 249 | [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail $D/usr/lib/ |
| @@ -254,5 +254,4 @@ pkg_postinst_${PN} () { | |||
| 254 | # Exclude .debug directories from the main package | 254 | # Exclude .debug directories from the main package |
| 255 | FILES_${PN} = "${sysconfdir} ${localstatedir} ${bindir}/* ${sbindir}/* \ | 255 | FILES_${PN} = "${sysconfdir} ${localstatedir} ${bindir}/* ${sbindir}/* \ |
| 256 | ${libexecdir}/* ${systemd_unitdir}/*" | 256 | ${libexecdir}/* ${systemd_unitdir}/*" |
| 257 | CONFFILES_${PN} = "/etc/aliases /etc/postfix/virtual_alias*" | ||
| 258 | FILES_${PN}-dbg += "${libexecdir}/postfix/.debug" | 257 | FILES_${PN}-dbg += "${libexecdir}/postfix/.debug" |
