Comments
Patch
new file mode 100644
@@ -0,0 +1,37 @@
+Upstream-Status: Inappropriate [other]
+
+This patch redirect output of post install script to a log file when
+distro feature "debug-tweak" enabled.
+
+[Yocto 3223]
+
+Signed-off-by: Kang Kai <kai.kang@windriver.com>
+
+--- dpkg-1.16.9/src/script.c.orig 2013-02-19 16:05:33.154474040 +0800
++++ dpkg-1.16.9/src/script.c 2013-02-19 16:11:20.438486290 +0800
+@@ -30,6 +30,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <fcntl.h>
+
+ #include <dpkg/i18n.h>
+ #include <dpkg/dpkg.h>
+@@ -193,8 +166,17 @@ vmaintainer_script_installed(struct pkgi
+ }
+ ohshite(_("unable to stat %s `%.250s'"), buf, scriptpath);
+ }
++
++ int fd = open(LOGFILE, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
++ if (strcmp(desc, "post-installation") == 0 && fd != -1) {
++ dup2(fd, STDERR_FILENO);
++ dup2(fd, STDOUT_FILENO);
++ }
+ do_script(pkg, &pkg->installed, &cmd, &stab, 0);
+
++ if (fd)
++ close(fd);
++
+ command_destroy(&cmd);
+
+ return 1;
@@ -6,9 +6,13 @@ SRC_URI += "file://noman.patch \
file://check_version.patch \
file://preinst.patch \
file://fix-timestamps.patch \
- file://remove-tar-no-timestamp.patch"
+ file://remove-tar-no-timestamp.patch \
+ ${@base_contains('DISTRO_FEATURES', 'debug-tweak', 'file://redirect-output.patch', '', d)}"
+
+POSTLOG ?= "/var/log/postinstall.log"
+CFLAGS_append += "${@base_contains('DISTRO_FEATURES', 'debug-tweak', ' -DLOGFILE=\'\"${POSTLOG}\"\'', '', d)}"
SRC_URI[md5sum] = "4df9319b2d17e19cdb6fe94dacee44da"
SRC_URI[sha256sum] = "73cd7fba4e54acddd645346b4bc517030b9c35938e82215d3eeb8b4e7af26b7a"
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
When distro feature "debug-tweak" enabled, redirect output of postinstall script to log file /var/log/postinstall.log which can be configured. [Yocto 3223] Signed-off-by: Kang Kai <kai.kang@windriver.com> --- .../dpkg/dpkg/redirect-output.patch | 37 ++++++++++++++++++++ meta/recipes-devtools/dpkg/dpkg_1.16.9.bb | 8 +++- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-devtools/dpkg/dpkg/redirect-output.patch