Skip to contentSkip to conversation

Bugfix: modify the command to start the service of sysvinit.

PATCH In review Wang Mingyu 2 participants 4 messages Dec 21, 2018 – Jan 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bugfix: modify the command to start the service of sysvinit.

---
 engine/scripts/fuego_board_function_lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
engine/scripts/fuego_board_function_lib.sh +1 -1
index 69ece97..4c29bf3 100644
@@ -45,6 +45,6 @@ exec_service_on_target() {
     then
         systemctl $2 $1
     else
-        $1 $2
+        /etc/init.d/$1 $2
     fi
 }
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 Modify the function is_on_target to search commands that are not under the PATH.

---
 engine/scripts/functions.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
engine/scripts/functions.sh +4 -3
index e75760b..70578fe 100644
@@ -944,15 +944,16 @@ function is_on_target {
     # FIXTHIS: race condition
     tmpfile=$(mktemp /tmp/found_loc.XXXXXX)
     cmd "touch $tmpfile"
-    if [ -z "$3" ] ; then
-        safe_cmd "find / -name \"$1\" | head -n 1 >$tmpfile"
-    else
+    if [ ! -z "$3" ] ; then
         # split search path on colon
         for d in $(echo "$3" | tr ":" "\n") ; do
             # execute a command on the target to detect $d/$1
             cmd "if [ -z \"\$(cat $tmpfile)\" -a -e \"$d/$1\" ] ; then echo \"$d/$1\" >$tmpfile ; fi"
         done
     fi
+    if [ ! -s $tmpfile ] ; then
+        safe_cmd "find / -name \"$1\" | head -n 1 >$tmpfile"
+    fi
     get $tmpfile $tmpfile
     LOCATION=$(cat $tmpfile)
     export $2=$LOCATION
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Wang Mingyu

Comments below.

Quoted 22 lines

-----Original Message-----
From: Wang Mingyu

---
 engine/scripts/fuego_board_function_lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
engine/scripts/fuego_board_function_lib.sh +1 -2
index 69ece97..4c29bf3 100644
@@ -45,6 +45,6 @@ exec_service_on_target() {
     then
         systemctl $2 $1
     else
-        $1 $2
+        /etc/init.d/$1 $2
     fi
 }
--
Quoted 1 line

1.8.3.1

Looks good. Thanks.

It would be nice, IMHO, to check for the 'service' command, and use that if it is available. That command is designed specifically to abstract away the differences between raw sysV init scripts and upstart-based systems. I believe it's supported on Debian-based system and Fedora-based systems, but maybe not on low-end Yocto-Project-based systems (hence the need to check for it before using it.)

I'm applying this patch, as it's an improvement. But could you do some research and possibly add support for using the 'service' command to fuego_board_function_lib.sh?

Thanks,
-- Tim

#3 lore raw

Hi Tim

Quoted 2 lines

I'm applying this patch, as it's an improvement. But could you do some research and possibly add support for using the 'service' command to fuego_board_function_lib.sh?

About fuego_board_function_lib.sh, including is-active and sysvinit, I will fix it after considering these issues.

by wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, January 16, 2019 9:49 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] Bugfix: modify the command to start the service of sysvinit.

Comments below.

Quoted 22 lines

-----Original Message-----
From: Wang Mingyu

---
 engine/scripts/fuego_board_function_lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
engine/scripts/fuego_board_function_lib.sh +1 -2
index 69ece97..4c29bf3 100644
@@ -45,6 +45,6 @@ exec_service_on_target() {
     then
         systemctl $2 $1
     else
-        $1 $2
+        /etc/init.d/$1 $2
     fi
 }
--
Quoted 1 line

1.8.3.1

Looks good. Thanks.

It would be nice, IMHO, to check for the 'service' command, and use that if it is available. That command is designed specifically to abstract away the differences between raw sysV init scripts and upstart-based systems. I believe it's supported on Debian-based system and Fedora-based systems, but maybe not on low-end Yocto-Project-based systems (hence the need to check for it before using it.)

I'm applying this patch, as it's an improvement. But could you do some research and possibly add support for using the 'service' command to fuego_board_function_lib.sh?

Thanks,
-- Tim