Skip to content
This repository
Browse code

Add eselect-php working with php-5.5.0_alpha2

  • Loading branch information...
commit 44410efb0616f1917cdff90a300e36c03c765b23 1 parent ca02b19
Justin Lavoie authored
1  app-admin/eselect-php/Manifest
... ...
@@ -0,0 +1 @@
  1
+DIST eselect-php-0.7.0.bz2 2252 SHA256 386abbab747e617e18a39d359c816ccd94cdf8048ea51e6e185370be157f0194 SHA512 be36e23bb7940b013941da9d0e73e29184cc55a929c1c59b81ae265203dceed9b040950925eafa723adc041afe6cf841e54f3db0e3d76627e974f075f4528e9e WHIRLPOOL ca7f5507ce37ce8d9b9560797836e6a8610a8a9f61a125858b38a78e7418356a2b9787d92cf09ef13196f379b548710b2ea23b3333aba7e499dd685c0110ab86
42  app-admin/eselect-php/eselect-php-0.7.0.ebuild
... ...
@@ -0,0 +1,42 @@
  1
+# Copyright 1999-2013 Gentoo Foundation
  2
+# Distributed under the terms of the GNU General Public License v2
  3
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-php/eselect-php-0.7.0.ebuild,v 1.2 2013/03/25 16:13:04 olemarkus Exp $
  4
+
  5
+EAPI=5
  6
+
  7
+inherit depend.apache
  8
+
  9
+DESCRIPTION="PHP eselect module"
  10
+HOMEPAGE="http://www.gentoo.org"
  11
+SRC_URI="http://dev.gentoo.org/~olemarkus/eselect-php/eselect-php-${PV}.bz2"
  12
+
  13
+LICENSE="GPL-2"
  14
+SLOT="0"
  15
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
  16
+IUSE="fpm apache2"
  17
+
  18
+DEPEND=">=app-admin/eselect-1.2.4"
  19
+
  20
+RDEPEND="${DEPEND}"
  21
+
  22
+S="${WORKDIR}"
  23
+
  24
+want_apache
  25
+
  26
+src_install() {
  27
+	mv eselect-php-${PV} php.eselect
  28
+	insinto /usr/share/eselect/modules/
  29
+	doins php.eselect
  30
+
  31
+	if use apache2 ; then
  32
+		insinto "${APACHE_MODULES_CONFDIR#${EPREFIX}}"
  33
+		newins "${FILESDIR}/70_mod_php5.conf-apache2" \
  34
+			"70_mod_php5.conf"
  35
+	fi
  36
+
  37
+	if use fpm ; then
  38
+		dodir "/etc/init.d"
  39
+		insinto "/etc/init.d"
  40
+		newinitd "${FILESDIR}/php-fpm.init" "php-fpm"
  41
+	fi
  42
+}
14  app-admin/eselect-php/files/70_mod_php5.conf-apache2
... ...
@@ -0,0 +1,14 @@
  1
+<IfDefine PHP5>
  2
+	# Load the module first
  3
+	<IfModule !mod_php5.c>
  4
+		LoadModule php5_module    modules/libphp5.so
  5
+	</IfModule>
  6
+
  7
+	# Set it to handle the files
  8
+	<IfModule mod_mime.c>
  9
+		AddHandler application/x-httpd-php .php .php5 .phtml
  10
+		AddHandler application/x-httpd-php-source .phps
  11
+	</IfModule>
  12
+
  13
+	DirectoryIndex index.php index.phtml
  14
+</IfDefine>
49  app-admin/eselect-php/files/php-fpm
... ...
@@ -0,0 +1,49 @@
  1
+#!/sbin/runscript
  2
+
  3
