natives 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +15 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +17 -0
  5. data/Gemfile.lock +137 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.rdoc +19 -0
  8. data/Rakefile +42 -0
  9. data/VERSION +1 -0
  10. data/bin/natives +7 -0
  11. data/chef-solo/.gitignore +17 -0
  12. data/chef-solo/.kitchen.yml +27 -0
  13. data/chef-solo/Berksfile +4 -0
  14. data/chef-solo/config.rb +17 -0
  15. data/chef-solo/vendored-cookbooks/apt/CHANGELOG.md +144 -0
  16. data/chef-solo/vendored-cookbooks/apt/README.md +247 -0
  17. data/chef-solo/vendored-cookbooks/apt/attributes/default.rb +27 -0
  18. data/chef-solo/vendored-cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  19. data/chef-solo/vendored-cookbooks/apt/libraries/helpers.rb +47 -0
  20. data/chef-solo/vendored-cookbooks/apt/libraries/network.rb +33 -0
  21. data/chef-solo/vendored-cookbooks/apt/metadata.json +54 -0
  22. data/chef-solo/vendored-cookbooks/apt/metadata.rb +34 -0
  23. data/chef-solo/vendored-cookbooks/apt/providers/preference.rb +61 -0
  24. data/chef-solo/vendored-cookbooks/apt/providers/repository.rb +141 -0
  25. data/chef-solo/vendored-cookbooks/apt/recipes/cacher-client.rb +81 -0
  26. data/chef-solo/vendored-cookbooks/apt/recipes/cacher-ng.rb +43 -0
  27. data/chef-solo/vendored-cookbooks/apt/recipes/default.rb +83 -0
  28. data/chef-solo/vendored-cookbooks/apt/resources/preference.rb +30 -0
  29. data/chef-solo/vendored-cookbooks/apt/resources/repository.rb +41 -0
  30. data/chef-solo/vendored-cookbooks/apt/templates/debian-6.0/acng.conf.erb +173 -0
  31. data/chef-solo/vendored-cookbooks/apt/templates/default/01proxy.erb +5 -0
  32. data/chef-solo/vendored-cookbooks/apt/templates/default/acng.conf.erb +275 -0
  33. data/chef-solo/vendored-cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +269 -0
  34. data/chef-solo/vendored-cookbooks/homebrew/CHANGELOG.md +36 -0
  35. data/chef-solo/vendored-cookbooks/homebrew/README.md +110 -0
  36. data/chef-solo/vendored-cookbooks/homebrew/attributes/default.rb +22 -0
  37. data/chef-solo/vendored-cookbooks/homebrew/libraries/homebrew_mixin.rb +53 -0
  38. data/chef-solo/vendored-cookbooks/homebrew/libraries/homebrew_package.rb +104 -0
  39. data/chef-solo/vendored-cookbooks/homebrew/metadata.json +32 -0
  40. data/chef-solo/vendored-cookbooks/homebrew/metadata.rb +10 -0
  41. data/chef-solo/vendored-cookbooks/homebrew/providers/tap.rb +48 -0
  42. data/chef-solo/vendored-cookbooks/homebrew/recipes/default.rb +46 -0
  43. data/chef-solo/vendored-cookbooks/homebrew/resources/tap.rb +35 -0
  44. data/lib/natives/app.rb +53 -0
  45. data/lib/natives/cli.rb +11 -0
  46. data/lib/natives.rb +0 -0
  47. data/natives.gemspec +113 -0
  48. data/spec/natives/app_spec.rb +68 -0
  49. data/spec/spec_helper.rb +12 -0
  50. metadata +224 -0
