Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing PHPBrew into System wide Environment #9

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitattributes
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified Modulefile
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified files/install_extension.sh
100644 → 100755
Empty file.
Empty file modified manifests/extension.pp
100644 → 100755
Empty file.
77 changes: 69 additions & 8 deletions manifests/init.pp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
# class { 'phpbrew': }
#
class phpbrew (
$php_install_dir = '/opt/phpbrew'
String $php_install_dir = '/opt/phpbrew',
Boolean $system_wide = false,
Array $additional_dependencies = []
) {
<<<<<<< Updated upstream
case $::operatingsystem {
centos: {
if $::operatingsystemmajrelease == '7' {
Expand All @@ -29,7 +32,38 @@
'bzip2-devel',
'libicu-devel',
'readline-devel'
]
] + $additional_dependencies
=======
case $::operatingsystem {
centos: {
$dependencies = [
'curl',
'libxslt-devel',
're2c',
'libxml2-devel',
'php-cli',
'libmcrypt-devel',
'php-devel',
'openssl-devel',
'bzip2-devel',
'libicu-devel',
'readline-devel'
]

if Integer( $::operatingsystemmajrelease ) >= 8 {
$installDevToolsCommand = '/usr/bin/dnf -y group install "Development Tools"'
} elsif $::operatingsystemmajrelease == '7' {
$installDevToolsCommand = '/usr/bin/yum -y groupinstall "Development Tools"'
} else {
fail("CentOS support only tested on major version 7 and 8, you are running version '${::operatingsystemmajrelease}'")
}

exec { 'Installing Development Tools package group':
command => $installDevToolsCommand,
timeout => 3600,
tries => 3,
}
>>>>>>> Stashed changes

exec { 'Installing Development Tools package group':
command => '/usr/bin/yum -y groupinstall Development Tools'
Expand Down Expand Up @@ -103,7 +137,7 @@
subscribe => File['/usr/bin/phpbrew'],
refreshonly => true,
}

file { $php_install_dir:
ensure => 'directory',
require => Exec['init phpbrew'],
Expand All @@ -119,12 +153,39 @@
content => "export PHPBREW_ROOT=${php_install_dir}",
require => Exec['init phpbrew']
}

# Load phpbrew configuration by default.
file_line { 'add phpbrew to bashrc':
path => '/root/.bashrc',
line => 'source /root/.phpbrew/bashrc',
require => Exec['init phpbrew'],
if $system_wide {
###################################################################
# Init as vagrant user to use when need to switch php
# and use it from vagrant console for example for composer command
###################################################################
exec { 'init phpbrew as vagrant':
command => '/usr/bin/phpbrew init',
creates => '/home/vagrant/.phpbrew/bashrc',
subscribe => File['/usr/bin/phpbrew'],
refreshonly => true,
user => "vagrant",
environment => ["HOME=/home/vagrant"],
}

file { '/opt/phpbrew/bashrc':
ensure => present,
content => template('phpbrew/bashrc.erb'),
require => Exec['init phpbrew']
}

file { "/etc/profile.d/phpbrew.sh":
ensure => present,
content => template('phpbrew/phpbrew.sh.erb'),
require => Exec['init phpbrew']
}
} else {
file_line { 'add phpbrew to bashrc':
path => '/root/.bashrc',
line => 'source /root/.phpbrew/bashrc',
require => Exec['init phpbrew'],
}
}

exec { 'update basbrc':
Expand Down
Empty file modified manifests/install.pp
100644 → 100755
Empty file.
Empty file modified metadata.json
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions templates/bashrc.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

source ~/.phpbrew/bashrc
Empty file modified templates/fcgiwrapper.sh.erb
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions templates/phpbrew.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export PHPBREW_ROOT=/opt/phpbrew
export PHPBREW_HOME=$HOME/.phpbrew
source /opt/phpbrew/bashrc