-
-
Save madAndroid/6068920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sf-bootstrap b/sf-bootstrap | |
index f39cb77..b9e0343 100755 | |
--- a/sf-bootstrap | |
+++ b/sf-bootstrap | |
@@ -452,10 +452,14 @@ class BootstrapBase | |
def add_automation_to_path | |
log_info( "Writing default path to /etc/environment" ) | |
- File.open( '/etc/environment', 'a' ) { |f| | |
- f.puts "# Written by sf-bootstrap" | |
- f.puts "PATH=/opt/automation/usr/bin:/usr/local/bin:/bin:/usr/bin" | |
- } | |
+ env_contents = [] | |
+ File.open( '/etc/environment', 'r').each_line { |line| env_contents.push line } | |
+ if ! env_contents.include? /sf-bootstrap/ | |
+ File.open( '/etc/environment', 'a' ) { |f| | |
+ f.puts "# Written by sf-bootstrap" | |
+ f.puts "PATH=/opt/automation/usr/bin:/usr/local/bin:/bin:/usr/bin" | |
+ } | |
+ end | |
log_info( "Writing conditional path appender to /etc/profiles.d/sf_automation.sh" ) | |
File.open( '/etc/profile.d/sf_automation.sh', 'w' ) { |f| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment