scripts: init: Check if nbd-client is existed or not 71/317671/1
authorJaehoon Chung <jh80.chung@samsung.com>
Fri, 13 Sep 2024 03:36:23 +0000 (12:36 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 13 Sep 2024 03:41:30 +0000 (12:41 +0900)
Check if executable nbd-client file is existed or not.
It will be preventing the wrong behavior.

Change-Id: I6709222ba05f3aa8e97f1d7589cd6bfc9546b570
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
scripts/init.sh

index 567fe9f94c50938000e1a00b6e6e709e10016567..68f564f45ddf0ce460b93235bf49fb3fc9b2ded7 100755 (executable)
@@ -62,6 +62,10 @@ function check_network()
 
 function setup_nbd()
 {
+    if [ ! -e /usr/sbin/nbd-client ]; then
+           return
+    fi
+
     local NBDROOT=$([[ $(</proc/cmdline) =~ nbdroot=([^ ]*) ]]; echo ${BASH_REMATCH[1]})
     if [ "x$NBDROOT" = "x" ]; then
         return