Check failure of network configuration 04/200104/4 accepted/tizen/unified/20190307.231038 submit/tizen/20190222.054942 submit/tizen/20190306.092244 submit/tizen_5.0/20190306.065358
authorDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 19 Feb 2019 06:55:53 +0000 (15:55 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 20 Feb 2019 00:57:21 +0000 (00:57 +0000)
If network configuration is failed due to some reason, tfm cannot be
proceeded. In this case, reboot the system to retry  when network setup
fails.

Change-Id: Idb615fb455ea2af9226c5caf395e1a06bb94e954
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
scripts/flash-init.sh

index dd345d5..34ead7d 100755 (executable)
@@ -30,10 +30,16 @@ clear_bootmode() {
 print_ip() {
        IPADDR=`"$IP" -4 addr show $NETIF | "$GREP" -oP '(?<=inet\s)\d+(\.\d+){3}'`
        if [ "z$IPADDR" == "z" ]; then
-               echo "IP address is not set, using default (192.168.0.100)"
                IPADDR="192.168.0.100"
 
-               "$IFCONFIG" $NETIF $IPADDR up
+               RESULT=`"$IFCONFIG" $NETIF $IPADDR up`
+
+               if [ "z$RESULT" != "z" ]; then
+                       echo "Failed to set IP address, Reboot..."
+                       "$REBOOT"
+               fi
+
+               echo "IP address is not set, using default (192.168.0.100)"
        fi
        echo "IP address is set to ${IPADDR}"
 }
@@ -54,6 +60,6 @@ do_flash() {
 #------------------------------------------------
 #      Main Routine Start
 #------------------------------------------------
-clear_bootmode
 print_ip
+clear_bootmode
 do_flash