|
fcbbd93f
»
|
crafterm |
2008-02-27 |
Initial Sprinkle source import |
1 |
module Sprinkle |
| |
2 |
module Installers |
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
3 |
# = Apt Package Installer |
| |
4 |
# |
| |
5 |
# The Apt package installer uses the +apt-get+ command to install |
| |
6 |
# packages. The apt installer has only one option which can be |
| |
7 |
# modified which is the +dependencies_only+ option. When this is |
| |
8 |
# set to true, the installer uses +build-dep+ instead of +install+ |
| |
9 |
# to only build the dependencies. |
| |
10 |
# |
| |
11 |
# == Example Usage |
| |
12 |
# |
| |
13 |
# First, a simple installation of the magic_beans package: |
| |
14 |
# |
| |
15 |
# package :magic_beans do |
| |
16 |
# description "Beans beans they're good for your heart..." |
| |
17 |
# apt 'magic_beans_package' |
| |
18 |
# end |
| |
19 |
# |
| |
20 |
# Second, only build the magic_beans dependencies: |
| |
21 |
# |
| |
22 |
# package :magic_beans_depends do |
| |
23 |
# apt 'magic_beans_package' { dependencies_only true } |
| |
24 |
# end |
| |
25 |
# |
| |
26 |
# As you can see, setting options is as simple as creating a |
| |
27 |
# block and calling the option as a method with the value as |
| |
28 |
# its parameter. |
|
fcbbd93f
»
|
crafterm |
2008-02-27 |
Initial Sprinkle source import |
29 |
class Apt < Installer |
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
30 |
attr_accessor :packages #:nodoc: |
|
272d9ab4
»
|
crafterm |
2008-05-20 |
Implemented apt installer s... |
31 |
|
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
32 |
def initialize(parent, *packages, &block) #:nodoc: |
|
35ac252c
»
|
adzap |
2008-07-14 |
added option for apt instal... |
33 |
packages.flatten! |
| |
34 |
|
| |
35 |
options = { :dependencies_only => false } |
| |
36 |
options.update(packages.pop) if packages.last.is_a?(Hash) |
| |
37 |
|
|
d53a79e4
»
|
adzap |
2008-07-22 |
fixed apt installer options... |
38 |
super parent, options, &block |
| |
39 |
|
|
fcbbd93f
»
|
crafterm |
2008-02-27 |
Initial Sprinkle source import |
40 |
@packages = packages |
| |
41 |
end |
|
272d9ab4
»
|
crafterm |
2008-05-20 |
Implemented apt installer s... |
42 |
|
|
fcbbd93f
»
|
crafterm |
2008-02-27 |
Initial Sprinkle source import |
43 |
protected |
|
272d9ab4
»
|
crafterm |
2008-05-20 |
Implemented apt installer s... |
44 |
|
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
45 |
def install_commands #:nodoc: |
|
d53a79e4
»
|
adzap |
2008-07-22 |
fixed apt installer options... |
46 |
command = @options[:dependencies_only] ? 'build-dep' : 'install' |
|
26413604
»
|
ulbrich |
2009-07-24 |
Fixed setting environment v... |
47 |
"env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get --force-yes -qyu #{command} #{@packages.join(' ')}" |
|
fcbbd93f
»
|
crafterm |
2008-02-27 |
Initial Sprinkle source import |
48 |
end |
|
272d9ab4
»
|
crafterm |
2008-05-20 |
Implemented apt installer s... |
49 |
|
|
fcbbd93f
»
|
crafterm |
2008-02-27 |
Initial Sprinkle source import |
50 |
end |
| |
51 |
end |
|
272d9ab4
»
|
crafterm |
2008-05-20 |
Implemented apt installer s... |
52 |
end |