forked from BrandonArp/Chimera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
override_package.rb
executable file
·57 lines (42 loc) · 1.04 KB
/
override_package.rb
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
55
#!/usr/bin/env ruby
$: << File.dirname( __FILE__)
require 'optparse'
require 'lib/aptutils'
require 'lib/deploy'
require 'pp'
opts = OptionParser.new
args = {}
opts.on("-p", "--package p1,p2,p3", Array, "package to override") do |package|
args[:package] = package
end
opts.on("-e", "--environment ENV", "environment to override in") do |environment|
args[:environment] = environment
end
opts.on("-h", "--help", "show this help dialog") do
puts opts
exit 0
end
opts.parse!
error = false
if not args[:environment]
puts "missing required argument environment"
error = true
end
if not args[:package]
puts "missing required argument package"
error = true
end
if error
exit 1
end
args[:package].each do |package|
if not File.exist?(package)
puts "file does not exist: #{package}"
exit 1
end
info = get_deb_info(package)
puts "caching #{package}"
install_deb(package)
puts "building links for #{package}"
build_sym_links(get_package_name(info), get_package_version(info), "/chimera/env/#{args[:environment]}")
end