wok-6.x view apache/receipt @ rev 18958
apache: add /etc/apache/ssl/httpd-ssl.conf symlink (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Mar 09 08:46:50 2016 +0100 (2016-03-09) |
parents | 29d7f69c742c |
children | 12da1d122488 |
line source
1 # SliTaz package receipt.
3 PACKAGE="apache"
4 VERSION="2.4.16"
5 CATEGORY="network"
6 SHORT_DESC="Secure, efficient and extensible HTTP server."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="Apache"
9 SOURCE="httpd"
10 TARBALL="$SOURCE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.apache.org/"
12 WGET_URL="${WEB_SITE}dist/$SOURCE/$TARBALL"
13 CONFIG_FILES="/etc/apache /var/www /etc/ssl/apache"
14 TAZPANEL_DAEMON="edit::/etc/apache/httpd.conf|web::$WEB_SITE"
15 PROVIDE="lighttpd"
16 TAGS="webserver http server"
18 DEPENDS="apr-util apr openssl pcre util-linux-uuid expat zlib"
19 BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev sed expat-dev zlib-dev \
20 util-linux-uuid-dev openldap-dev bash"
22 # Rules to configure and make the package.
23 compile_rules()
24 {
25 grep -q Slitaz config.layout || \
26 cat $stuff/slitaz.layout >> config.layout
27 ./configure --mandir=/usr/share/man \
28 --enable-mods-shared=all \
29 --enable-proxy \
30 --enable-ssl \
31 --enable-layout=Slitaz $CONFIGURE_ARGS &&
32 make $MAKEFLAGS && make DESTDIR=$DESTDIR install
33 }
35 # Rules to gen a SliTaz package suitable for Tazpkg.
36 genpkg_rules()
37 {
38 mkdir -p $fs/usr/share/apache $fs/etc/init.d $fs/etc/apache/conf.d
39 mkdir -p $fs/etc/ssl/apache
40 cp -a $install/usr/share/apache/icons $fs/usr/share/apache
41 cp -a $install/usr/share/apache/error $fs/usr/share/apache
42 cp -a $install/usr/share/apache/modules $fs/usr/share/apache
43 cp -a $install/usr/bin $fs/usr
44 rm -r $fs/usr/bin/apxs
45 cp -a $install/etc $fs
46 rm -rf $fs/etc/apache/original
47 cp -a $install/var $fs
49 cp -a $stuff/apache $fs/etc/init.d
50 mkdir -p $fs/etc/apache/extra
51 cp -a $stuff/fix-range-CVE-2011-3192.conf $fs/etc/apache/extra
53 sed -i -e 's|User daemon|User www|' -e 's|Group daemon|Group www|' \
54 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
55 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
56 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
57 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
58 -e 's|#LoadModule ssl_module|LoadModule ssl_module|' \
59 $fs/etc/apache/httpd.conf $fs/etc/apache/extra/httpd-ssl.conf
60 echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf
61 sed -i 's/^SSLSessionCache /#&/' $fs/etc/apache/extra/httpd-ssl.conf
62 cat >> $fs/etc/apache/extra/httpd-ssl.conf <<EOT
64 # Unsafe, see CVE-2014-3566 POODLE
65 SSLProtocol All -SSLv2 -SSLv3
66 EOT
67 ln -s ../extra/httpd-ssl.conf $fs/etc/apache/ssl/httpd-ssl.conf
68 }
70 # Pre and post install commands for Tazpkg.
71 # We stop the server by default in case of upgarde.
72 pre_install()
73 {
74 [ -z "$1" ] && [ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop
75 }
77 post_install()
78 {
79 local lang=$(. $1/etc/locale.conf 2>/dev/null; echo ${LANG#*_})
80 local tz=$(cat $1/etc/TZ 2>/dev/null)
81 local hostname=$(cat $1/etc/hostname 2>/dev/null)
83 # Just in case.
84 chown www.www "$1/var/log/$PACKAGE"
85 ping -c 2 $(hostname) > /dev/null 2>&1 ||
86 sed -i "s/localhost/$(hostname) localhost/" "$1/etc/hosts"
87 sed -i -e "s/^#\(LoadModule.*slotmem_shm.*\)$/\1/" \
88 -e "s/.*ServerName www.example.*/ServerName ${hostname:-slitaz}/" \
89 $1/etc/apache/httpd.conf $1/etc/apache/ssl/httpd-ssl.conf
90 grep -qs Apache $1/var/www/index.html &&
91 sed -i 's|^LighTTPD.*|&\nApache configs : /etc/apache|' \
92 $1/var/www/index.html
93 [ -s "$1/etc/ssl/apache/apache.pem" ] ||
94 openssl req -new -x509 -keyout "$1/etc/ssl/apache/apache.pem" \
95 -out "$1/etc/ssl/apache/apache.pem" -days 3650 -nodes <<EOT
96 ${lang:-US}
97 ${tz:-Somewhere}
101 ${hostname:-slitaz}
103 EOT
104 [ -z "$quiet" ] && echo # Start new line
105 ( cd "$1/$INSTALLED/" ; grep -l /etc/apache/conf.d/ */receipt ) | \
106 while read file; do
107 pkg=$(dirname $file)
108 [ "$pkg" = "$PACKAGE" ] && continue
109 [ -z "$quiet" ] && echo "Reconfiguring $pkg for $PACKAGE..."
110 tazpkg reconfigure $pkg
111 done
112 [ -f "$1/etc/php.ini" ] && tazpkg get-install php-apache --root="$1"
113 [ "$1" ] || netstat -ltn 2> /dev/null | grep -q :80 ||
114 /etc/init.d/$PACKAGE start
115 }
117 # Rules to clean extras dirs or files
118 clean_wok()
119 {
120 rm -rf $WOK/$PACKAGE/${PACKAGE}.${VERSION}
121 }