wok-next view apache/receipt @ rev 21724

busybox: update configs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 01 11:04:25 2020 +0000 (2020-09-01)
parents e19ff076dc63
children
line source
1 # SliTaz package receipt v2.
3 PACKAGE="apache"
4 VERSION="2.4.43"
5 CATEGORY="network"
6 TAGS="webserver http server"
7 SHORT_DESC="Secure, efficient and extensible HTTP server"
8 MAINTAINER="pascal.bellard@slitaz.org"
9 LICENSE="Apache"
10 WEB_SITE="http://www.apache.org/"
12 TARBALL="httpd-$VERSION.tar.bz2"
13 WGET_URL="http://www.apache.org/dist/httpd/$TARBALL"
15 BUILD_DEPENDS="apr-dev apr-util-dev bash expat-dev openldap-dev
16 openssl-dev pcre-dev sed util-linux-uuid-dev zlib-dev"
17 SPLIT="$PACKAGE-dev $PACKAGE-doc $PACKAGE"
19 COOKOPTS="force-arch" # different configs in dev
21 compile_rules()
22 {
23 grep -q Slitaz config.layout || \
24 cat $stuff/slitaz.layout >> config.layout
25 sed -i 's|mkdir |mkdir -p |' \
26 build/mkdir.sh
28 ./configure \
29 --mandir=/usr/share/man \
30 --enable-layout=Slitaz \
31 --enable-mods-shared=all \
32 --enable-proxy \
33 --enable-ssl \
34 $CONFIGURE_ARGS &&
35 make $MAKEFLAGS &&
36 make DESTDIR=$install install || return 1
38 install -Dm755 $stuff/apache $install/etc/init.d/apache
40 mkdir -p $install/etc/apache/extra/
41 cp -a $stuff/fix-range-CVE-2011-3192.conf $install/etc/apache/extra/
43 sed -i \
44 -e 's|User daemon|User www|' \
45 -e 's|Group daemon|Group www|' \
46 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
47 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
48 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
49 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
50 -e 's|#LoadModule ssl_module|LoadModule ssl_module|' \
51 $install/etc/apache/httpd.conf \
52 $install/etc/apache/extra/httpd-ssl.conf
54 echo "Include /etc/apache/conf.d" >> $install/etc/apache/httpd.conf
55 sed -i 's/^SSLSessionCache /#&/' $install/etc/apache/extra/httpd-ssl.conf
56 cat >> $install/etc/apache/extra/httpd-ssl.conf <<EOT
58 # Unsafe, see CVE-2014-3566 POODLE
59 SSLProtocol All -SSLv2 -SSLv3
60 EOT
62 chown -R root:root $install
63 }
65 genpkg_rules()
66 {
67 case $PACKAGE in
68 apache-dev)
69 copy @dev apxs /usr/share/apache/build/
70 rm -r $fs/usr/share/apache/error/ # here folder 'include'
71 ;;
72 apache-doc)
73 copy /usr/share/doc/
74 CAT="development|documentation"
75 ;;
76 apache)
77 copy @std @rm /usr/share/apache/error/include/
78 rm -rf $fs/etc/apache/original/
79 CONFIG_FILES="/etc/apache/ /var/www/ /etc/ssl/apache/"
80 TAZPANEL_DAEMON="edit::/etc/apache/httpd.conf|web::$WEB_SITE"
81 PROVIDE="lighttpd"
82 DEPENDS="apr apr-util libldap libpcre openssl zlib"
83 ;;
84 esac
85 }
87 # We stop the server by default in case of upgarde.
88 pre_install_apache()
89 {
90 [ -n "$1" ] ||
91 for i in httpd lighttpd ngnix cherokee $PACKAGE
92 do
93 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
94 done
95 }
97 post_install_apache()
98 {
99 local lang=$(. $1/etc/locale.conf 2>/dev/null; echo ${LANG#*_})
100 local tz=$(cat $1/etc/TZ 2>/dev/null)
101 local hostname=$(cat $1/etc/hostname 2>/dev/null)
103 # Just in case.
104 chown www.www "$1/var/log/$PACKAGE"
106 ping -c 2 $(hostname) >/dev/null 2>&1 ||
107 sed -i "s/localhost/$(hostname) localhost/" "$1/etc/hosts"
109 sed -i -e "s/^#\(LoadModule.*slotmem_shm.*\)$/\1/" \
110 -e "s/.*ServerName www.example.*/ServerName ${hostname:-slitaz}/" \
111 $1/etc/apache/httpd.conf \
112 $1/etc/apache/extra/httpd-ssl.conf
114 grep -qs Apache $1/var/www/index.html &&
115 sed -i 's|^LighTTPD.*|&\nApache configs : /etc/apache|' \
116 $1/var/www/index.html
118 [ -s "$1/etc/ssl/apache/apache.pem" ] ||
119 openssl req -new -x509 -keyout "$1/etc/ssl/apache/apache.pem" \
120 -out "$1/etc/ssl/apache/apache.pem" -days 3650 -nodes <<EOT
121 ${lang:-US}
122 ${tz:-Somewhere}
126 ${hostname:-slitaz}
128 EOT
130 [ -z "$quiet" ] && echo # Start new line
131 ( cd "$1/$INSTALLED/"; grep -l /etc/apache/conf.d/ */receipt ) | \
132 while read file
133 do
134 pkg=$(dirname $file)
135 [ "$pkg" = "$PACKAGE" ] && continue
136 [ -z "$quiet" ] && echo "Reconfiguring $pkg for $PACKAGE..."
137 tazpkg reconfigure $pkg
138 done
139 [ -f "$1/etc/php.ini" ] && tazpkg get-install php-apache --root="$1"
140 [ "$1" ] || netstat -ltn 2> /dev/null | grep -q :80 ||
141 /etc/init.d/$PACKAGE start
142 }