diff --git a/.gitattributes b/.gitattributes old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Modulefile b/Modulefile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/files/install_extension.sh b/files/install_extension.sh old mode 100644 new mode 100755 diff --git a/manifests/extension.pp b/manifests/extension.pp old mode 100644 new mode 100755 diff --git a/manifests/init.pp b/manifests/init.pp old mode 100644 new mode 100755 index 4c7da48..0ec19bb --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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' { @@ -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' @@ -103,7 +137,7 @@ subscribe => File['/usr/bin/phpbrew'], refreshonly => true, } - + file { $php_install_dir: ensure => 'directory', require => Exec['init phpbrew'], @@ -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': diff --git a/manifests/install.pp b/manifests/install.pp old mode 100644 new mode 100755 diff --git a/metadata.json b/metadata.json old mode 100644 new mode 100755 diff --git a/templates/bashrc.erb b/templates/bashrc.erb new file mode 100755 index 0000000..a15591b --- /dev/null +++ b/templates/bashrc.erb @@ -0,0 +1,3 @@ +#!/bin/bash + +source ~/.phpbrew/bashrc diff --git a/templates/fcgiwrapper.sh.erb b/templates/fcgiwrapper.sh.erb old mode 100644 new mode 100755 diff --git a/templates/phpbrew.sh.erb b/templates/phpbrew.sh.erb new file mode 100755 index 0000000..fc5cd3a --- /dev/null +++ b/templates/phpbrew.sh.erb @@ -0,0 +1,3 @@ +export PHPBREW_ROOT=/opt/phpbrew +export PHPBREW_HOME=$HOME/.phpbrew +source /opt/phpbrew/bashrc