|
12 | 12 | # class { 'phpbrew': } |
13 | 13 | # |
14 | 14 | class phpbrew ( |
15 | | - $php_install_dir = '/opt/phpbrew' |
| 15 | + String $php_install_dir = '/opt/phpbrew', |
| 16 | + Boolean $system_wide = false, |
| 17 | + Array $additional_dependencies = [] |
16 | 18 | ) { |
17 | 19 | case $::operatingsystem { |
18 | 20 | centos: { |
|
28 | 30 | 'openssl-devel', |
29 | 31 | 'bzip2-devel', |
30 | 32 | 'libicu-devel', |
31 | | - 'readline-devel', |
32 | | - |
33 | | - 'httpd-devel', |
34 | | - 'libcurl-devel', |
35 | | - 'oniguruma-devel', |
36 | | - 'libsodium-devel' |
37 | | - ] |
| 33 | + 'readline-devel' |
| 34 | + ] + $additional_dependencies |
38 | 35 |
|
39 | 36 | exec { 'Installing Development Tools package group': |
40 | 37 | command => '/usr/bin/yum -y groupinstall Development Tools' |
|
104 | 101 |
|
105 | 102 | exec { 'init phpbrew': |
106 | 103 | command => '/usr/bin/sudo /usr/bin/phpbrew init', |
107 | | - creates => '/opt/phpbrew/bashrc', |
| 104 | + creates => '/root/.phpbrew/bashrc', |
108 | 105 | subscribe => File['/usr/bin/phpbrew'], |
109 | 106 | refreshonly => true, |
110 | 107 | } |
|
120 | 117 | } |
121 | 118 |
|
122 | 119 | # Specify where versions of PHP will be installed. |
123 | | - file { '/opt/phpbrew/init': |
| 120 | + file { '/root/.phpbrew/init': |
124 | 121 | content => "export PHPBREW_ROOT=${php_install_dir}", |
125 | 122 | require => Exec['init phpbrew'] |
126 | | - }-> |
127 | | - file_line { 'Append a line to /opt/phpbrew/init': |
128 | | - path => '/opt/phpbrew/init', |
129 | | - line => 'export PHPBREW_HOME=${php_install_dir}', |
130 | | - } |
131 | | - |
132 | | - file { "/etc/profile.d/phpbrew.sh": |
133 | | - ensure => present, |
134 | | - content => template('phpbrew/phpbrew.sh.erb'), |
135 | | - mode => 'a+x', |
136 | | - require => Exec['init phpbrew'] |
137 | 123 | } |
138 | 124 |
|
139 | 125 | # Load phpbrew configuration by default. |
140 | | -# file_line { 'add phpbrew to bashrc': |
141 | | -# path => '~/.bashrc', |
142 | | -# line => 'source ~/.phpbrew/bashrc', |
143 | | -# require => Exec['init phpbrew'], |
144 | | -# } |
| 126 | + if $system_wide { |
| 127 | + file { '/opt/phpbrew/bashrc': |
| 128 | + ensure => present, |
| 129 | + content => template('phpbrew/bashrc.erb'), |
| 130 | + require => Exec['init phpbrew'] |
| 131 | + } |
| 132 | + |
| 133 | + file { "/etc/profile.d/phpbrew.sh": |
| 134 | + ensure => present, |
| 135 | + content => template('phpbrew/phpbrew.sh.erb'), |
| 136 | + require => Exec['init phpbrew'] |
| 137 | + } |
| 138 | + } else { |
| 139 | + file_line { 'add phpbrew to bashrc': |
| 140 | + path => '/root/.bashrc', |
| 141 | + line => 'source /root/.phpbrew/bashrc', |
| 142 | + require => Exec['init phpbrew'], |
| 143 | + } |
| 144 | + } |
145 | 145 |
|
146 | | - |
147 | 146 | exec { 'update basbrc': |
148 | 147 | command => '/bin/bash' |
149 | 148 | } |
150 | 149 |
|
151 | | - file { '/opt/phpbrew/install_extension.sh': |
| 150 | + file { '/root/.phpbrew/install_extension.sh': |
152 | 151 | ensure => present, |
153 | 152 | mode => 'a+x', |
154 | 153 | source => 'puppet:///modules/phpbrew/install_extension.sh', |
|
0 commit comments