Browse Source

Update dependency checks

VirtualBox scripts rely on various utilities to function. To validate
the environment, virtualbox/prepare-environment.sh checks if all these
utilities are available to the shell. However, some of the checks
(namely xxd and ssh) were missing. This change should fix this by
aborting the prepare step in case if these utilities are not found.

Change-Id: Ic49c11054345964c9785e9c4c791ea33dba4791c
Partial-Bug: 1525967
Dmitry Bilunov 3 years ago
parent
commit
3d03ec3ee1
1 changed files with 13 additions and 3 deletions
  1. 13
    3
      actions/prepare-environment.sh

+ 13
- 3
actions/prepare-environment.sh View File

@@ -19,11 +19,11 @@
19 19
 # This script performs initial check and configuration of the host system. It:
20 20
 #   - verifies that all available command-line tools are present on the host system
21 21
 #
22
-# We are avoiding using 'which' because of http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script 
22
+# We are avoiding using 'which' because of http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
23 23
 #
24 24
 
25 25
 # Include the script with handy functions to operate VMs and VirtualBox networking
26
-source ./config.sh 
26
+source ./config.sh
27 27
 source ./functions/vm.sh
28 28
 source ./functions/network.sh
29 29
 source ./functions/shell.sh
@@ -50,6 +50,16 @@ else
50 50
   echo "OK"
51 51
 fi
52 52
 
53
+# Check for xxd
54
+echo -n "Checking for 'xxd'... "
55
+execute type xxd >/dev/null 2>&1
56
+if [ $? -eq 1 ]; then
57
+  echo "\"xxd\" is not available in the path, but it's required. Please install the \"xxd\" package. Aborting."
58
+  exit 1
59
+else
60
+  echo "OK"
61
+fi
62
+
53 63
 # Check for VirtualBox
54 64
 echo "If you run this script under Cygwin, you may have to add path to VirtualBox directory to your PATH. "
55 65
 echo "Usually it is enough to run \"export PATH=\$PATH:\"/cygdrive/c/Program Files/Oracle/VirtualBox\" "
@@ -108,7 +118,7 @@ echo -n "Checking if ipconfig or ifconfig installed... "
108 118
 case "$(execute uname)" in
109 119
   Linux | Darwin)
110 120
     if ! execute test -x /sbin/ifconfig ; then
111
-      echo "No ifconfig available at /sbin/ifconfig path! This path is hard-coded into VBoxNetAdpCtl utility." 
121
+      echo "No ifconfig available at /sbin/ifconfig path! This path is hard-coded into VBoxNetAdpCtl utility."
112 122
       echo "Please install ifconfig or create symlink to proper interface configuration utility. Aborting."
113 123
       exit 1
114 124
     fi

Loading…
Cancel
Save