Browse code

Merge "Fix path setup in add_sudo_secure_path"

Jenkins authored on 2015/12/06 22:34:19
Showing 1 changed files
... ...
@@ -22,14 +22,14 @@ function add_sudo_secure_path {
22 22
     local line
23 23
 
24 24
     # This is pretty simplistic for now - assume only the first line is used
25
-    if [[ -r SUDO_SECURE_PATH_FILE ]]; then
25
+    if [[ -r $SUDO_SECURE_PATH_FILE ]]; then
26 26
         line=$(head -1 $SUDO_SECURE_PATH_FILE)
27 27
     else
28 28
         line="Defaults:$STACK_USER secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin"
29 29
     fi
30 30
 
31 31
     # Only add ``dir`` if it is not already present
32
-    if [[ $line =~ $dir ]]; then
32
+    if [[ ! $line =~ $dir ]]; then
33 33
         echo "${line}:$dir" | sudo tee $SUDO_SECURE_PATH_FILE
34 34
         sudo chmod 400 $SUDO_SECURE_PATH_FILE
35 35
         sudo chown root:root $SUDO_SECURE_PATH_FILE