wok-current view apache/receipt @ rev 3984

Up: squid* (3.0STABLE18)
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Fri Aug 28 13:16:05 2009 +0000 (2009-08-28)
parents 56777a448469
children 0588160a6878
line source
1 # SliTaz package receipt.
3 PACKAGE="apache"
4 VERSION="2.2.11"
5 CATEGORY="network"
6 SHORT_DESC="Secure, efficient and extensible HTTP server."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 SOURCE="httpd"
9 TARBALL="$SOURCE-$VERSION.tar.bz2"
10 WEB_SITE="http://www.apache.org/"
11 WGET_URL="${WEB_SITE}dist/$SOURCE/$TARBALL"
12 DEPENDS="apr-util apr openssl libuuid expat zlib"
13 BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev"
14 CONFIG_FILES="/etc/apache /var/www /etc/ssl/apache"
15 PROVIDE="lighttpd"
17 # Rules to configure and make the package.
18 compile_rules()
19 {
20 cd $src
21 grep -q Slitaz config.layout || \
22 cat ../stuff/slitaz.layout >> config.layout
23 ./configure --mandir=/usr/share/man --enable-mods-shared=all \
24 --enable-proxy --enable-ssl \
25 --enable-layout=Slitaz $CONFIGURE_ARGS &&
26 make && make DESTDIR=$PWD/_pkg install
27 }
29 # Rules to gen a SliTaz package suitable for Tazpkg.
30 genpkg_rules()
31 {
32 mkdir -p $fs/usr/share/apache $fs/etc/init.d $fs/etc/apache/conf.d
33 mkdir -p $fs/etc/ssl/apache
34 cp -a $_pkg/usr/share/apache/icons $fs/usr/share/apache
35 cp -a $_pkg/usr/share/apache/error $fs/usr/share/apache
36 cp -a $_pkg/usr/share/apache/modules $fs/usr/share/apache
37 cp -a $_pkg/usr/bin $fs/usr
38 rm -r $fs/usr/bin/apxs
39 cp -a $_pkg/etc $fs
40 rm -rf $fs/etc/apache/original
41 cp -a $_pkg/var $fs
42 cat > $fs/etc/init.d/apache <<EOT
43 #!/bin/sh
45 . /etc/init.d/rc.functions
46 active_pidfile /var/run/apache/httpd.pid httpd
48 exec /usr/bin/apachectl "\$@"
49 EOT
50 chmod +x $fs/etc/init.d/apache
51 sed -i -e 's|User daemon|User www|' -e 's|Group daemon|Group www|' \
52 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
53 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
54 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
55 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
56 $fs/etc/apache/httpd.conf $fs/etc/apache/extra/httpd-ssl.conf
57 echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf
58 # Cook all packages based on apache
59 for i in $(cd $WOK; ls -d apache-*)
60 do
61 tazwok genpkg $i
62 done
63 }
65 # Pre and post install commands for Tazpkg.
66 # We stop the server by default in case of upgarde.
67 pre_install()
68 {
69 echo "Processing pre-install commands..."
70 [ -z "$1" ] && [ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop
71 }
73 post_install()
74 {
75 echo "Processing post-install commands..."
76 # Just in case.
77 chown www.www $1/var/log/$PACKAGE
78 ping -c 2 $(hostname) > /dev/null 2>&1 ||
79 sed -i "s/localhost/$(hostname) localhost/" /etc/hosts
80 openssl req -new -x509 -keyout $1/etc/ssl/apache/apache.pem \
81 -out $1/etc/ssl/apache/apache.pem -days 3650 -nodes <<EOT
82 $(. /etc/locale.conf ; echo ${LANG#*_})
83 $(cat /etc/TZ)
85 $(cat /etc/hostname)
89 EOT
90 ( cd $1/$INSTALLED/ ; grep -l /etc/apache/conf.d/ */receipt ) | \
91 while read file; do
92 pkg=$(dirname $file)
93 [ "$pkg" = "$PACKAGE" ] && continue
94 echo "Reconfiguring $pkg for $PACKAGE..."
95 tazpkg reconfigure $pkg
96 done
97 if [ -z "$1" ]; then
98 for i in lighttpd ; do
99 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
100 done
101 /etc/init.d/$PACKAGE start
102 fi
103 }
105 # Rules to clean extras dirs or files
106 clean_wok()
107 {
108 rm -rf $WOK/$PACKAGE/${PACKAGE}.${VERSION}
109 }