diff mbox

[v2,1/3] php: fpm sapi: install startup script

Message ID 1430503955-24928-2-git-send-email-bos@je-eigen-domein.nl
State Accepted
Headers show

Commit Message

Floris Bos May 1, 2015, 6:12 p.m. UTC
Install the startup script if using the FastCGI Process Manager.

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>

---
v2: add systemd support
---
 package/php/0006-fix-php-fpm.service.in.patch | 35 +++++++++++++++++++++++++++
 package/php/php.mk                            | 15 ++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 package/php/0006-fix-php-fpm.service.in.patch

Comments

Arnout Vandecappelle May 1, 2015, 10:34 p.m. UTC | #1
On 01/05/15 20:12, Floris Bos wrote:
> Install the startup script if using the FastCGI Process Manager.
> 
> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
> 
> ---
> v2: add systemd support
> ---
>  package/php/0006-fix-php-fpm.service.in.patch | 35 +++++++++++++++++++++++++++
>  package/php/php.mk                            | 15 ++++++++++++
>  2 files changed, 50 insertions(+)
>  create mode 100644 package/php/0006-fix-php-fpm.service.in.patch
> 
> diff --git a/package/php/0006-fix-php-fpm.service.in.patch b/package/php/0006-fix-php-fpm.service.in.patch
> new file mode 100644
> index 0000000..a182a25
> --- /dev/null
> +++ b/package/php/0006-fix-php-fpm.service.in.patch
> @@ -0,0 +1,35 @@
> +From bb19125781c0794da9a63fee62e263ff4efff661 Mon Sep 17 00:00:00 2001
> +From: Floris Bos <bos@je-eigen-domein.nl>
> +Date: Fri, 1 May 2015 15:28:55 +0200
> +Subject: [PATCH] Fix php-fpm.service.in
> +
> +- Expand file paths.
> +- Remove obsolete After=syslog.target. Syslog is socket activated nowadays.

 Well, we do have a unit file for rsyslogd...

 Will you submit this patch upstream?

> +
> +Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
> +---
> + sapi/fpm/php-fpm.service.in | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in
> +index a2df30e..c135f04 100644
> +--- a/sapi/fpm/php-fpm.service.in
> ++++ b/sapi/fpm/php-fpm.service.in
> +@@ -1,11 +1,11 @@
> + [Unit]
> + Description=The PHP FastCGI Process Manager
> +-After=syslog.target network.target
> ++After=network.target

 I actually don't see why this is needed. If no syslog.target is defined, then
it will be ignored (at least that's what I understand from the systemd
documentation [1]).


 Regards,
 Arnout

> + 
> + [Service]
> + Type=@php_fpm_systemd@
> +-PIDFile=@localstatedir@/run/php-fpm.pid
> +-ExecStart=@sbindir@/php-fpm --nodaemonize --fpm-config @sysconfdir@/php-fpm.conf
> ++PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
> ++ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
> + ExecReload=/bin/kill -USR2 $MAINPID
> + 
> + [Install]
> +-- 
> +2.1.4

[snip]

[1] http://www.freedesktop.org/software/systemd/man/systemd.unit.html
Floris Bos May 1, 2015, 10:58 p.m. UTC | #2
Hi,

On 05/02/2015 12:34 AM, Arnout Vandecappelle wrote:
> +- Expand file paths.
> +- Remove obsolete After=syslog.target. Syslog is socket activated nowadays.
>   Well, we do have a unit file for rsyslogd...

Other distros consider it obsolete, and told their maintainers to remove 
syslog.target last year.

http://lists.opensuse.org/archive/opensuse-packaging/2013-05/msg00102.html
https://lintian.debian.org/tags/systemd-service-file-refers-to-obsolete-target.html

>   Will you submit this patch upstream?

Did submit a simple pull request to php-src github earlier today.
But do not plan to chase it.


Yours sincerely,

Floris Bos
Arnout Vandecappelle May 1, 2015, 11:06 p.m. UTC | #3
On 02/05/15 00:58, Floris Bos wrote:
> Hi,
> 
> On 05/02/2015 12:34 AM, Arnout Vandecappelle wrote:
>> +- Expand file paths.
>> +- Remove obsolete After=syslog.target. Syslog is socket activated nowadays.
>>   Well, we do have a unit file for rsyslogd...
> 
> Other distros consider it obsolete, and told their maintainers to remove
> syslog.target last year.
> 
> http://lists.opensuse.org/archive/opensuse-packaging/2013-05/msg00102.html
> https://lintian.debian.org/tags/systemd-service-file-refers-to-obsolete-target.html

 Ah OK I get it now.


 Thanks,
 Arnout