+set_phpvars() {
  4
+	PHPSLOT=${SVCNAME#php-fpm-}
  5
+	[ ${PHPSLOT} = 'php-fpm' ] && PHPSLOT="$(eselect php show fpm)"
  6
+
  7
+	PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf"
  8
+	PHP_FPM_PID="/var/run/php-fpm-${PHPSLOT}.pid"
  9
+
  10
+	[ ${PHPSLOT} = 'php-fpm' ] && PHP_FPM_PID="/var/run/php-fpm.pid"
  11
+}
  12
+
  13
+extra_commands="depend"
  14
+extra_started_commands="reload"
  15
+
  16
+depend() {
  17
+	need net
  18
+	use apache2 lighttpd nginx
  19
+}
  20
+
  21
+start() {
  22
+        ebegin "Starting PHP FastCGI Process Manager"
  23
+	set_phpvars
  24
+        start-stop-daemon --start --pidfile ${PHP_FPM_PID} --exec \
  25
+            /usr/lib/${PHPSLOT}/bin/php-fpm -- -y "${PHP_FPM_CONF}" -g "${PHP_FPM_PID}"
  26
+        local i=0
  27
+        local timeout=5
  28
+        while [ ! -f ${PHP_FPM_PID} ] && [ $i -le $timeout ]; do
  29
+            sleep 1
  30
+            i=$(($i + 1))
  31
+        done
  32
+        
  33
+        [ $timeout -gt $i ]
  34
+        eend $?
  35
+}
  36
+
  37
+stop() {
  38
+        ebegin "Stopping PHP FastCGI Process Manager"
  39
+	set_phpvars
  40
+        start-stop-daemon --signal QUIT --stop --exec /usr/lib/${PHPSLOT}/bin/php-fpm --pidfile ${PHP_FPM_PID}
  41
+        eend $?
  42
+}
  43
+
  44
+reload() {
  45
+    ebegin "Reloading PHP FastCGI Process Manager"
  46
+    set_phpvars
  47
+    [ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID})
  48
+    eend $?
  49
+}
47  app-admin/eselect-php/files/php-fpm.init
... ...
@@ -0,0 +1,47 @@
  1
+#!/sbin/runscript
  2
+
  3
+set_phpvars() {
  4
+	PHPSLOT=${SVCNAME#php-fpm-}
  5
+	[ ${PHPSLOT} = 'php-fpm' ] && PHPSLOT="$(eselect php show fpm)"
  6
+
  7
+	PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf"
  8
+	PHP_FPM_PID="/var/run/php-fpm-${PHPSLOT}.pid"
  9
+}
  10
+
  11
+extra_commands="depend"
  12
+extra_started_commands="reload"
  13
+
  14
+depend() {
  15
+	need net
  16
+	use apache2 lighttpd nginx
  17
+}
  18
+
  19
+start() {
  20
+        ebegin "Starting PHP FastCGI Process Manager"
  21
+	set_phpvars
  22
+        start-stop-daemon --start --pidfile ${PHP_FPM_PID} --exec \
  23
+            /usr/lib/${PHPSLOT}/bin/php-fpm -- -y "${PHP_FPM_CONF}" -g "${PHP_FPM_PID}"
  24
+        local i=0
  25
+        local timeout=5
  26
+        while [ ! -f ${PHP_FPM_PID} ] && [ $i -le $timeout ]; do
  27
+            sleep 1
  28
+            i=$(($i + 1))
  29
+        done
  30
+        
  31
+        [ $timeout -gt $i ]
  32
+        eend $?
  33
+}
  34
+
  35
+stop() {
  36
+        ebegin "Stopping PHP FastCGI Process Manager"
  37
+	set_phpvars
  38
+        start-stop-daemon --signal QUIT --stop --exec /usr/lib/${PHPSLOT}/bin/php-fpm --pidfile ${PHP_FPM_PID}
  39
+        eend $?
  40
+}
  41
+
  42
+reload() {
  43
+    ebegin "Reloading PHP FastCGI Process Manager"
  44
+    set_phpvars
  45
+    [ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID})
  46
+    eend $?
  47
+}

0 notes on commit 44410ef

Please sign in to comment.
Something went wrong with that request. Please try again.