@@ -0,0 +1,141 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Provider:: repository
4
+ #
5
+ # Copyright 2010-2011, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ use_inline_resources if defined?(use_inline_resources)
21
+
22
+ def whyrun_supported?
23
+ true
24
+ end
25
+
26
+ # install apt key from keyserver
27
+ def install_key_from_keyserver(key, keyserver)
28
+ execute "install-key #{key}" do
29
+ if !node['apt']['key_proxy'].empty?
30
+ command "apt-key adv --keyserver-options http-proxy=#{node['apt']['key_proxy']} --keyserver hkp://#{keyserver}:80 --recv #{key}"
31
+ else
32
+ command "apt-key adv --keyserver #{keyserver} --recv #{key}"
33
+ end
34
+ action :run
35
+ not_if do
36
+ extract_fingerprints_from_cmd("apt-key finger").any? do |fingerprint|
37
+ fingerprint.end_with?(key.upcase)
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ # run command and extract gpg ids
44
+ def extract_fingerprints_from_cmd(cmd)
45
+ so = Mixlib::ShellOut.new(cmd)
46
+ so.run_command
47
+ so.stdout.split(/\n/).collect do |t|
48
+ if z = t.match(/^ +Key fingerprint = ([0-9A-F ]+)/)
49
+ z[1].split.join
50
+ end
51
+ end.compact
52
+ end
53
+
54
+ # install apt key from URI
55
+ def install_key_from_uri(uri)
56
+ key_name = uri.split(/\//).last
57
+ cached_keyfile = "#{Chef::Config[:file_cache_path]}/#{key_name}"
58
+ if new_resource.key =~ /http/
59
+ remote_file cached_keyfile do
60
+ source new_resource.key
61
+ mode 00644
62
+ action :create
63
+ end
64
+ else
65
+ cookbook_file cached_keyfile do
66
+ source new_resource.key
67
+ cookbook new_resource.cookbook
68
+ mode 00644
69
+ action :create
70
+ end
71
+ end
72
+
73
+ execute "install-key #{key_name}" do
74
+ command "apt-key add #{cached_keyfile}"
75
+ action :run
76
+ not_if do
77
+ installed_keys = extract_fingerprints_from_cmd("apt-key finger")
78
+ proposed_keys = extract_fingerprints_from_cmd("gpg --with-fingerprint #{cached_keyfile}")
79
+ (installed_keys & proposed_keys).sort == proposed_keys.sort
80
+ end
81
+ end
82
+ end
83
+
84
+ # build repo file contents
85
+ def build_repo(uri, distribution, components, trusted, arch, add_deb_src)
86
+ components = components.join(' ') if components.respond_to?(:join)
87
+ repo_options = []
88
+ repo_options << "arch=#{arch}" if arch
89
+ repo_options << "trusted=yes" if trusted
90
+ repo_options = "[" + repo_options.join(' ') + "]" unless repo_options.empty?
91
+ repo_info = "#{uri} #{distribution} #{components}\n"
92
+ repo_info = "#{repo_options} #{repo_info}" unless repo_options.empty?
93
+ repo = "deb #{repo_info}"
94
+ repo << "deb-src #{repo_info}" if add_deb_src
95
+ repo
96
+ end
97
+
98
+ action :add do
99
+ # add key
100
+ if new_resource.keyserver && new_resource.key
101
+ install_key_from_keyserver(new_resource.key, new_resource.keyserver)
102
+ elsif new_resource.key
103
+ install_key_from_uri(new_resource.key)
104
+ end
105
+
106
+ file "/var/lib/apt/periodic/update-success-stamp" do
107
+ action :nothing
108
+ end
109
+
110
+ execute "apt-get update" do
111
+ ignore_failure true
112
+ action :nothing
113
+ end
114
+
115
+ # build repo file
116
+ repository = build_repo(new_resource.uri,
117
+ new_resource.distribution,
118
+ new_resource.components,
119
+ new_resource.trusted,
120
+ new_resource.arch,
121
+ new_resource.deb_src)
122
+
123
+ file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
124
+ owner "root"
125
+ group "root"
126
+ mode 00644
127
+ content repository
128
+ action :create
129
+ notifies :delete, "file[/var/lib/apt/periodic/update-success-stamp]", :immediately
130
+ notifies :run, "execute[apt-get update]", :immediately if new_resource.cache_rebuild
131
+ end
132
+ end
133
+
134
+ action :remove do
135
+ if ::File.exists?("/etc/apt/sources.list.d/#{new_resource.name}.list")
136
+ Chef::Log.info "Removing #{new_resource.name} repository from /etc/apt/sources.list.d/"
137
+ file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
138
+ action :delete
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,81 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Recipe:: cacher-client
4
+ #
5
+ # Copyright 2011-2013 Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ class ::Chef::Recipe
21
+ include ::Apt
22
+ end
23
+
24
+ #remove Acquire::http::Proxy lines from /etc/apt/apt.conf since we use 01proxy
25
+ #these are leftover from preseed installs
26
+ execute 'Remove proxy from /etc/apt/apt.conf' do
27
+ command "sed --in-place '/^Acquire::http::Proxy/d' /etc/apt/apt.conf"
28
+ only_if "grep Acquire::http::Proxy /etc/apt/apt.conf"
29
+ end
30
+
31
+ servers = []
32
+ if node['apt']
33
+ if node['apt']['cacher_ipaddress']
34
+ cacher = Chef::Node.new
35
+ cacher.default.name = node['apt']['cacher_ipaddress']
36
+ cacher.default.ipaddress = node['apt']['cacher_ipaddress']
37
+ cacher.default.apt.cacher_port = node['apt']['cacher_port']
38
+ cacher.default.apt_cacher_interface = node['apt']['cacher_interface']
39
+ servers << cacher
40
+ elsif node['apt']['caching_server']
41
+ node.override['apt']['compiletime'] = false
42
+ servers << node
43
+ end
44
+ end
45
+
46
+ unless (Chef::Config[:solo] || servers.length > 0)
47
+ query = "apt_caching_server:true"
48
+ query += " AND chef_environment:#{node.chef_environment}" if node['apt']['cacher-client']['restrict_environment']
49
+ Chef::Log.debug("apt::cacher-client searching for '#{query}'")
50
+ servers += search(:node, query)
51
+ end
52
+
53
+ if servers.length > 0
54
+ Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
55
+ if servers[0]['apt']['cacher_interface']
56
+ cacher_ipaddress = interface_ipaddress(servers[0], servers[0]['apt']['cacher_interface'])
57
+ else
58
+ cacher_ipaddress = servers[0].ipaddress
59
+ end
60
+ t = template '/etc/apt/apt.conf.d/01proxy' do
61
+ source '01proxy.erb'
62
+ owner 'root'
63
+ group 'root'
64
+ mode 00644
65
+ variables(
66
+ :proxy => cacher_ipaddress,
67
+ :port => servers[0]['apt']['cacher_port'],
68
+ :bypass => node['apt']['cache_bypass']
69
+ )
70
+ action( node['apt']['compiletime'] ? :nothing : :create )
71
+ notifies :run, 'execute[apt-get update]', :immediately
72
+ end
73
+ t.run_action(:create) if node['apt']['compiletime']
74
+ else
75
+ Chef::Log.info('No apt-cacher-ng server found.')
76
+ file '/etc/apt/apt.conf.d/01proxy' do
77
+ action :delete
78
+ end
79
+ end
80
+
81
+ include_recipe 'apt::default'
@@ -0,0 +1,43 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Recipe:: cacher-ng
4
+ #
5
+ # Copyright 2008-2013, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ node.set['apt']['caching_server'] = true
21
+
22
+ package "apt-cacher-ng" do
23
+ action :install
24
+ end
25
+
26
+ directory node['apt']['cacher_dir'] do
27
+ owner "apt-cacher-ng"
28
+ group "apt-cacher-ng"
29
+ mode 0755
30
+ end
31
+
32
+ template "/etc/apt-cacher-ng/acng.conf" do
33
+ source "acng.conf.erb"
34
+ owner "root"
35
+ group "root"
36
+ mode 00644
37
+ notifies :restart, "service[apt-cacher-ng]", :immediately
38
+ end
39
+
40
+ service "apt-cacher-ng" do
41
+ supports :restart => true, :status => false
42
+ action [:enable, :start]
43
+ end
@@ -0,0 +1,83 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2008-2013, Opscode, Inc.
6
+ # Copyright 2009, Bryan McLellan <btm@loftninjas.org>
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ # On systems where apt is not installed, the resources in this recipe are not
22
+ # executed. However, they _must_ still be present in the resource collection
23
+ # or other cookbooks which notify these resources will fail on non-apt-enabled
24
+ # systems.
25
+ unless apt_installed?
26
+ Chef::Log.debug "apt is not installed. Apt-specific resources will not be executed."
27
+ end
28
+
29
+ # Run apt-get update to create the stamp file
30
+ execute "apt-get-update" do
31
+ command "apt-get update"
32
+ ignore_failure true
33
+ only_if { apt_installed? }
34
+ not_if do ::File.exists?('/var/lib/apt/periodic/update-success-stamp') end
35
+ end
36
+
37
+ # For other recipes to call to force an update
38
+ execute "apt-get update" do
39
+ command "apt-get update"
40
+ ignore_failure true
41
+ only_if { apt_installed? }
42
+ action :nothing
43
+ end
44
+
45
+ # Automatically remove packages that are no longer needed for dependencies
46
+ execute "apt-get autoremove" do
47
+ command "apt-get -y autoremove"
48
+ only_if { apt_installed? }
49
+ action :nothing
50
+ end
51
+
52
+ # Automatically remove .deb files for packages no longer on your system
53
+ execute "apt-get autoclean" do
54
+ command "apt-get -y autoclean"
55
+ only_if { apt_installed? }
56
+ action :nothing
57
+ end
58
+
59
+ # provides /var/lib/apt/periodic/update-success-stamp on apt-get update
60
+ package "update-notifier-common" do
61
+ notifies :run, 'execute[apt-get-update]', :immediately
62
+ only_if { apt_installed? }
63
+ end
64
+
65
+ execute "apt-get-update-periodic" do
66
+ command "apt-get update"
67
+ ignore_failure true
68
+ only_if do
69
+ apt_installed? &&
70
+ ::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
71
+ ::File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now - 86400
72
+ end
73
+ end
74
+
75
+ %w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
76
+ directory dirname do
77
+ owner "root"
78
+ group "root"
79
+ mode 00755
80
+ action :create
81
+ only_if { apt_installed? }
82
+ end
83
+ end
@@ -0,0 +1,30 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Resource:: preference
4
+ #
5
+ # Copyright 2010-2013, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ actions :add, :remove
21
+
22
+ def initialize(*args)
23
+ super
24
+ @action = :add
25
+ end
26
+
27
+ attribute :package_name, :kind_of => String, :name_attribute => true
28
+ attribute :glob, :kind_of => String
29
+ attribute :pin, :kind_of => String
30
+ attribute :pin_priority, :kind_of => String
@@ -0,0 +1,41 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Resource:: repository
4
+ #
5
+ # Copyright 2010-2013, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ actions :add, :remove
21
+
22
+ def initialize(*args)
23
+ super
24
+ @action = :add
25
+ end
26
+
27
+ #name of the repo, used for source.list filename
28
+ attribute :repo_name, :kind_of => String, :name_attribute => true
29
+ attribute :uri, :kind_of => String
30
+ attribute :distribution, :kind_of => String
31
+ attribute :components, :kind_of => Array, :default => []
32
+ attribute :arch, :kind_of => String, :default => nil
33
+ attribute :trusted, :kind_of => [ TrueClass, FalseClass ], :default => false
34
+ #whether or not to add the repository as a source repo as well
35
+ attribute :deb_src, :default => false
36
+ attribute :keyserver, :kind_of => String, :default => nil
37
+ attribute :key, :kind_of => String, :default => nil
38
+ attribute :cookbook, :kind_of => String, :default => nil
39
+ #trigger cache rebuild
40
+ #If not you can trigger in the recipe itself after checking the status of resource.updated{_by_last_action}?
41
+ attribute :cache_rebuild, :kind_of => [TrueClass, FalseClass], :default => true
@@ -0,0 +1,173 @@
1
+ # Letter case in directive names does not matter. Must be separated with colons.
2
+ # Valid boolean values are a zero number for false, non-zero numbers for true.
3
+
4
+ CacheDir: <%= node['apt']['cacher_dir'] %>
5
+
6
+ # set empty to disable logging
7
+ LogDir: /var/log/apt-cacher-ng
8
+
9
+ # TCP (http) port
10
+ # Set to 9999 to emulate apt-proxy
11
+ Port:<%= node['apt']['cacher_port'] %>
12
+
13
+ # Addresses or hostnames to listen on. Multiple addresses must be separated by
14
+ # spaces. Each entry must be associated with a local interface. DNS resolution
15
+ # is performed using getaddrinfo(3) for all available protocols (i.e. IPv4 and
16
+ # IPv6 if available).
17
+ #
18
+ # Default: not set, will listen on all interfaces.
19
+ #
20
+ # BindAddress: localhost 192.168.7.254 publicNameOnMainInterface
21
+
22
+ #Proxy: http://www-proxy.example.net:80
23
+ #proxy: http://username:proxypassword@proxy.example.net:3128
24
+
25
+ # Repository remapping. See manual for details.
26
+ # In this example, backends file is generated during package installation.
27
+ Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian
28
+ Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu
29
+ Remap-debvol: file:debvol_mirror*.gz /debian-volatile ; file:backends_debvol
30
+ Remap-cygwin: file:cygwin_mirrors /cygwin # ; file:backends_cygwin # incomplete, please create this file
31
+
32
+ # Virtual page accessible in a web browser to see statistics and status
33
+ # information, i.e. under http://localhost:3142/acng-report.html
34
+ ReportPage: acng-report.html
35
+
36
+ # Socket file for accessing through local UNIX socket instead of TCP/IP. Can be
37
+ # used with inetd bridge or cron client.
38
+ # SocketPath:/var/run/apt-cacher-ng/socket
39
+
40
+ # Forces log file to be written to disk after every line when set to 1. Default
41
+ # is 0, buffer flush happens after client disconnects.
42
+ #
43
+ # (technically, this is an alias to the Debug option provided for convenience)
44
+ #
45
+ # UnbufferLogs: 0
46
+
47
+ # Set to 0 to store only type, time and transfer sizes.
48
+ # 1 -> client IP and relative local path are logged too
49
+ # VerboseLog: 1
50
+
51
+ # Don't detach from the console
52
+ # ForeGround: 0
53
+
54
+ # Store the pid of the daemon process therein
55
+ # PidFile: /var/run/apt-cacher-ng/pid
56
+
57
+ # Forbid outgoing connections, work around them or respond with 503 error
58
+ # offlinemode:0
59
+
60
+ # Forbid all downloads that don't run through preconfigured backends (.where)
61
+ #ForceManaged: 0
62
+
63
+ # Days before considering an unreferenced file expired (to be deleted).
64
+ # Warning: if the value is set too low and particular index files are not
65
+ # available for some days (mirror downtime) there is a risk of deletion of
66
+ # still usefull package files.
67
+ ExTreshold: 4
68
+
69
+ # Stop expiration when a critical problem appeared. Currently only failed
70
+ # refresh of an index file is considered as critical.
71
+ #
72
+ # WARNING: don't touch this option or set to a non-zero number.
73
+ # Anything else is DANGEROUS and may cause data loss.
74
+ #
75
+ # ExAbortOnProblems: 1
76
+
77
+ # Replace some Windows/DOS-FS incompatible chars when storing
78
+ # StupidFs: 0
79
+
80
+ # Experimental feature for apt-listbugs: pass-through SOAP requests and
81
+ # responses to/from bugs.debian.org. If not set, default is true if
82
+ # ForceManaged is enabled and false otherwise.
83
+ # ForwardBtsSoap: 1
84
+
85
+ # The daemon has a small cache for DNS data, to speed up resolution. The
86
+ # expiration time of the DNS entries can be configured in seconds.
87
+ # DnsCacheSeconds: 3600
88
+
89
+ # Don't touch the following values without good consideration!
90
+ #
91
+ # Max. count of connection threads kept ready (for faster response in the
92
+ # future). Should be a sane value between 0 and average number of connections,
93
+ # and depend on the amount of spare RAM.
94
+ # MaxStandbyConThreads: 8
95
+ #
96
+ # Hard limit of active thread count for incomming connections, i.e. operation
97
+ # is refused when this value is reached (below zero = unlimited).
98
+ # MaxConThreads: -1
99
+ #
100
+ #VfilePattern = (^|.*?/)(Index|Packages\.bz2|Packages\.gz|Packages|Release|Release\.gpg|Sources\.bz2|Sources\.gz|Sources|release|index\.db-.*\.gz|Contents-[^/]*\.gz|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*\.bz2)$
101
+ #PfilePattern = .*(\.deb|\.rpm|\.dsc|\.tar\.gz\.gpg|\.tar\.gz|\.diff\.gz|\.diff\.bz2|\.jigdo|\.template|changelog|copyright|\.udeb|\.diff/.*\.gz|vmlinuz|initrd\.gz|(Devel)?ReleaseAnnouncement(\\?.*)?)$
102
+ # Whitelist for expiration, file types not to be removed even when being
103
+ # unreferenced. Default: same as VfilePattern which is a safe bed. When and
104
+ # only when the only used mirrors are official repositories (with working
105
+ # Release files) then it might be set to something more restrictive, like
106
+ # (^|.*?/)(Release|Release\.gpg|release|meta-release|Translation[^/]*\.bz2)$
107
+ #WfilePattern = (^|.*?/)(Index|Packages\.bz2|Packages\.gz|Packages|Release|Release\.gpg|Sources\.bz2|Sources\.gz|Sources|release|index\.db-.*\.gz|Contents-[^/]*\.gz|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*\.bz2)$
108
+
109
+ # Higher modes only working with the debug version
110
+ # Warning, writes a lot into apt-cacher.err logfile
111
+ # Value overwrites UnbufferLogs setting (aliased)
112
+ # Debug:3
113
+
114
+ # Usually, general purpose proxies like Squid expose the IP adress of the
115
+ # client user to the remote server using the X-Forwarded-For HTTP header. This
116
+ # behaviour can be optionally turned on with the Expose-Origin option.
117
+ # ExposeOrigin: 0
118
+
119
+ # When logging the originating IP address, trust the information supplied by
120
+ # the client in the X-Forwarded-For header.
121
+ # LogSubmittedOrigin: 0
122
+
123
+ # The version string reported to the peer, to be displayed as HTTP client (and
124
+ # version) in the logs of the mirror.
125
+ # WARNING: some archives use this header to detect/guess capabilities of the
126
+ # client (i.e. redirection support) and change the behaviour accordingly, while
127
+ # ACNG might not support the expected features. Expect side effects.
128
+ #
129
+ # UserAgent: Yet Another HTTP Client/1.2.3p4
130
+
131
+ # In some cases the Import and Expiration tasks might create fresh volatile
132
+ # data for internal use by reconstructing them using patch files. This
133
+ # by-product might be recompressed with bzip2 and with some luck the resulting
134
+ # file becomes identical to the *.bz2 file on the server, usable for APT
135
+ # clients trying to fetch the full .bz2 compressed version. Injection of the
136
+ # generated files into the cache has however a disadvantage on underpowered
137
+ # servers: bzip2 compession can create high load on the server system and the
138
+ # visible download of the busy .bz2 files also becomes slower.
139
+ #
140
+ # RecompBz2: 0
141
+
142
+ # Network timeout for outgoing connections.
143
+ # NetworkTimeout: 60
144
+
145
+ # Sometimes it makes sense to not store the data in cache and just return the
146
+ # package data to client as it comes in. DontCache parameters can enable this
147
+ # behaviour for certain URL types. The tokens are extended regular expressions
148
+ # that URLs are matched against.
149
+ #
150
+ # DontCacheRequested is applied to the URL as it comes in from the client.
151
+ # Example: exclude packages built with kernel-package for x86
152
+ # DontCacheRequested: linux-.*_10\...\.Custo._i386
153
+ # Example usecase: exclude popular private IP ranges from caching
154
+ # DontCacheRequested: 192.168.0 ^10\..* 172.30
155
+ #
156
+ # DontCacheResolved is applied to URLs after mapping to the target server. If
157
+ # multiple backend servers are specified then it's only matched against the
158
+ # download link for the FIRST possible source (due to implementation limits).
159
+ # Example usecase: all Ubuntu stuff comes from a local mirror (specified as
160
+ # backend), don't cache it again:
161
+ # DontCacheResolved: ubuntumirror.local.net
162
+ #
163
+ # DontCache directive sets (overrides) both, DontCacheResolved and
164
+ # DontCacheRequested. Provided for convenience, see those directives for
165
+ # details.
166
+ #
167
+ # Default permission set of freshly created files and directories, as octal
168
+ # numbers (see chmod(1) for details).
169
+ # Can by limited by the umask value (see umask(2) for details) if it's set in
170
+ # the environment of the starting shell, e.g. in apt-cacher-ng init script or
171
+ # in its configuration file.
172
+ # DirPerms: 00755
173
+ # FilePerms: 00664
@@ -0,0 +1,5 @@
1
+ Acquire::http::Proxy "http://<%= @proxy %>:<%= @port %>";
2
+ Acquire::https::Proxy "DIRECT";
3
+ <% @bypass.each do |bypass, type| %>
4
+ Acquire::<%= type %>::Proxy::<%= bypass %> "DIRECT";
5
+ <% end %>