-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoinstall.rb
More file actions
executable file
·54 lines (46 loc) · 983 Bytes
/
autoinstall.rb
File metadata and controls
executable file
·54 lines (46 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env ruby
$LOAD_PATH << ENV['AUTO_INSTALLER_HOME']
require 'package'
require 'rubygems'
require 'aquarium'
require 'fileutils'
require 'logging'
require 'options'
include FileUtils
include Logging
Logging.logger.level = Logger::DEBUG
Dir.glob("#{ENV['AUTO_INSTALLER_HOME']}/downloads/*").each do |p|
rm_rf p
end
Dir.glob("#{ENV['AUTO_INSTALLER_HOME']}/packages/*").each do |p|
if p =~ /[.]rb$/
debug "loading #{p}"
eval("require '#{p}'")
end
end
require 'hooks'
ProgramOptions::handle_options(ARGV)
def stringify(args)
args.map {|a| "\"#{a}\""}
end
command = ARGV[0]
target = ARGV.last
arguments = stringify(ARGV[1..ARGV.length-2]).join(',')
begin
text = nil
if arguments.length > 0
text = """
p = Packages.#{command}(:#{target}, #{arguments})
"""
else
text = """
p = Packages.#{command}(:#{target})
"""
end
puts "text = #{text}"
result = eval text
puts result unless result.nil?
rescue Exception => e
error e
exit 1
end