Browse code

Ensure /sbin and /usr/sbin is on the PATH to run sudo commands

Test the user env variable PATH to check those directories are listed.
If not, add them to PATH

Bug 1160870

Change-Id: I426f3e224a44d1d37e508fb3e17dd19c5e72dd5d

Adalberto Medeiros authored on 2013/03/28 03:36:53
Showing 1 changed files
... ...
@@ -227,6 +227,13 @@ else
227 227
     sudo rm -f /etc/sudoers.d/stack_sh_nova
228 228
 fi
229 229
 
230
+# Ensure /usr/sbin and /sbin are available on PATH
231
+S_PATH="/sbin /usr/sbin"
232
+for i in $S_PATH
233
+do
234
+    echo ":$PATH:" | egrep ":$i:" > /dev/null || (PATH=$PATH:$i; echo $PATH)
235
+done
236
+
230 237
 # Create the destination directory and ensure it is writable by the user
231 238
 sudo mkdir -p $DEST
232 239
 if [ ! -w $DEST ]; then