Skip to content

Instantly share code, notes, and snippets.

@mccun934
Last active August 29, 2015 13:56
Show Gist options
  • Save mccun934/8868364 to your computer and use it in GitHub Desktop.
Save mccun934/8868364 to your computer and use it in GitHub Desktop.
diff --git a/Rakefile b/Rakefile
index 468b249..4070a9f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -33,7 +33,6 @@ end
file "#{BUILDDIR}/foreman-installer" => 'bin/foreman-installer' do |t|
cp t.prerequisites[0], t.name
- sh 'sed -i "s#\(.*CONFIG_FILE\).*#\1 = \"%s\"#" %s' % ["#{SYSCONFDIR}/foreman/foreman-installer.yaml", t.name]
end
file "#{BUILDDIR}/options.asciidoc" do |t|
diff --git a/bin/foreman-installer b/bin/foreman-installer
index 6ba8c93..b5e6770 100755
--- a/bin/foreman-installer
+++ b/bin/foreman-installer
@@ -4,8 +4,13 @@ require 'highline/import'
require 'yaml'
require 'kafo'
-# where to find answer file
-CONFIG_FILE = "config/foreman-installer.yaml"
+config_filename = File.basename($0) + ".yaml"
+
+if File.exist?('config/' + config_filename)
+ CONFIG_FILE = 'config/' + config_filename
+else
+ CONFIG_FILE = '/etc/foreman/' + config_filename
+end
# helpers
def module_enabled?(name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment