wok annotate apache/receipt @ rev 1905
apache,lighttpd*: ensure only one web server is running
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Dec 21 10:51:14 2008 +0000 (2008-12-21) |
parents | cd99364b9f32 |
children | b42847caa337 |
rev | line source |
---|---|
pascal@1313 | 1 # SliTaz package receipt. |
pascal@1313 | 2 |
pascal@1313 | 3 PACKAGE="apache" |
pascal@1313 | 4 VERSION="2.2.9" |
pascal@1313 | 5 CATEGORY="network" |
pascal@1313 | 6 SHORT_DESC="Secure, efficient and extensible HTTP server." |
pascal@1313 | 7 MAINTAINER="pascal.bellard@slitaz.org" |
pascal@1313 | 8 SOURCE="httpd" |
pascal@1313 | 9 TARBALL="$SOURCE-$VERSION.tar.bz2" |
pascal@1313 | 10 WEB_SITE="http://www.apache.org/" |
pascal@1313 | 11 WGET_URL="${WEB_SITE}dist/$SOURCE/$TARBALL" |
pascal@1786 | 12 DEPENDS="apr-util apr openssl" |
pascal@1786 | 13 BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev" |
pascal@1313 | 14 CONFIG_FILES="/etc/apache /var/www" |
pascal@1572 | 15 PROVIDE="lighttpd" |
pascal@1313 | 16 |
pascal@1313 | 17 # Rules to configure and make the package. |
pascal@1313 | 18 compile_rules() |
pascal@1313 | 19 { |
pascal@1313 | 20 cd $src |
pascal@1313 | 21 grep -q Slitaz config.layout || \ |
pascal@1313 | 22 cat ../stuff/slitaz.layout >> config.layout |
pascal@1313 | 23 ./configure --mandir=/usr/share/man --enable-mods-shared=all \ |
pascal@1786 | 24 --enable-proxy --enable-ssl \ |
pascal@1658 | 25 --enable-layout=Slitaz $CONFIGURE_ARGS && |
pascal@1313 | 26 make && make DESTDIR=$PWD/_pkg install |
pascal@1313 | 27 } |
pascal@1313 | 28 |
pascal@1313 | 29 # Rules to gen a SliTaz package suitable for Tazpkg. |
pascal@1313 | 30 genpkg_rules() |
pascal@1313 | 31 { |
pascal@1313 | 32 mkdir -p $fs/usr/share/apache $fs/etc/init.d $fs/etc/apache/conf.d |
pascal@1794 | 33 mkdir -p $fs/etc/ssl/apache |
pascal@1313 | 34 cp -a $_pkg/usr/share/apache/icons $fs/usr/share/apache |
pascal@1313 | 35 cp -a $_pkg/usr/share/apache/error $fs/usr/share/apache |
pascal@1313 | 36 cp -a $_pkg/usr/share/apache/modules $fs/usr/share/apache |
pascal@1313 | 37 cp -a $_pkg/usr/bin $fs/usr |
pascal@1313 | 38 rm -r $fs/usr/bin/apxs |
pascal@1313 | 39 cp -a $_pkg/etc $fs |
pascal@1786 | 40 rm -rf $fs/etc/apache/original |
pascal@1313 | 41 cp -a $_pkg/var $fs |
pascal@1313 | 42 ln -s /usr/bin/apachectl $fs/etc/init.d/apache |
pascal@1313 | 43 sed -i -e 's|User daemon|User www|' -e 's|Group daemon|Group www|' \ |
pascal@1313 | 44 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \ |
pascal@1794 | 45 -e 's|mod_rewrite.so|mod_rewrite.so\nLoadModule ssl_module share/apache/modules/mod_ssl.so\nLoadModule proxy_module share/apache/modules/mod_proxy.so\nLoadModule proxy_http_module share/apache/modules/mod_proxy_http.so|' \ |
pascal@1794 | 46 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \ |
pascal@1794 | 47 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \ |
pascal@1794 | 48 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \ |
pascal@1794 | 49 $fs/etc/apache/httpd.conf $fs/etc/apache/extra/httpd-ssl.conf |
pascal@1313 | 50 echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf |
pascal@1313 | 51 # Cook all packages based on apache |
pascal@1313 | 52 for i in $(cd $WOK; ls -d apache-*) |
pascal@1313 | 53 do |
pascal@1313 | 54 tazwok genpkg $i |
pascal@1313 | 55 done |
pascal@1313 | 56 } |
pascal@1313 | 57 |
pascal@1313 | 58 # Pre and post install commands for Tazpkg. |
pascal@1313 | 59 # We stop the server by default in case of upgarde. |
pascal@1313 | 60 pre_install() |
pascal@1313 | 61 { |
pascal@1313 | 62 echo "Processing pre-install commands..." |
pascal@1794 | 63 [ -z "$1" ] && [ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop |
pascal@1313 | 64 } |
pascal@1313 | 65 |
pascal@1313 | 66 post_install() |
pascal@1313 | 67 { |
pascal@1313 | 68 echo "Processing post-install commands..." |
pascal@1313 | 69 # Just in case. |
pascal@1313 | 70 chown www.www $1/var/log/$PACKAGE |
pascal@1658 | 71 ping -c 2 $(hostname) > /dev/null 2>&1 || |
pascal@1658 | 72 sed -i "s/localhost/$(hostname) localhost/" /etc/hosts |
pascal@1794 | 73 openssl req -new -x509 -keyout $1/etc/ssl/apache/apache.pem \ |
pascal@1794 | 74 -out $1/etc/ssl/apache/apache.pem -days 3650 -nodes <<EOT |
pascal@1794 | 75 $(. /etc/locale.conf ; echo ${LANG#*_}) |
pascal@1794 | 76 $(cat /etc/TZ) |
pascal@1794 | 77 |
pascal@1794 | 78 $(cat /etc/hostname) |
pascal@1794 | 79 |
pascal@1794 | 80 |
pascal@1794 | 81 |
pascal@1794 | 82 EOT |
pascal@1905 | 83 if [ -z "$1" ]; then |
pascal@1905 | 84 for i in lighttpd ; do |
pascal@1905 | 85 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop |
pascal@1905 | 86 done |
pascal@1905 | 87 /etc/init.d/$PACKAGE start |
pascal@1905 | 88 fi |
pascal@1313 | 89 } |
pascal@1313 | 90 |
pascal@1313 | 91 # Rules to clean extras dirs or files |
pascal@1313 | 92 clean_wok() |
pascal@1313 | 93 { |
pascal@1313 | 94 rm -rf $WOK/$PACKAGE/${PACKAGE}.${VERSION} |
pascal@1313 | 95 } |