- use new service functions
- introduce uci config
- rename initscript
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29265
3c298f89-4303-0410-b956-
a3cf2f4a3e73
PKG_NAME:=php
PKG_VERSION:=5.3.8
-PKG_RELEASE:=5
+PKG_RELEASE:=6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.php.net/distributions/
endef
define Package/php5-fastcgi/install
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DATA) ./files/php5-fastcgi.config $(1)/etc/config/php5-fastcgi
+
$(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
+ $(INSTALL_BIN) ./files/php5-fastcgi.init $(1)/etc/init.d/php5-fastcgi
endef
define BuildModule
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2010 OpenWrt.org
-
-START=50
-
-export PHP_FCGI_CHILDREN=''
-PORT=1026
-BIN=/usr/bin/php-fcgi
-
-start() {
- $BIN -b $PORT &
-}
-
-stop() {
- kill `pidof php-fcgi`
-}
--- /dev/null
+config php5-fastcgi
+ option enabled 1
+ option port '1026'
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+start_instance() {
+ local section="$1"
+ local enabled
+ local port
+
+ config_get_bool enabled "$section" 'enabled' 0
+ config_get port "$section" 'port' 1026
+
+ [ $enabled -gt 0 ] || return 1
+
+ PHP_FCGI_CHILDREN='' \
+ service_start /usr/bin/php-fcgi -b $port
+}
+
+start() {
+ config_load 'php5-fastcgi'
+ config_foreach start_instance 'php5-fastcgi'
+}
+
+stop() {
+ service_stop /usr/bin/php-fcgi
+}