wok view apache/receipt @ rev 12197

apache: add default value for certificate
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 26 16:24:33 2012 +0200 (2012-03-26)
parents f4bf102ffcf9
children a9c5a80d9106
line source
1 # SliTaz package receipt.
3 PACKAGE="apache"
4 VERSION="2.2.22"
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 pcre util-linux-ng-uuid expat zlib"
13 BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev sed expat-dev zlib-dev util-linux-ng-uuid-dev openldap-dev"
14 CONFIG_FILES="/etc/apache /var/www /etc/ssl/apache"
15 PROVIDE="lighttpd"
16 TAGS="webserver http server"
18 # Rules to configure and make the package.
19 compile_rules()
20 {
21 cd $src
22 grep -q Slitaz config.layout || \
23 cat $stuff/slitaz.layout >> config.layout
24 ./configure --mandir=/usr/share/man --enable-mods-shared=all \
25 --enable-proxy --enable-ssl \
26 --enable-layout=Slitaz $CONFIGURE_ARGS &&
27 make $MAKEFLAGS && make DESTDIR=$PWD/_pkg install
28 }
30 # Rules to gen a SliTaz package suitable for Tazpkg.
31 genpkg_rules()
32 {
33 mkdir -p $fs/usr/share/apache $fs/etc/init.d $fs/etc/apache/conf.d
34 mkdir -p $fs/etc/ssl/apache
35 cp -a $_pkg/usr/share/apache/icons $fs/usr/share/apache
36 cp -a $_pkg/usr/share/apache/error $fs/usr/share/apache
37 cp -a $_pkg/usr/share/apache/modules $fs/usr/share/apache
38 cp -a $_pkg/usr/bin $fs/usr
39 rm -r $fs/usr/bin/apxs
40 cp -a $_pkg/etc $fs
41 rm -rf $fs/etc/apache/original
42 cp -a $_pkg/var $fs
44 cp -a $stuff/apache $fs/etc/init.d
45 mkdir -p $fs/etc/apache/extra
46 cp -a $stuff/fix-range-CVE-2011-3192.conf $fs/etc/apache/extra
48 sed -i -e 's|User daemon|User www|' -e 's|Group daemon|Group www|' \
49 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
50 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
51 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
52 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
53 $fs/etc/apache/httpd.conf $fs/etc/apache/extra/httpd-ssl.conf
54 echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf
55 }
57 # Pre and post install commands for Tazpkg.
58 # We stop the server by default in case of upgarde.
59 pre_install()
60 {
61 echo "Processing pre-install commands..."
62 [ -z "$1" ] && [ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop
63 }
65 post_install()
66 {
67 local lang=$(. /etc/locale.conf 2>/dev/null; echo ${LANG#*_})
68 local tz=$(cat /etc/TZ 2>/dev/null)
69 local hostname=$(cat /etc/hostname 2>/dev/null)
70 echo "Processing post-install commands..."
71 # Just in case.
72 chown www.www $1/var/log/$PACKAGE
73 ping -c 2 $(hostname) > /dev/null 2>&1 ||
74 sed -i "s/localhost/$(hostname) localhost/" /etc/hosts
75 [ -s $1/etc/ssl/apache/apache.pem ] ||
76 openssl req -new -x509 -keyout $1/etc/ssl/apache/apache.pem \
77 -out $1/etc/ssl/apache/apache.pem -days 3650 -nodes <<EOT
78 ${lang:-us}
79 ${tz:-UTC}
81 ${hostname:-slitaz}
85 EOT
86 ( cd $1/$INSTALLED/ ; grep -l /etc/apache/conf.d/ */receipt ) | \
87 while read file; do
88 pkg=$(dirname $file)
89 [ "$pkg" = "$PACKAGE" ] && continue
90 echo "Reconfiguring $pkg for $PACKAGE..."
91 tazpkg reconfigure $pkg
92 done
93 if [ -z "$1" ]; then
94 for i in lighttpd ; do
95 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
96 done
97 /etc/init.d/$PACKAGE start
98 fi
99 }
101 # Rules to clean extras dirs or files
102 clean_wok()
103 {
104 rm -rf $WOK/$PACKAGE/${PACKAGE}.${VERSION}
105 }