output_path = File.join(generated_dir, File.basename(template_file, '.in'))
output_mode = (File.stat(template_file).mode & 0100) ? 0755 : 0644
File.open(output_path, "w", output_mode) do |output|
- # Set the mode again after opening, to thwart any prevailing umask:
- output.chmod output_mode
File.open(template_file) do |input|
input.each_line do |line|
end
end
end
-
-# Copy the ssh public key file to base/generated (if a path is given)
-generated_dir = File.join('base/generated')
-Dir.mkdir(generated_dir) unless Dir.exists? generated_dir
-if (!config['PUBLIC_KEY_PATH'].nil? and
- File.readable? config['PUBLIC_KEY_PATH'])
- FileUtils.cp(config['PUBLIC_KEY_PATH'],
- File.join(generated_dir, 'id_rsa.pub'))
-end