wok rev 10450

Add nginx
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed May 25 10:38:55 2011 +0200 (2011-05-25)
parents 7a0a615d3b4a
children 7edc3ef163ed
files nginx/receipt nginx/stuff/etc/init.d/nginx
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nginx/receipt	Wed May 25 10:38:55 2011 +0200
     1.3 @@ -0,0 +1,91 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="nginx"
     1.7 +VERSION="0.7.65"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="Asynchronous HTTP server designed for heavy loads + mail proxy."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +SUGGESTED="php perl python"
    1.12 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.13 +WEB_SITE="http://nginx.org/"
    1.14 +WGET_URL="${WEB_SITE}download//$TARBALL"
    1.15 +DEPENDS="pcre openssl zlib"
    1.16 +BUILD_DEPENDS="pcre-dev openssl-dev zlib-dev"
    1.17 +CONFIG_FILES="/etc/nginx"
    1.18 +
    1.19 +# Rules to configure and make the package.
    1.20 +compile_rules()
    1.21 +{
    1.22 +	cd $src
    1.23 +
    1.24 +#  --with-rtsig_module                enable rtsig module
    1.25 +#  --with-select_module               enable select module
    1.26 +#  --with-poll_module                 enable poll module
    1.27 +#  --with-ipv6                        enable ipv6 support
    1.28 +#  --with-http_realip_module          enable ngx_http_realip_module
    1.29 +#  --with-http_addition_module        enable ngx_http_addition_module
    1.30 +#  --with-http_xslt_module            enable ngx_http_xslt_module
    1.31 +#  --with-http_image_filter_module    enable ngx_http_image_filter_module
    1.32 +#  --with-http_geoip_module           enable ngx_http_geoip_module
    1.33 +#  --with-http_sub_module             enable ngx_http_sub_module
    1.34 +#  --with-http_random_index_module    enable ngx_http_random_index_module
    1.35 +#  --with-http_secure_link_module     enable ngx_http_secure_link_module
    1.36 +#  --with-http_perl_module            enable ngx_http_perl_module
    1.37 +#  --with-google_perftools_module     enable ngx_google_perftools_module
    1.38 +
    1.39 +	./configure --prefix=/usr \
    1.40 +		--conf-path=/etc/nginx/nginx.conf \
    1.41 +		--pid-path=/var/run/nginx.pid \
    1.42 +		--lock-path=/var/lock/nginx.lock \
    1.43 +		--error-log-path=/var/log/nginx/error.log \
    1.44 +		--http-log-path=/var/log/nginx/access.log \
    1.45 +		--http-client-body-temp-path=/var/spool/nginx/body \
    1.46 +		--http-proxy-temp-path=/var/spool/nginx/proxy \
    1.47 +		--http-fastcgi-temp-path=/var/spool/nginx/fastcgi \
    1.48 +		--with-http_stub_status_module \
    1.49 +		--with-http_flv_module \
    1.50 +		--with-http_ssl_module \
    1.51 +		--with-http_dav_module \
    1.52 +		--with-mail --with-mail_ssl_module \
    1.53 +		--user=80 --group=80 &&
    1.54 +	make &&
    1.55 +	make DESTDIR=$PWD/_pkg install
    1.56 +}
    1.57 +
    1.58 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.59 +# On SliTaz Lighttpd runs as user/group : www/www or 80/80.
    1.60 +genpkg_rules()
    1.61 +{
    1.62 +	cp -a $_pkg/* $fs/
    1.63 +	rm -rf $fs/usr/html
    1.64 +	cp -a stuff/* $fs
    1.65 +}
    1.66 +
    1.67 +# Pre and post install commands for Tazpkg.
    1.68 +# We stop the server by default in case of upgarde.
    1.69 +pre_install()
    1.70 +{
    1.71 +	echo "Processing pre-install commands..."
    1.72 +	[ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop
    1.73 +	# Backup config file.
    1.74 +	if [ -d $1/$CONFIG_FILES ]; then
    1.75 +		cp -a $1/$CONFIG_FILES $1/$CONFIG_FILES.bak
    1.76 +	fi
    1.77 +}
    1.78 +post_install()
    1.79 +{
    1.80 +	echo "Processing post-install commands..."
    1.81 +	# Restore original config.
    1.82 +	if [ -d $1/$CONFIG_FILES.bak ]; then
    1.83 +		rm -rf $1/$CONFIG_FILES
    1.84 +		mv $1/$CONFIG_FILES.bak $1/$CONFIG_FILES
    1.85 +	fi
    1.86 +	# Just in case.
    1.87 +	chown www.www $1/var/log/$PACKAGE
    1.88 +	if [ -z "$1" ]; then
    1.89 +		for i in apache lighttpd ; do
    1.90 +			[ -f /etc/init.d/$i ] && /etc/init.d/$i stop
    1.91 +		done
    1.92 +		/etc/init.d/$PACKAGE start
    1.93 +	fi
    1.94 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/nginx/stuff/etc/init.d/nginx	Wed May 25 10:38:55 2011 +0200
     2.3 @@ -0,0 +1,55 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/nginx: Start, stop and restart web server on SliTaz, 
     2.6 +# at boot time or with the command line. Daemons options are configured
     2.7 +# with /etc/daemons.conf
     2.8 +#
     2.9 +. /etc/init.d/rc.functions
    2.10 +. /etc/daemons.conf
    2.11 +
    2.12 +NAME=Nginx
    2.13 +DESC="web server"
    2.14 +DAEMON=/usr/sbin/nginx
    2.15 +OPTIONS=$NGINX_OPTIONS
    2.16 +PIDFILE=/var/run/nginx.pid
    2.17 +
    2.18 +case "$1" in
    2.19 +  start)
    2.20 +    if active_pidfile $PIDFILE nginx ; then
    2.21 +      echo "$NAME already running."
    2.22 +      exit 1
    2.23 +    fi
    2.24 +    echo -n "Starting $DESC: $NAME... "
    2.25 +    $DAEMON $OPTIONS 
    2.26 +    status
    2.27 +    ;;
    2.28 +  stop)
    2.29 +    if ! active_pidfile $PIDFILE nginx ; then
    2.30 +      echo "$NAME is not running."
    2.31 +      exit 1
    2.32 +    fi
    2.33 +    echo -n "Stopping $DESC: $NAME... "
    2.34 +    kill `cat $PIDFILE`
    2.35 +    rm $PIDFILE
    2.36 +    status
    2.37 +    ;;
    2.38 +  restart)
    2.39 +    if ! active_pidfile $PIDFILE nginx ; then
    2.40 +      echo "$NAME is not running."
    2.41 +      exit 1
    2.42 +    fi
    2.43 +    echo -n "Restarting $DESC: $NAME... "
    2.44 +    kill `cat $PIDFILE`
    2.45 +    rm $PIDFILE
    2.46 +    sleep 2
    2.47 +    $DAEMON $OPTIONS
    2.48 +    status
    2.49 +    ;;
    2.50 +  *)
    2.51 +    echo ""
    2.52 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    2.53 +    echo ""
    2.54 +    exit 1
    2.55 +    ;;
    2.56 +esac
    2.57 +
    2.58 +exit 0