From 3395aecae8ad9409090a9221c20ee80246811fca Mon Sep 17 00:00:00 2001 From: abveritas Date: Wed, 29 Sep 2010 03:11:14 +0000 Subject: [PATCH] Adding lighttpd, alight and fast web-server --- lighttpd/PKGBUILD | 66 +++++++++++++++++++++ lighttpd/lighttpd.conf | 13 +++++ lighttpd/lighttpd.rc.d | 126 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 lighttpd/PKGBUILD create mode 100644 lighttpd/lighttpd.conf create mode 100644 lighttpd/lighttpd.rc.d diff --git a/lighttpd/PKGBUILD b/lighttpd/PKGBUILD new file mode 100644 index 000000000..09565f25a --- /dev/null +++ b/lighttpd/PKGBUILD @@ -0,0 +1,66 @@ +# +# Chakra Packages for Chakra, part of chakra-project.org +# +# maintainer (i686): Phil Miller +# maintainer (x86_64): Manuel Tortosa + +# include global config +source ../_buildscripts/${current_repo}-${_arch}-cfg.conf + +pkgname=lighttpd +pkgver=1.4.28 +pkgrel=1 +pkgdesc='a secure, fast, compliant and very flexible web-server' +license=('custom') +arch=('i686' 'x86_64') +url="http://www.lighttpd.net/" +depends=('pcre' 'bzip2' 'libldap' 'util-linux-ng') +makedepends=('php-cgi' 'libmysqlclient' 'lua' 'libxml2' 'e2fsprogs' 'sqlite3' 'gdbm' 'pkgconfig') +optdepends=('libxml2: mod_webdav' + 'lua: mod_cml/mod_magnet' + 'libmysqlclient: mod_mysql_vhost' + 'sqlite3: mod_webdav') +backup=('etc/lighttpd/lighttpd.conf' 'etc/logrotate.d/lighttpd') +options=('!libtool' 'emptydirs') +source=("http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${pkgver}.tar.bz2" + 'lighttpd.rc.d' 'lighttpd.logrotate.d' 'lighttpd.conf') +md5sums=('586eb535d31ac299652495b058dd87c4' + '701141f42df90097bbfc5c7f1f63beb9' + '913e2157fa78d990c32146f387d44c2b' + '2803a9ee7f20409c69f1566d2d90720e') + +build() { + cd $srcdir/$pkgname-$pkgver + + ./configure --prefix=/usr \ + --libexecdir=/usr/lib/lighttpd/modules \ + --sysconfdir=/etc/lighttpd \ + --with-mysql \ + --with-ldap \ + --with-attr \ + --with-openssl \ + --with-kerberos5 \ + --without-fam \ + --with-webdav-props \ + --with-webdav-locks \ + --with-gdbm \ + --with-memcache \ + --with-lua + make +} + +package() { + cd $srcdir/$pkgname-$pkgver + make DESTDIR=$pkgdir install + + install -D -m755 $srcdir/lighttpd.rc.d $pkgdir/etc/rc.d/lighttpd + install -D -m644 $srcdir/lighttpd.logrotate.d $pkgdir/etc/logrotate.d/lighttpd + install -D -m644 $srcdir/lighttpd.conf $pkgdir/etc/lighttpd/lighttpd.conf + install -d -m755 -o http -g http $pkgdir/var/{run,log,cache}/lighttpd/ + + pushd doc/config >/dev/null + find . -type f ! -name 'Makefile*' -exec install -D -m644 {} ${pkgdir}/usr/share/doc/lighttpd/config/{} \; + popd >/dev/null + + install -D -m644 COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING +} diff --git a/lighttpd/lighttpd.conf b/lighttpd/lighttpd.conf new file mode 100644 index 000000000..8e8ab69e7 --- /dev/null +++ b/lighttpd/lighttpd.conf @@ -0,0 +1,13 @@ +# This is a minimal example config +# See /usr/share/doc/lighttpd +# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions + +server.port = 80 +server.username = "http" +server.groupname = "http" +server.document-root = "/srv/http" +server.pid-file = "/var/run/lighttpd/lighttpd.pid" +server.errorlog = "/var/log/lighttpd/error.log" +dir-listing.activate = "enable" +index-file.names = ( "index.html" ) +mimetype.assign = ( ".html" => "text/html", ".txt" => "text/plain", ".jpg" => "image/jpeg", ".png" => "image/png" ) diff --git a/lighttpd/lighttpd.rc.d b/lighttpd/lighttpd.rc.d new file mode 100644 index 000000000..c1efe41de --- /dev/null +++ b/lighttpd/lighttpd.rc.d @@ -0,0 +1,126 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + + +get_pid_file() { + /usr/sbin/lighttpd -p -f /etc/lighttpd/lighttpd.conf 2>/dev/null | grep server.pid-file | cut -d= -f2 +} + +get_pid() { + local pid_file=$(get_pid_file) + local pid=$(pidof -o %PPID lighttpd-angel) + # only needed when updating from 1.4.26 + # TODO: remove in future versions + local old_pid=$(pidof -o %PPID lighttpd) + if [ -r "${pid_file}" ]; then + cat "${pid_file}" + elif [ -n "${pid}" ]; then + echo "${pid}" + elif [ -n "${old_pid}" ]; then + echo "${old_pid}" + else + echo '' + fi +} + +test_config() { + stat_busy 'Checking configuration' + if [ $(id -u) -ne 0 ]; then + stat_append '(This script must be run as root)' + stat_die + fi + + if [ ! -r /etc/lighttpd/lighttpd.conf ]; then + stat_append '(/etc/lighttpd/lighttpd.conf not found)' + stat_die + fi + + local d + for d in /var/{run,log,cache}/lighttpd; do + if [ ! -d $d ]; then + stat_append "(directory $d not found)" + stat_die + fi + done + + /usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf >/dev/null 2>&1 + if [ $? -gt 0 ]; then + stat_append '(error in /etc/lighttpd/lighttpd.conf)' + stat_die + fi + + stat_done +} + +start() { + stat_busy 'Starting lighttpd' + + local PID=$(get_pid) + if [ -z "$PID" ]; then + nohup /usr/sbin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf >>/var/log/lighttpd/lighttpd-angel.log 2>&1 & + if [ $? -gt 0 ]; then + stat_die + else + add_daemon lighttpd + stat_done + fi + else + stat_die + fi +} + +stop() { + stat_busy 'Stopping lighttpd' + local PID=$(get_pid) + [ -n "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_die + else + local pid_file=$(get_pid_file) + [ -f "${pid_file}" ] && rm -f "${pid_file}" + rm_daemon lighttpd + stat_done + fi +} + +reload() { + stat_busy 'Reloading lighttpd' + local PID=$(get_pid) + [ -n "$PID" ] && kill -HUP $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_die + else + stat_done + fi +} + + +case "$1" in + start) + test_config + start + ;; + stop) + test_config + stop + ;; + reload) + test_config + reload + ;; + restart) + test_config + stop + start + ;; + status) + stat_busy 'Checking lighttpd status' + ck_status lighttpd + ;; + *) + echo "usage: $0 {start|stop|reload|restart|status}" +esac + +exit 0 -- GitLab