[package] add spawn-fcgi, thanks to Raphael Huck (#4738)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@14824 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
4dea6a9e1e
commit
bce21a2f0c
41
net/spawn-fcgi/Makefile
Normal file
41
net/spawn-fcgi/Makefile
Normal file
@ -0,0 +1,41 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=spawn-fcgi
|
||||
PKG_VERSION:=1.6.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://www.lighttpd.net/download/
|
||||
PKG_MD5SUM:=06fcafdb87aeb5dc9b8f0f91632ae748
|
||||
|
||||
PKG_FIXUP = libtool
|
||||
PKG_INSTALL = 1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/spawn-fcgi
|
||||
SUBMENU:=Web
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Tool to spawn fastcgi applications
|
||||
URL:=http://www.lighttpd.net/
|
||||
endef
|
||||
|
||||
define Package/spawn-fcgi/description
|
||||
spawn-fcgi is used to spawn fastcgi applications
|
||||
endef
|
||||
|
||||
define Package/spawn-fcgi/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/spawn-fcgi $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,spawn-fcgi))
|
@ -0,0 +1,60 @@
|
||||
diff -pruN spawn-fcgi-1.6.0.orig/src/spawn-fcgi.c spawn-fcgi-1.6.0/src/spawn-fcgi.c
|
||||
--- spawn-fcgi-1.6.0.orig/src/spawn-fcgi.c 2009-03-05 16:43:00.160440493 +0100
|
||||
+++ spawn-fcgi-1.6.0/src/spawn-fcgi.c 2009-03-05 16:55:17.840995588 +0100
|
||||
@@ -59,7 +59,7 @@
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
-static int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int fork_count, int child_count, int pid_fd, int nofork) {
|
||||
+static int fcgi_spawn_connection(char *appPath, const char *fcgi_dir, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int fork_count, int child_count, int pid_fd, int nofork) {
|
||||
int fcgi_fd;
|
||||
int socket_type, status, rc = 0;
|
||||
struct timeval tv = { 0, 100 * 1000 };
|
||||
@@ -206,6 +206,11 @@ static int fcgi_spawn_connection(char *a
|
||||
strcat(b, appPath);
|
||||
|
||||
/* exec the cgi */
|
||||
+ if (fcgi_dir) {
|
||||
+ if (chdir(fcgi_dir) != 0) {
|
||||
+ exit(errno);
|
||||
+ }
|
||||
+ }
|
||||
execl("/bin/sh", "sh", "-c", b, (char *)NULL);
|
||||
}
|
||||
|
||||
@@ -347,6 +352,7 @@ static void show_help () {
|
||||
"\n" \
|
||||
"Options:\n" \
|
||||
" -f <path> filename of the fcgi-application (ignored if <fcgiapp> is given)\n" \
|
||||
+" -d <dir> chdir to directory before spawning\n" \
|
||||
" -a <addr> bind to ip address\n" \
|
||||
" -p <port> bind to tcp-port\n" \
|
||||
" -s <path> bind to unix-domain socket\n" \
|
||||
@@ -367,7 +373,7 @@ static void show_help () {
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
- char *fcgi_app = NULL, *changeroot = NULL, *username = NULL,
|
||||
+ char *fcgi_app = NULL, *fcgi_dir = NULL, *changeroot = NULL, *username = NULL,
|
||||
*groupname = NULL, *unixsocket = NULL, *pid_file = NULL,
|
||||
*addr = NULL;
|
||||
char **fcgi_app_argv = { NULL };
|
||||
@@ -386,9 +392,10 @@ int main(int argc, char **argv) {
|
||||
|
||||
i_am_root = (getuid() == 0);
|
||||
|
||||
- while (-1 != (o = getopt(argc, argv, "c:f:g:?hna:p:u:vC:F:s:P:"))) {
|
||||
+ while (-1 != (o = getopt(argc, argv, "c:f:d:g:?hna:p:u:vC:F:s:P:"))) {
|
||||
switch(o) {
|
||||
case 'f': fcgi_app = optarg; break;
|
||||
+ case 'd': fcgi_dir = optarg; break;
|
||||
case 'a': addr = optarg;/* ip addr */ break;
|
||||
case 'p': port = strtol(optarg, NULL, 10);/* port */ break;
|
||||
case 'C': child_count = strtol(optarg, NULL, 10);/* */ break;
|
||||
@@ -507,5 +514,5 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
- return fcgi_spawn_connection(fcgi_app, fcgi_app_argv, addr, port, unixsocket, fork_count, child_count, pid_fd, nofork);
|
||||
+ return fcgi_spawn_connection(fcgi_app, fcgi_dir, fcgi_app_argv, addr, port, unixsocket, fork_count, child_count, pid_fd, nofork);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user