V2: Redirect output of postinstall scripts
cover V2: Redirect output of postinstall scripts
When image feature "debug-tweaks" enabled, redirect output of postinstall scripts to a log file when image first boot.
[YOCTO #3223]
The following changes since commit 2cc4fe4a0874c42421b1bf3fa100160a9e60a9da:
upstream_tracking.inc: Coonectivity and multimedia packages updates (2013-02-25 05:58:20 -0800)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib kangkai/debug-tweaks
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/debug-tweaks
Kang Kai (5):
opkg: save output of postinst scripts when image first boot
rootfs_deb: remove run-postinsts from ROOTFS_PKGMANAGE
dpkg: save output of postinstall scripts when image firstboot
rootfs_rpm: move run-postinsts scripts to rpm recipe
rpm: save output of postinstall scripts when image first boot
meta/classes/rootfs_deb.bbclass | 2 +- meta/classes/rootfs_rpm.bbclass | 23 ----------------------- meta/recipes-devtools/dpkg/dpkg.inc | 8 +++++--- meta/recipes-devtools/opkg/opkg.inc | 5 ++++- meta/recipes-devtools/rpm/rpm_5.4.9.bb | 27 +++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 28 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/5 opkg: save output of postinst scripts when image first boot
When image feature "debug-tweaks" enabled, save output of postinstall scripts to log file /var/log/postinstall.log when image first boot. And the log file can be configured.
It also needs image feature "package-management" enabled. If not, package run-postinsts will be installed and then all packages will be configured by it. Command 'opkg configure' outputs nothing.
[YOCTO #3223]
--- meta/recipes-devtools/opkg/opkg.inc | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
meta/recipes-devtools/opkg/opkg.inc +4 -1
@@ -57,13 +57,16 @@ do_install_append_class-native() { fi } +POSTLOG ?= "/var/log/postinstall.log" +REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}" + pkg_postinst_${PN} () { #!/bin/sh if [ "x$D" != "x" ]; then install -d $D${sysconfdir}/rcS.d # this happens at S98 where our good 'ole packages script used to run echo "#!/bin/sh -opkg-cl configure +opkg-cl configure ${REDIRECT_CMD} rm -f /${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts " > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
Signature · 1 line
1.7.5.4
PATCH 2/5 rootfs_deb: remove run-postinsts from ROOTFS_PKGMANAGE
In reply to Kang KaiRemove package run-postinsts from ROOTFS_PKGMANAGE. run-postinsts has already added in ROOTFS_PKGMANAGE_BOOTSTRAP and then added to rootfs conditionally by checking image feature "package-management".
--- meta/classes/rootfs_deb.bbclass | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/rootfs_deb.bbclass +1 -1
@@ -2,7 +2,7 @@ # Copyright 2006-2007 Openedhand Ltd. # -ROOTFS_PKGMANAGE = "run-postinsts dpkg apt" +ROOTFS_PKGMANAGE = "dpkg apt" ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts" do_rootfs[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot"
Signature · 1 line
1.7.5.4
PATCH 3/5 dpkg: save output of postinstall scripts when image firstboot
In reply to Kang KaiWhen image feature "debug-tweaks" enabled, save output of postinstall scripts to log file /var/log/postinstall.log when image first boot. And the log file can be configured.
It also needs image feature "package-management" enabled. If not, package run-postinsts will be installed and then all packages will be configured by it. Command 'dpkg --configure' outputs nothing.
[YOCTO #3223]
--- meta/recipes-devtools/dpkg/dpkg.inc | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
meta/recipes-devtools/dpkg/dpkg.inc +5 -3
@@ -2,7 +2,7 @@ DESCRIPTION = "Package maintenance system for Debian." LICENSE = "GPLv2.0+" SECTION = "base" -INC_PR = "r18" +INC_PR = "r19" SRC_URI = "${DEBIAN_MIRROR}/main/d/dpkg/dpkg_${PV}.tar.xz \ file://ignore_extra_fields.patch"
@@ -35,13 +35,15 @@ do_configure () { autotools_do_configure } +POSTLOG ?= "/var/log/postinstall.log" +REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}" DPKG_INIT_POSITION ?= "98" do_install_prepend () { install -d ${D}/${sysconfdir}/rcS.d # this happens at S98 where our good 'ole packages script used to run - printf "#!/bin/sh -dpkg --configure -a + echo "#!/bin/sh +dpkg --configure -a ${REDIRECT_CMD} rm -f ${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts " > ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts chmod 0755 ${D}/${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
Signature · 1 line
1.7.5.4
PATCH 4/5 rootfs_rpm: move run-postinsts scripts to rpm recipe
In reply to Kang KaiMove run-postinsts scripts from rootfs_rpm.bbclass to rpm recipe. That is the same way for dpkg and opkg to deal the post install scripts.
--- meta/classes/rootfs_rpm.bbclass | 23 ----------------------- meta/recipes-devtools/rpm/rpm_5.4.9.bb | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-)
meta/classes/rootfs_rpm.bbclass +0 -23
@@ -29,11 +29,6 @@ do_rootfs[vardepsexclude] += "BUILDNAME" RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; " RPM_POSTPROCESS_COMMANDS = "rpm_setup_smart_target_config; " -# -# Allow distributions to alter when [postponed] package install scripts are run -# -POSTINSTALL_INITPOSITION ?= "98" - rpmlibdir = "/var/lib/rpm" opkglibdir = "${localstatedir}/lib/opkg"
@@ -114,24 +109,6 @@ fakeroot rootfs_rpm_do_rootfs () { fi done - install -d ${IMAGE_ROOTFS}/${sysconfdir}/rcS.d - # Stop $i getting expanded below... - i=\$i - cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << EOF -#!/bin/sh -for i in \`ls /etc/rpm-postinsts/\`; do - i=/etc/rpm-postinsts/$i - echo "Running postinst $i..." - if [ -f $i ] && $i; then - rm $i - else - echo "ERROR: postinst $i failed." - fi -done -rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts -EOF - chmod 0755 ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts - install -d ${IMAGE_ROOTFS}/${sysconfdir} echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
meta/recipes-devtools/rpm/rpm_5.4.9.bb +23 -0
@@ -369,6 +369,11 @@ do_configure() { oe_runconf } +# +# Allow distributions to alter when [postponed] package install scripts are run +# +POSTINSTALL_INITPOSITION ?= "98" + do_install_append() { sed -i -e 's,%__check_files,#%%__check_files,' ${D}/${libdir}/rpm/macros sed -i -e 's,%__scriptlet_requires,#%%__scriptlet_requires,' ${D}/${libdir}/rpm/macros
@@ -445,6 +450,24 @@ do_install_append() { rm -rf ${D}/var/lib/wdj ${D}/var/cache/wdj rm -f ${D}/${libdir}/rpm/bin/api-sanity-checker.pl + + install -d ${D}/${sysconfdir}/rcS.d + # Stop $i getting expanded below... + i=\$i + cat > ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << EOF +#!/bin/sh +for i in \`ls /etc/rpm-postinsts/\`; do + i=/etc/rpm-postinsts/$i + echo "Running postinst $i..." + if [ -f $i ] && $i; then + rm $i + else + echo "ERROR: postinst $i failed." + fi +done +rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts +EOF + chmod 0755 ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts } do_install_append_class-native() {
Signature · 1 line
1.7.5.4
PATCH 5/5 rpm: save output of postinstall scripts when image first boot
In reply to Kang KaiWhen image feature "debug-tweaks" is enabled, save output of post install script to log file which can be configured when image first boot.
[YOCTO #3223]
--- meta/recipes-devtools/rpm/rpm_5.4.9.bb | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
meta/recipes-devtools/rpm/rpm_5.4.9.bb +5 -1
@@ -223,6 +223,7 @@ FILES_${PN} = "${bindir}/rpm \ ${libdir}/rpm/bin/wget \ /var/lib/rpm \ /var/cache/rpm \ + ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts \ " FILES_${PN}-dbg += "${libdir}/rpm/.debug \
@@ -374,6 +375,9 @@ do_configure() { # POSTINSTALL_INITPOSITION ?= "98" +POSTLOG ?= "/var/log/postinstall.log" +REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}" + do_install_append() { sed -i -e 's,%__check_files,#%%__check_files,' ${D}/${libdir}/rpm/macros sed -i -e 's,%__scriptlet_requires,#%%__scriptlet_requires,' ${D}/${libdir}/rpm/macros
@@ -459,7 +463,7 @@ do_install_append() { for i in \`ls /etc/rpm-postinsts/\`; do i=/etc/rpm-postinsts/$i echo "Running postinst $i..." - if [ -f $i ] && $i; then + if [ -f $i ] && $i ${REDIRECT_CMD}; then rm $i else echo "ERROR: postinst $i failed."
Signature · 1 line
1.7.5.4
Re: [PATCH 5/5] rpm: save output of postinstall scripts when image first boot
Quoted 16 lines · Kang Kai
When image feature "debug-tweaks" is enabled, save output of post install script to log file which can be configured when image first boot.
[YOCTO #3223]
Signed-off-by Kang Kai<[email protected]>--- meta/recipes-devtools/rpm/rpm_5.4.9.bb | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)meta/recipes-devtools/rpm/rpm_5.4.9.bb +0
-0
meta/recipes-devtools/rpm/rpm_5.4.9.bb FILES_${PN} = "${bindir}/rpm \ · line 226
Quoted 4 lines
meta/recipes-devtools/rpm/rpm_5.4.9.bb +1
-0@@ -223,6 +223,7 @@ FILES_${PN} = "${bindir}/rpm \ ${libdir}/rpm/bin/wget \ /var/lib/rpm \ /var/cache/rpm \ + ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts \
Previous(4/5) patch has been merged to master but this one not, the bitbake complains:
WARNING: QA Issue: rpm: Files/directories were installed but not shipped /etc/etc/rcS.d/etc/rcS.d/S98run-postinsts
This line should be split to the previous(4/5) patch. When this patch merged, the warning will disappear.
Sorry for this trouble,
Kai
Quoted 22 lines
meta/recipes-devtools/rpm/rpm_5.4.9.bb +4
-1" FILES_${PN}-dbg += "${libdir}/rpm/.debug \@@ -374,6 +375,9 @@ do_configure() { # POSTINSTALL_INITPOSITION ?= "98" +POSTLOG ?= "/var/log/postinstall.log" +REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}" + do_install_append() { sed -i -e 's,%__check_files,#%%__check_files,' ${D}/${libdir}/rpm/macros sed -i -e 's,%__scriptlet_requires,#%%__scriptlet_requires,' ${D}/${libdir}/rpm/macros@@ -459,7 +463,7 @@ do_install_append() { for i in \`ls /etc/rpm-postinsts/\`; do i=/etc/rpm-postinsts/$i echo "Running postinst $i..." - if [ -f $i ]&& $i; then + if [ -f $i ]&& $i ${REDIRECT_CMD}; then rm $i else echo "ERROR: postinst $i failed."