Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect-php:master commit in: /, src/
Date: Thu, 23 Jan 2020 15:06:38
Message-Id: 1579713308.355d4102019daaafd9f803bf4435af127e315988.mjo@gentoo
1 commit: 355d4102019daaafd9f803bf4435af127e315988
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 22 15:05:57 2020 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 22 17:15:08 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=355d4102
7
8 src/php-fpm-launcher.in: add php-fpm-launcher wrapper script.
9
10 While OpenRC services are powerful enough to compute the selected
11 version of php-fpm, the corresponding systemd services are not and
12 must use a fixed path. The executable at that fixed path must
13 therefore decide which version of php-fpm to run before running it.
14 This commit adds a script to do just that.
15
16 This script is already present in the app-eselect/eselect-php
17 package, tacked on from $FILESDIR. It's a better fit as part of
18 the repository.
19
20 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
21
22 .gitignore | 1 +
23 Makefile.am | 10 ++++++++--
24 src/php-fpm-launcher.in | 11 +++++++++++
25 3 files changed, 20 insertions(+), 2 deletions(-)
26
27 diff --git a/.gitignore b/.gitignore
28 index 97ae412..9bfa566 100644
29 --- a/.gitignore
30 +++ b/.gitignore
31 @@ -11,3 +11,4 @@ openrc/init.d/php-fpm
32 openrc/init.d/php-fpm.in
33 src/php.eselect
34 src/php.eselect.in
35 +src/php-fpm-launcher
36
37 diff --git a/Makefile.am b/Makefile.am
38 index f351b49..fbca127 100644
39 --- a/Makefile.am
40 +++ b/Makefile.am
41 @@ -2,7 +2,9 @@ eselectdir = $(datadir)/eselect/modules
42 nodist_eselect_DATA = $(srcdir)/src/php.eselect
43
44 # Without EXTRA_DIST, these files don't wind up in the tarball.
45 -EXTRA_DIST = $(srcdir)/src/70_mod_php.conf.in openrc
46 +EXTRA_DIST = $(srcdir)/openrc \
47 + $(srcdir)/src/70_mod_php.conf.in \
48 + $(srcdir)/src/php-fpm-launcher.in
49
50 if APACHE2
51 # Without these set, we won't try to install the conf file.
52 @@ -17,6 +19,8 @@ if FPM
53
54 confdir = $(sysconfdir)/conf.d
55 nodist_conf_DATA = $(srcdir)/openrc/conf.d/php-fpm
56 +
57 + nodist_libexec_SCRIPTS = $(srcdir)/src/php-fpm-launcher
58 endif
59
60 # The next few rules allow us to replace bindir, libdir, etc.
61 @@ -29,7 +33,8 @@ edit = sed -e 's|@BINDIR[@]|$(bindir)|g' \
62 -e 's|@LOCALSTATEDIR[@]|$(localstatedir)|g' \
63 -e 's|@SYSCONFDIR[@]|$(sysconfdir)|g'
64
65 -$(nodist_eselect_DATA) $(nodist_apacheconf_DATA) $(nodist_init_SCRIPTS): Makefile
66 +
67 +$(nodist_eselect_DATA) $(nodist_apacheconf_DATA) $(nodist_init_SCRIPTS) $(nodist_libexec_SCRIPTS): Makefile
68 rm -f $@ $@.tmp
69 srcdir=''; \
70 test -f ./$@.in || srcdir=$(srcdir)/; \
71 @@ -37,5 +42,6 @@ $(nodist_eselect_DATA) $(nodist_apacheconf_DATA) $(nodist_init_SCRIPTS): Makefil
72 mv $@.tmp $@
73
74 $(srcdir)/src/php.eselect: $(srcdir)/src/php.eselect.in
75 +$(srcdir)/src/php-fpm-launcher: $(srcdir)/src/php-fpm-launcher.in
76 $(srcdir)/src/70_mod_php.conf: $(srcdir)/src/70_mod_php.conf.in
77 $(srcdir)/openrc/init.d/php-fpm: $(srcdir)/openrc/init.d/php-fpm.in
78
79 diff --git a/src/php-fpm-launcher.in b/src/php-fpm-launcher.in
80 new file mode 100644
81 index 0000000..940cec9
82 --- /dev/null
83 +++ b/src/php-fpm-launcher.in
84 @@ -0,0 +1,11 @@
85 +#!/bin/sh
86 +
87 +# If there are no arguments, then "shift" will fail (bug 626496).
88 +if [ $# -eq 0 ]; then
89 + PHP_SLOT=$(eselect php show fpm)
90 +else
91 + PHP_SLOT=$1
92 + shift
93 +fi
94 +
95 +exec "@LIBDIR@/${PHP_SLOT}/bin/php-fpm" "${@}"