Skip to contentSkip to conversation

initscripts: add newline to network stop message

PATCH New Vivien Didelot 2 participants 2 messages Aug 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 initscripts: add newline to network stop message

The output of "/etc/init.d/S40network stop" was lacking a newline due to the usage of printf. Fix it by echoing the status.

v1 -> v2: echo OK/FAIL instead of s/printf/echo/.

---
 package/initscripts/init.d/S40network | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/initscripts/init.d/S40network +4 -2
index 7b11d8b..642c501 100755
@@ -8,12 +8,14 @@ mkdir -p /run/network
 
 case "$1" in
   start)
- 	echo "Starting network..."
+	printf "Starting network: "
 	/sbin/ifup -a
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
 	;;
   stop)
-	printf "Stopping network..."
+	printf "Stopping network: "
 	/sbin/ifdown -a
+	[ $? = 0 ] && echo "OK" || echo "FAIL"
 	;;
   restart|reload)
 	"$0" stop
Signature · 1 line
2.9.2
#1 lore raw

PATCH v2 1/1 initscripts: add newline to network stop message

Hello,

Quoted 2 lines · Vivien Didelot

The output of "/etc/init.d/S40network stop" was lacking a newline due to the usage of printf. Fix it by echoing the status.

The commit title was not really correct anymore, since you're not only changing the stop message, but also the start message.

Quoted 2 lines

v1 -> v2: echo OK/FAIL instead of s/printf/echo/.

The change log does not go inside the commit log, but rather...

Quoted 3 lines

---

... here.

I fixed these issues and applied your patch. It's worth mentioning however that, unrelated to your patch, I get an error message when starting and stopping. I'm booting an ARM system under Qemu, with the root filesystem mounted over NFS (so eth0 is already configured by the kernel, but my /etc/network/interfaces only contains a description for the lo interface). Here is what I have:

Starting network: ip: RTNETLINK answers: File exists FAIL

Welcome to Buildroot
buildroot login: root

# ifconfig 
eth0      Link encap:Ethernet  HWaddr 52:54:00:12:34:56  
          inet addr:172.20.0.2  Bcast:172.20.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1110 errors:0 dropped:0 overruns:0 frame:0
          TX packets:575 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1198556 (1.1 MiB)  TX bytes:89410 (87.3 KiB)
          Interrupt:31 

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

# cat /etc/network/interfaces 
# interface file auto-generated by buildroot

auto lo
iface lo inet loopback
# /etc/init.d/S40network stop
Stopping network: ifdown: interface lo not configured OK
#
#
# /etc/init.d/S40network start
Starting network: ip: RTNETLINK answers: File exists FAIL

Best regards

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com