Skip to content

Commit 276a247

Browse files
author
vagrant
committed
Installing PHPBrew into System wide Environment
1 parent 331bc61 commit 276a247

12 files changed

+31
-29
lines changed

.gitattributes

100644100755
File mode changed.

.gitignore

100644100755
File mode changed.

Modulefile

100644100755
File mode changed.

README.md

100644100755
File mode changed.

files/install_extension.sh

100644100755
File mode changed.

manifests/extension.pp

100644100755
File mode changed.

manifests/init.pp

100644100755
+27-28
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# class { 'phpbrew': }
1313
#
1414
class phpbrew (
15-
$php_install_dir = '/opt/phpbrew'
15+
String $php_install_dir = '/opt/phpbrew',
16+
Boolean $system_wide = false,
17+
Array $additional_dependencies = []
1618
) {
1719
case $::operatingsystem {
1820
centos: {
@@ -28,13 +30,8 @@
2830
'openssl-devel',
2931
'bzip2-devel',
3032
'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
3835

3936
exec { 'Installing Development Tools package group':
4037
command => '/usr/bin/yum -y groupinstall Development Tools'
@@ -104,7 +101,7 @@
104101

105102
exec { 'init phpbrew':
106103
command => '/usr/bin/sudo /usr/bin/phpbrew init',
107-
creates => '/opt/phpbrew/bashrc',
104+
creates => '/root/.phpbrew/bashrc',
108105
subscribe => File['/usr/bin/phpbrew'],
109106
refreshonly => true,
110107
}
@@ -120,35 +117,37 @@
120117
}
121118

122119
# Specify where versions of PHP will be installed.
123-
file { '/opt/phpbrew/init':
120+
file { '/root/.phpbrew/init':
124121
content => "export PHPBREW_ROOT=${php_install_dir}",
125122
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']
137123
}
138124

139125
# 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+
}
145145

146-
147146
exec { 'update basbrc':
148147
command => '/bin/bash'
149148
}
150149

151-
file { '/opt/phpbrew/install_extension.sh':
150+
file { '/root/.phpbrew/install_extension.sh':
152151
ensure => present,
153152
mode => 'a+x',
154153
source => 'puppet:///modules/phpbrew/install_extension.sh',

manifests/install.pp

100644100755
File mode changed.

metadata.json

100644100755
File mode changed.

templates/bashrc.erb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
source ~/.phpbrew/bashrc

templates/fcgiwrapper.sh.erb

100644100755
File mode changed.

templates/phpbrew.sh.erb

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export PHPBREW_ROOT=/opt/phpbrew
2-
export PHPBREW_HOME=/opt/phpbrew
2+
export PHPBREW_HOME=$HOME/.phpbrew
33
source /opt/phpbrew/bashrc

0 commit comments

Comments
 (0)