> 
>>   Will you submit this patch upstream?
> 
> Did submit a simple pull request to php-src github earlier today.
> But do not plan to chase it.
> 
> 
> Yours sincerely,
> 
> Floris Bos
>
Arnout Vandecappelle May 1, 2015, 11:07 p.m. UTC | #4
On 01/05/15 20:12, Floris Bos wrote:
> Install the startup script if using the FastCGI Process Manager.
> 
> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 (after Floris' further explanation).

 Regards,
 Arnout

> 
> ---
> v2: add systemd support
> ---
>  package/php/0006-fix-php-fpm.service.in.patch | 35 +++++++++++++++++++++++++++
>  package/php/php.mk                            | 15 ++++++++++++
>  2 files changed, 50 insertions(+)
>  create mode 100644 package/php/0006-fix-php-fpm.service.in.patch
> 
> diff --git a/package/php/0006-fix-php-fpm.service.in.patch b/package/php/0006-fix-php-fpm.service.in.patch
> new file mode 100644
> index 0000000..a182a25
> --- /dev/null
> +++ b/package/php/0006-fix-php-fpm.service.in.patch
> @@ -0,0 +1,35 @@
> +From bb19125781c0794da9a63fee62e263ff4efff661 Mon Sep 17 00:00:00 2001
> +From: Floris Bos <bos@je-eigen-domein.nl>
> +Date: Fri, 1 May 2015 15:28:55 +0200
> +Subject: [PATCH] Fix php-fpm.service.in
> +
> +- Expand file paths.
> +- Remove obsolete After=syslog.target. Syslog is socket activated nowadays.
> +
> +Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
> +---
> + sapi/fpm/php-fpm.service.in | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in
> +index a2df30e..c135f04 100644
> +--- a/sapi/fpm/php-fpm.service.in
> ++++ b/sapi/fpm/php-fpm.service.in
> +@@ -1,11 +1,11 @@
> + [Unit]
> + Description=The PHP FastCGI Process Manager
> +-After=syslog.target network.target
> ++After=network.target
> + 
> + [Service]
> + Type=@php_fpm_systemd@
> +-PIDFile=@localstatedir@/run/php-fpm.pid
> +-ExecStart=@sbindir@/php-fpm --nodaemonize --fpm-config @sysconfdir@/php-fpm.conf
> ++PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
> ++ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
> + ExecReload=/bin/kill -USR2 $MAINPID
> + 
> + [Install]
> +-- 
> +2.1.4
> +
> diff --git a/package/php/php.mk b/package/php/php.mk
> index e4331f2..4c65c35 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -251,6 +251,21 @@ PHP_CONF_OPTS += \
>  PHP_DEPENDENCIES += jpeg libpng freetype
>  endif
>  
> +ifeq ($(BR2_PACKAGE_PHP_FPM),y)
> +define PHP_INSTALL_INIT_SYSV
> +	$(INSTALL) -D -m 0755 $(@D)/sapi/fpm/init.d.php-fpm \
> +		$(TARGET_DIR)/etc/init.d/S49php-fpm
> +endef
> +
> +define PHP_INSTALL_INIT_SYSTEMD
> +	$(INSTALL) -D -m 0644 $(@D)/sapi/fpm/php-fpm.service \
> +		$(TARGET_DIR)/usr/lib/systemd/system/php-fpm.service
> +	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> +	ln -fs ../../../../usr/lib/systemd/system/php-fpm.service \
> +		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/php-fpm.service
> +endef
> +endif
> +
>  define PHP_EXTENSIONS_FIXUP
>  	$(SED) "/prefix/ s:/usr:$(STAGING_DIR)/usr:" \
>  		$(STAGING_DIR)/usr/bin/phpize
>
Thomas Petazzoni May 2, 2015, 7:44 a.m. UTC | #5
Dear Floris Bos,

On Fri,  1 May 2015 20:12:33 +0200, Floris Bos wrote:
> Install the startup script if using the FastCGI Process Manager.
> 
> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
> 
> ---
> v2: add systemd support
> ---
>  package/php/0006-fix-php-fpm.service.in.patch | 35 +++++++++++++++++++++++++++
>  package/php/php.mk                            | 15 ++++++++++++
>  2 files changed, 50 insertions(+)
>  create mode 100644 package/php/0006-fix-php-fpm.service.in.patch

Applied, thanks.

Thomas
diff mbox

Patch

diff --git a/package/php/0006-fix-php-fpm.service.in.patch b/package/php/0006-fix-php-fpm.service.in.patch
new file mode 100644
index 0000000..a182a25
--- /dev/null
+++ b/package/php/0006-fix-php-fpm.service.in.patch
@@ -0,0 +1,35 @@ 
+From bb19125781c0794da9a63fee62e263ff4efff661 Mon Sep 17 00:00:00 2001
+From: Floris Bos <bos@je-eigen-domein.nl>
+Date: Fri, 1 May 2015 15:28:55 +0200
+Subject: [PATCH] Fix php-fpm.service.in
+
+- Expand file paths.
+- Remove obsolete After=syslog.target. Syslog is socket activated nowadays.
+
+Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
+---
+ sapi/fpm/php-fpm.service.in | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in
+index a2df30e..c135f04 100644
+--- a/sapi/fpm/php-fpm.service.in
++++ b/sapi/fpm/php-fpm.service.in
+@@ -1,11 +1,11 @@
+ [Unit]
+ Description=The PHP FastCGI Process Manager
+-After=syslog.target network.target
++After=network.target
+ 
+ [Service]
+ Type=@php_fpm_systemd@
+-PIDFile=@localstatedir@/run/php-fpm.pid
+-ExecStart=@sbindir@/php-fpm --nodaemonize --fpm-config @sysconfdir@/php-fpm.conf
++PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
++ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
+ ExecReload=/bin/kill -USR2 $MAINPID
+ 
+ [Install]
+-- 
+2.1.4
+
diff --git a/package/php/php.mk b/package/php/php.mk
index e4331f2..4c65c35 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -251,6 +251,21 @@  PHP_CONF_OPTS += \
 PHP_DEPENDENCIES += jpeg libpng freetype
 endif
 
+ifeq ($(BR2_PACKAGE_PHP_FPM),y)
+define PHP_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 $(@D)/sapi/fpm/init.d.php-fpm \
+		$(TARGET_DIR)/etc/init.d/S49php-fpm
+endef
+
+define PHP_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 $(@D)/sapi/fpm/php-fpm.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/php-fpm.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -fs ../../../../usr/lib/systemd/system/php-fpm.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/php-fpm.service
+endef
+endif
+
 define PHP_EXTENSIONS_FIXUP
 	$(SED) "/prefix/ s:/usr:$(STAGING_DIR)/usr:" \
 		$(STAGING_DIR)/usr/bin/phpize