From eae603ee41cf522828c07a4e8c490f4522d97800 Mon Sep 17 00:00:00 2001 From: Cherife Li Date: Tue, 11 May 2010 20:01:39 +0200 Subject: network/nginx: Added to 12.0 repository --- network/nginx/README | 2 + network/nginx/doinst.sh | 22 +++++++++ network/nginx/nginx.SlackBuild | 100 +++++++++++++++++++++++++++++++++++++++++ network/nginx/nginx.info | 8 ++++ network/nginx/rc.nginx | 90 +++++++++++++++++++++++++++++++++++++ network/nginx/slack-desc | 19 ++++++++ 6 files changed, 241 insertions(+) create mode 100644 network/nginx/README create mode 100644 network/nginx/doinst.sh create mode 100644 network/nginx/nginx.SlackBuild create mode 100644 network/nginx/nginx.info create mode 100644 network/nginx/rc.nginx create mode 100644 network/nginx/slack-desc diff --git a/network/nginx/README b/network/nginx/README new file mode 100644 index 0000000000..5b1c8f1e45 --- /dev/null +++ b/network/nginx/README @@ -0,0 +1,2 @@ +nginx [engine x] is a high-performance HTTP server and reverse proxy +as well as an IMAP/POP3 proxy server. diff --git a/network/nginx/doinst.sh b/network/nginx/doinst.sh new file mode 100644 index 0000000000..9641df3888 --- /dev/null +++ b/network/nginx/doinst.sh @@ -0,0 +1,22 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.nginx.new: +if [ -e etc/rc.d/rc.nginx ]; then + cp -a etc/rc.d/rc.nginx etc/rc.d/rc.nginx.new.incoming + cat etc/rc.d/rc.nginx.new > etc/rc.d/rc.nginx.new.incoming + mv etc/rc.d/rc.nginx.new.incoming etc/rc.d/rc.nginx.new +fi + +config etc/rc.d/rc.nginx.new + diff --git a/network/nginx/nginx.SlackBuild b/network/nginx/nginx.SlackBuild new file mode 100644 index 0000000000..5cbca65656 --- /dev/null +++ b/network/nginx/nginx.SlackBuild @@ -0,0 +1,100 @@ +#!/bin/sh +# +# Building nginx in the Slackware way. +# +# Notes: +# + Don't forget to check the VERSION number. +# + You may want to customize the configure options. +# +# Written by Cherife Li . +# + +PRGNAM=nginx +VERSION=0.6.28 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +NGINXUSER=${NGINXUSER:-nobody} +NGINXGROUP=${NGINXGROUP:-nobody} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sbin-path=/usr/sbin/nginx \ + --conf-path=/etc/nginx/nginx.conf \ + --error-log-path=/var/log/nginx_error.log \ + --pid-path=/var/run/nginx.pid \ + --lock-path=/var/lock/nginx \ + --user=$NGINXUSER \ + --group=$NGINXGROUP \ + --with-http_ssl_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_sub_module \ + --with-http_stub_status_module \ + --without-http_proxy_module \ + --http-log-path=/var/log/nginx_access.log \ + --http-client-body-temp-path=/var/spool/nginx_client_body_temp \ + --http-proxy-temp-path=/var/spool/nginx_proxy_temp \ + --http-fastcgi-temp-path=/dev/shm \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --with-debug + +make +make install DESTDIR=$PKG + +mkdir -p $PKG/etc/{nginx,rc.d} $PKG/usr/sbin \ + $PKG/var/spool/{nginx_client_body_temp,nginx_proxy_temp} +cp $CWD/rc.nginx $PKG/etc/rc.d/rc.nginx.new +cp -a conf/* $PKG/etc/nginx +cp -a objs/nginx $PKG/usr/sbin/nginx + +mkdir -p $PKG/usr/doc/nginx-$VERSION +cp -a CHANGES CHANGES.ru LICENSE README $PKG/usr/doc/nginx-$VERSION +cat $CWD/nginx.SlackBuild > $PKG/usr/doc/nginx-$VERSION/nginx.SlackBuild + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +# Let's not clobber config files on upgrade +cd $PKG/etc/nginx + for i in fastcgi_params koi-utf koi-win mime.types nginx.conf win-utf ; do + mv $i $i.new ; + echo "config etc/nginx/$i.new" >> $PKG/install/doinst.sh ; + done +cd - + +cd $PKG +makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/network/nginx/nginx.info b/network/nginx/nginx.info new file mode 100644 index 0000000000..1f353271e6 --- /dev/null +++ b/network/nginx/nginx.info @@ -0,0 +1,8 @@ +PRGNAM="nginx" +VERSION="0.6.28" +HOMEPAGE="http://nginx.net/" +DOWNLOAD="http://sysoev.ru/nginx/nginx-0.6.28.tar.gz" +MD5SUM="b99301acf8da1fd8036343accdbefb7d" +MAINTAINER="Cherife Li" +EMAIL="cherife@dotimes.com" +APPROVED="rworkman" diff --git a/network/nginx/rc.nginx b/network/nginx/rc.nginx new file mode 100644 index 0000000000..5483458425 --- /dev/null +++ b/network/nginx/rc.nginx @@ -0,0 +1,90 @@ +#!/bin/sh +# +# Nginx daemon control script. +# +# This is an init script for the nginx daemon. +# To use nginx, you must first set up the config file(s). +# +# Written for Slackware Linux by Cherife Li . +# + +DAEMON=/usr/sbin/nginx +CONF=/etc/nginx/nginx.conf +PID=/var/run/nginx.pid + +nginx_start() { + # Sanity checks. + if [ ! -r $CONF ]; then # no config file, exit: + echo "Please check the nginx config file, exiting..." + exit 1 + fi + + if [ -f $PID ]; then + echo "Nging is already running?" + exit 1 + fi + + echo "Starting Nginx server daemon:" + if [ -x $DAEMON ]; then + $DAEMON -c $CONF + fi +} + +nginx_test_conf() { + echo -e "Checking configuration for correct syntax and\nthen trying to open files referenced in configuration..." + $DAEMON -t -c $CONF +} + +nginx_term() { + echo "Shutdown Nginx quickly..." + kill -TERM $(cat $PID) +} + +nginx_quit() { + echo "Shutdown Nginx gracefully..." + kill -QUIT $(cat $PID) +} + +nginx_reload() { + echo "Reloading Nginx configuration..." + kill -HUP $(cat $PID) +} + +nginx_upgrade() { + echo -e "Upgrading to the new Nginx binary.\nMake sure the Nginx binary has been replaced with new one\nor Nginx server modules were added/removed." + kill -USR2 $(cat $PID) + sleep 3 + kill -QUIT $(cat $PID.oldbin) +} + +nginx_restart() { + nginx_quit + sleep 5 + nginx_start +} + +case "$1" in +'start') + nginx_start + ;; +'term') + nginx_term + ;; +'quit') + nginx_quit + ;; +'stop') + nginx_quit + ;; +'reload') + nginx_reload + ;; +'restart') + nginx_restart + ;; +'upgrade') + nginx_upgrade + ;; +*) + echo "usage $0 start|term|quit(stop)|reload|restart|upgrade" +esac diff --git a/network/nginx/slack-desc b/network/nginx/slack-desc new file mode 100644 index 0000000000..de2d8a147d --- /dev/null +++ b/network/nginx/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +nginx: nginx (http/imap/pop3 proxy) +nginx: +nginx: Nginx [engine x] is a high-performance HTTP server and reverse proxy, +nginx: as well as an IMAP/POP3 proxy server. +nginx: +nginx: Nginx was written by Igor Sysoev. +nginx: +nginx: +nginx: +nginx: +nginx: -- cgit v1.2.3