[v2] update-rc.d.bbclass: Fix host/target test in postinst

Submitted by Jacob Kroon on Oct. 27, 2013, 9:20 a.m. | Patch ID: 60529


Message ID 1382865629-29145-1-git-send-email-jacob.kroon@gmail.com
State Accepted
Commit 7e23557835f756b22b95fa7a1926b5d1d21872c3
Headers show

Commit Message

Jacob Kroon Oct. 27, 2013, 9:20 a.m.
When running the postinst script I get a shell warning:

sh: argument expected

and the service is never stopped. This patch fixes the warning
message and stops the service.

Patch v2: Hans Beckérus pointed out that the patch is not correct.
          This version uses the syntax proposed by Hans. I've tested
          that the postinst script works correctly when run on the target,
          both when the init script exists and when it doesn't exist.

Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
 meta/classes/update-rc.d.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index e14659d..9437e9c 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -16,7 +16,7 @@  updatercd_postinst() {
 # test if there is a previous init script there, ie, we are updating the package
 # if so, we stop the service and remove it before we install from the new package
 if type update-rc.d >/dev/null 2>/dev/null; then
-	if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
+	if [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
 	if [ -n "$D" ]; then