I have made the following changes intended for :
  CE:MW:Shared / dsme

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/6778

Thank You,
plundstr

[This message was auto-generated]

---

Request # 6778:

Messages from BOSS:
     WARNING check_yaml_matches_spec (dsme) failed: Spec file changed by 
specify:
+ Name:       dsme
- Name:       dsme
+ if [ "$1" -eq 0 ]; then
+ systemctl stop %{name}.service
+ fi


State: review at 2012-09-25T10:53:31 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:plundstr:branches:CE:MW:Shared / dsme -> CE:MW:Shared / dsme
  
changes files:
--------------
--- dsme.changes
+++ dsme.changes
@@ -0,0 +1,4 @@
+* Tue Sep 25 2012 Pekka Lundstrom <[email protected]> - 0.62.1.1
+- Added patch 0010-Fix-system-call-paths.patch
+- Fixes JB#2582: dsme can't reboot nor shutdown the device
+  

new:
----
  0010-Fix-system-call-paths.patch

spec files:
-----------
--- dsme.spec
+++ dsme.spec
@@ -1,6 +1,6 @@
 # 
 # Do NOT Edit the Auto-generated Part!
-# Generated by: spectacle version 0.23
+# Generated by: spectacle version 0.24
 # 
 # >> macros
 # << macros
@@ -27,6 +27,7 @@
 Patch6:     0007-Fix-compilation-of-tests.patch
 Patch7:     0008-HACK-disable-credential-check-for-clients.patch
 Patch8:     0009-NEMO_334-Make-device-poweroff.patch
+Patch9:     0010-Fix-system-call-paths.patch
 Requires:   systemd
 Requires(preun): systemd
 Requires(post): systemd
@@ -67,6 +68,8 @@
 %patch7 -p1
 # 0009-NEMO_334-Make-device-poweroff.patch
 %patch8 -p1
+# 0010-Fix-system-call-paths.patch
+%patch9 -p1
 # >> setup
 # << setup
 
@@ -89,6 +92,7 @@
 
 # >> build post
 # << build post
+
 %install
 rm -rf %{buildroot}
 # >> install pre
@@ -133,5 +137,3 @@
 /lib/systemd/system/multi-user.target.wants/%{name}.service
 # >> files
 # << files
-
-

other changes:
--------------

++++++ 0010-Fix-system-call-paths.patch (new)
--- 0010-Fix-system-call-paths.patch
+++ 0010-Fix-system-call-paths.patch
@@ -0,0 +1,88 @@
+From f82f6e79f13dace8c577a02164bfabfc52988f50 Mon Sep 17 00:00:00 2001
+From: Pekka Lundstrom <[email protected]>
+Date: Tue, 25 Sep 2012 11:58:31 +0300
+Subject: [PATCH] Fixed system calls to look both /sbin and /usr/sbin
+
+Signed-off-by: Pekka Lundstrom <[email protected]>
+---
+ modules/runlevel.c |   43 ++++++++++++++++++++++++++++++-------------
+ 1 file changed, 30 insertions(+), 13 deletions(-)
+
+diff --git a/modules/runlevel.c b/modules/runlevel.c
+index 8b22558..46b0cf6 100644
+--- a/modules/runlevel.c
++++ b/modules/runlevel.c
+@@ -52,8 +52,14 @@ static bool change_runlevel(dsme_runlevel_t runlevel)
+ {
+   char command[32];
+ 
+-  snprintf(command, sizeof(command), "telinit %i", runlevel);
+-  dsme_log(LOG_NOTICE, "Issuing telinit %i", runlevel);
++  if (access("/sbin/telinit", X_OK) == 0) {
++      snprintf(command, sizeof(command), "/sbin/telinit %i", runlevel);
++  } else if (access("/usr/sbin/telinit", X_OK) == 0) {
++      snprintf(command, sizeof(command), "/usr/sbin/telinit %i", runlevel);
++  } else {
++      return false;
++  }
++  dsme_log(LOG_NOTICE, "Issuing %s", command);
+ 
+   if (system(command) != 0) {
+       dsme_log(LOG_CRIT, "failed to change runlevel, trying again in 2s");
+@@ -87,8 +93,9 @@ static void shutdown(dsme_runlevel_t runlevel)
+                                                 "Malf");
+ 
+   /* If runlevel change fails, handle the shutdown/reboot by DSME */
+-  if (access("/sbin/telinit", X_OK) != 0 || !change_runlevel(runlevel))
++  if (!change_runlevel(runlevel))
+   {
++      char command[32];
+       dsme_log(LOG_CRIT, "Doing forced shutdown/reboot");
+       sync();
+ 
+@@ -97,22 +104,32 @@ static void shutdown(dsme_runlevel_t runlevel)
+       if (runlevel == DSME_RUNLEVEL_SHUTDOWN ||
+           runlevel == DSME_RUNLEVEL_MALF)
+       {
+-          dsme_log(LOG_CRIT, "Issuing poweroff");
+-          if (system("/sbin/poweroff") != 0) {
+-              dsme_log(LOG_ERR, "/sbin/poweroff failed, trying again in 3s");
++          if (access("/sbin/poweroff", X_OK) == 0) {
++              snprintf(command, sizeof(command), "/sbin/poweroff");
++          } else {
++              snprintf(command, sizeof(command), "/usr/sbin/poweroff");
++          }
++          dsme_log(LOG_CRIT, "Issuing %s", command);
++          if (system(command) != 0) {
++          dsme_log(LOG_ERR, "%s failed, trying again in 3s", command);
+               sleep(3);
+-              if (system("/sbin/poweroff") != 0) {
+-                  dsme_log(LOG_ERR, "/sbin/poweroff failed again");
++              if (system(command) != 0) {
++              dsme_log(LOG_ERR, "%s failed again", command);
+                   goto fail_and_exit;
+               }
+           }
+       } else {
+-          dsme_log(LOG_CRIT, "Issuing reboot");
+-          if (system("/sbin/reboot") != 0) {
+-              dsme_log(LOG_ERR, "/sbin/reboot failed, trying again in 3s");
++          if (access("/sbin/reboot", X_OK) == 0) {
++              snprintf(command, sizeof(command), "/sbin/reboot");
++          } else {
++              snprintf(command, sizeof(command), "/usr/sbin/reboot");
++          }
++          dsme_log(LOG_CRIT, "Issuing %s", command);
++          if (system(command) != 0) {
++          dsme_log(LOG_ERR, "%s failed, trying again in 3s", command);
+               sleep(3);
+-              if (system("/sbin/reboot") != 0) {
+-                  dsme_log(LOG_ERR, "/sbin/reboot failed again");
++              if (system(command) != 0) {
++              dsme_log(LOG_ERR, "%s failed again", command);
+                   goto fail_and_exit;
+               }
+           }
+-- 
+1.7.9.5
+

++++++ dsme.yaml
--- dsme.yaml
+++ dsme.yaml
@@ -32,6 +32,7 @@
     - 0007-Fix-compilation-of-tests.patch
     - 0008-HACK-disable-credential-check-for-clients.patch
     - 0009-NEMO_334-Make-device-poweroff.patch
+    - 0010-Fix-system-call-paths.patch
 
 PkgConfigBR:
     - glib-2.0



Reply via email to