From 496fe638ddb82977bb02578cc9e1c39ffcc8c41e Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 16 May 2013 23:37:51 -0400 Subject: [PATCH] Ajout lighttpd (fonctionne avec PHP5) --- config/packages-list | 1 + stage5/bootscripts/lighttpd | 54 ++++++++++++++++++++++++++++++ stage5/hv-install-1 | 1 + stage5/packages-update | 1 + stage5/pkg/lighttpd | 67 +++++++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100755 stage5/bootscripts/lighttpd create mode 100644 stage5/pkg/lighttpd diff --git a/config/packages-list b/config/packages-list index 39c64ea..979bddc 100644 --- a/config/packages-list +++ b/config/packages-list @@ -246,6 +246,7 @@ LIBXKLAVIER="libxklavier-5.2.1" LIBXML2="libxml2-2.8.0" LIBXSLT="libxslt-1.1.26" LIBX264="x264-snapshot-20130416-2245" +LIGHTTPD="lighttpd-1.4.32" LILYPOND="lilypond-2.16.2" LLVM="llvm-3.1" LTSP_UTILS="ltsp-utils-0.25-0" diff --git a/stage5/bootscripts/lighttpd b/stage5/bootscripts/lighttpd new file mode 100755 index 0000000..ec92221 --- /dev/null +++ b/stage5/bootscripts/lighttpd @@ -0,0 +1,54 @@ +#!/bin/sh + +# lighttpd + +# Source functions library +source /etc/rc.d/init.d/functions + +log_script_name "$0 $*" + +# Check for missing binaries (stale symlinks should not happen) +LIGHTTPD_BIN=/usr/sbin/lighttpd + +if [ ! -x ${LIGHTTPD_BIN} ]; then + log_message "*** ERROR: ${LIGHTTPD_BIN} program not found." + exit ${EXIT_CODE_FAILURE} +fi + +# Check for existence of needed config file and read it +LIGHTTPD_CONFIG=/etc/sysconfig/lighttpd +if [ ! -r ${LIGHTTPD_CONFIG} ]; then + log_message "*** ERROR: ${LIGHTTPD_CONFIG} not found." + exit ${EXIT_CODE_FAILURE} +fi + +. $LIGHTTPD_CONFIG + +case "$1" in + start) + cmd_run_log_box "Starting Lighttpd server" \ + ${LIGHTTPD_BIN} -f ${LIGHTTPD_CONF_PATH} + ;; + + stop) + cmd_run_log_box "Stopping Lighttpd server" killproc ${LIGHTTPD_BIN} + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + status) + statusproc ${LIGHTTPD_BIN} + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit ${EXIT_CODE_FAILURE} + ;; + +esac + +exit $? diff --git a/stage5/hv-install-1 b/stage5/hv-install-1 index 5ed574b..8c049cd 100755 --- a/stage5/hv-install-1 +++ b/stage5/hv-install-1 @@ -185,6 +185,7 @@ ipkg -m acnb ${LIBFM} ipkg ${PCMANFM} ipkg -s apache ${HTTPD} # Apache +ipkg ${LIGHTTPD} ipkg ${PHP} if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then diff --git a/stage5/packages-update b/stage5/packages-update index fd7890f..a58186b 100755 --- a/stage5/packages-update +++ b/stage5/packages-update @@ -167,6 +167,7 @@ fpkg -m pm -s "K/KM/KMCGRAIL" ${SPAMASSASSIN} fpkg -e "tar.gz" ${UW_IMAP} "ftp://ftp.cac.washington.edu/imap" fpkg -m apa ${HTTPD} +fpkg -e "tar.bz2" ${LIGHTTPD} "http://download.lighttpd.net/lighttpd/releases-$(get_pkg_ver2 ${LIGHTTPD}).x" fpkg -e "tar.gz" ${SAMBA} "ftp://ftp.samba.org/pub/samba/old-versions" diff --git a/stage5/pkg/lighttpd b/stage5/pkg/lighttpd new file mode 100644 index 0000000..121db2b --- /dev/null +++ b/stage5/pkg/lighttpd @@ -0,0 +1,67 @@ +#!/bin/bash + +hvconfig_pre() +{ + groupadd -f ${APACHE_USER} + hv_useradd -c WebServer -d /dev/null -g ${APACHE_USER} -s /bin/false \ + ${APACHE_USER} +} + +hvbuild_post() +{ + cd ${LFS_TMP}/${PACKAGE} + + install -dv \ + /etc/lighttpd \ + /var/log/lighttpd \ + /var/lib/lighttpd \ + /var/lib/lighttpd/sockets \ + /var/cache/lighttpd + + cp -R doc/config/conf.d/ doc/config/*.conf doc/config/vhosts.d/ \ + /etc/lighttpd/ + + chown -R www.www \ + /etc/lighttpd \ + /var/log/lighttpd \ + /var/lib/lighttpd \ + /var/lib/lighttpd/sockets \ + /var/cache/lighttpd + + # Modifying the configuration file to run the server as a dedicated user: + sed -i \ + -e "s!^\(server\.username\).*!\1 = \"www\"!" \ + -e "s!^\(server\.groupname\).*!\1 = \"www\"!" \ + /etc/lighttpd/lighttpd.conf + + # Disable IPV6 + sed -i \ + -e "s!^\(server\.use-ipv6\).*!\1 = \"disable\"!" \ + /etc/lighttpd/lighttpd.conf + + # Enable fastgcgi module + sed -i \ + -e "s!^#\(include \"conf\.d/fastcgi\.conf\"\).*!\1!" \ + /etc/lighttpd/modules.conf + + + # astcgi config + cat > /etc/lighttpd/conf.d/fastcgi.conf << "EOF" && +server.modules += ( "mod_fastcgi" ) + +fastcgi.server = ( ".php" => (( + "bin-path" => "/usr/bin/php-cgi", + "socket" => socket_dir + "/php-fastcgi.socket" + ))) +EOF + + chown -v -R ${APACHE_USER}:${APACHE_USER} /srv/www + + # Bootscript + cp -p doc/initscripts/sysconfig.lighttpd /etc/sysconfig/lighttpd + + install -v -m740 ${SCRDIR}/bootscripts/lighttpd /etc/rc.d/init.d + + # script-name start stop + bootscript_add_rc3 lighttpd 70 20 +} -- 2.20.1