More robust prerm and preinst scriptlets
cover More robust prerm and preinst scriptlets
These patches prevent package deinstallation and upgrade failures caused by init script error on opkg-based systems. The problem was that init script 'stop' will likely return '1' if the daemon is not running. This, in turn caused the scriptlet to error out preventing package (de-)installation.
Markus Lehtonen (2):
update-rc.d.bbclass: ignore init script return code sysklogd and busybox: ignore return code from init script stop
meta/classes/update-rc.d.bbclass | 4 ++-- meta/recipes-core/busybox/busybox.inc | 2 +- meta/recipes-extended/sysklogd/sysklogd.inc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.6.6
PATCH 1/2 update-rc.d.bbclass: ignore init script return code
We need to ignore the return code from the init script 'stop' command in the preinst and prerm scriptlets. Otherwise package upgrade or deinstallation (at least when opkg is used) is likely to fail if the daemon is not running. That is because an init script possibly returns '1' if you try to stop a service that is not running which, in turn, causes the scriptlet to fail which, in turn, causes the package (de-)installation to fail.
[YOCTO #10299]
--- meta/classes/update-rc.d.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/update-rc.d.bbclass +2 -2
@@ -37,7 +37,7 @@ INIT_D_DIR = "${sysconfdir}/init.d" updatercd_preinst() { if [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then - ${INIT_D_DIR}/${INITSCRIPT_NAME} stop + ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : fi if type update-rc.d >/dev/null 2>/dev/null; then if [ -n "$D" ]; then
@@ -62,7 +62,7 @@ fi updatercd_prerm() { if [ -z "$D" -a -x "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then - ${INIT_D_DIR}/${INITSCRIPT_NAME} stop + ${INIT_D_DIR}/${INITSCRIPT_NAME} stop || : fi }
Signature · 1 line
2.6.6
PATCH 2/2 sysklogd and busybox: ignore return code from init script stop
In reply to Markus LehtonenThe init script will return '1' if we try to stop the service and it is not currently running. The prerm scriptlet must not fail because of this because it will cause package deinstallation of upgrade fail if opkg package manager is used.
[YOCTO #10299]
--- meta/recipes-core/busybox/busybox.inc | 2 +- meta/recipes-extended/sysklogd/sysklogd.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/busybox/busybox.inc +1 -1
@@ -423,7 +423,7 @@ pkg_prerm_${PN}-syslog () { # remove syslog if test "x$D" = "x"; then if test "$1" = "upgrade" -o "$1" = "remove"; then - ${sysconfdir}/init.d/syslog stop + ${sysconfdir}/init.d/syslog stop || : fi fi }
meta/recipes-extended/sysklogd/sysklogd.inc +1 -1
@@ -55,7 +55,7 @@ ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf" pkg_prerm_${PN} () { if test "x$D" = "x"; then if test "$1" = "upgrade" -o "$1" = "remove"; then - /etc/init.d/syslog stop + /etc/init.d/syslog stop || : fi fi }
Signature · 1 line
2.6.6
Quoted 7 lines · Markus Lehtonen
These patches prevent package deinstallation and upgrade failures caused by init script error on opkg-based systems. The problem was that init script 'stop' will likely return '1' if the daemon is not running. This, in turn caused the scriptlet to error out preventing package (de-)installation.
perhaps checking if its running before trying to stop it might be another option
Quoted 18 lines
Markus Lehtonen (2):
update-rc.d.bbclass: ignore init script return code sysklogd and busybox: ignore return code from init script stopmeta/classes/update-rc.d.bbclass | 4 ++-- meta/recipes-core/busybox/busybox.inc | 2 +- meta/recipes-extended/sysklogd/sysklogd.inc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)--
2.6.6--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core