wok-next view apache/receipt @ rev 20237

Add Qt5 applications: notes, qtav, miam-player
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Nov 06 15:59:23 2017 +0200 (2017-11-06)
parents 960e637ef071
children 577783a50854
line source
1 # SliTaz package receipt v2.
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"
14 BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev sed expat-dev zlib-dev \
15 util-linux-uuid-dev openldap-dev bash pcre-dev"
16 SPLIT="apache apache-dev apache-doc"
18 # Rules to configure and make the package.
19 compile_rules()
20 {
21 grep -q Slitaz config.layout || \
22 cat $stuff/slitaz.layout >> config.layout
23 ./configure --mandir=/usr/share/man \
24 --enable-mods-shared=all \
25 --enable-proxy \
26 --enable-ssl \
27 --enable-layout=Slitaz $CONFIGURE_ARGS &&
28 make $MAKEFLAGS && make DESTDIR=$DESTDIR install
29 }
31 # Rules to gen a SliTaz package suitable for Tazpkg.
32 genpkg_rules()
33 {
34 case $PACKAGE in
35 apache)
36 CONFIG_FILES="/etc/apache /var/www /etc/ssl/apache"
37 TAZPANEL_DAEMON="edit::/etc/apache/httpd.conf|web::$WEB_SITE"
38 PROVIDE="lighttpd"
39 TAGS="webserver http server"
40 DEPENDS="apr-util apr openssl pcre util-linux-uuid expat zlib"
41 mkdir -p $fs/usr/share/apache $fs/etc/init.d $fs/etc/apache/conf.d
42 mkdir -p $fs/etc/ssl/apache
43 cp -a $install/usr/share/apache/icons $fs/usr/share/apache
44 cp -a $install/usr/share/apache/error $fs/usr/share/apache
45 cp -a $install/usr/share/apache/modules $fs/usr/share/apache
46 cp -a $install/usr/bin $fs/usr
47 rm -r $fs/usr/bin/apxs
48 cp -a $install/etc $fs
49 rm -rf $fs/etc/apache/original
50 cp -a $install/var $fs
52 cp -a $stuff/apache $fs/etc/init.d
53 mkdir -p $fs/etc/apache/extra
54 cp -a $stuff/fix-range-CVE-2011-3192.conf $fs/etc/apache/extra
56 sed -i -e 's|User daemon|User www|' -e 's|Group daemon|Group www|' \
57 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
58 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
59 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
60 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
61 -e 's|#LoadModule ssl_module|LoadModule ssl_module|' \
62 $fs/etc/apache/httpd.conf $fs/etc/apache/extra/httpd-ssl.conf
63 echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf
64 sed -i 's/^SSLSessionCache /#&/' $fs/etc/apache/extra/httpd-ssl.conf
65 cat >> $fs/etc/apache/extra/httpd-ssl.conf <<EOT
67 # Unsafe, see CVE-2014-3566 POODLE
68 SSLProtocol All -SSLv2 -SSLv3
69 EOT
70 ;;
71 apache-dev)
72 CAT="development|HTTP server development files."
73 mkdir -p $fs/usr/share/apache $fs/usr/bin
74 cp -a $install/usr/include $fs/usr
75 cp -a $install/usr/bin/apxs $fs/usr/bin
76 cp -a $install/usr/share/apache/build $fs/usr/share/apache
77 ;;
78 apache-doc)
79 CAT="development|HTTP server documentation files."
80 mkdir -p $fs/usr/share
81 cp -a $install/usr/share/doc $fs/usr/share
82 ;;
83 esac
84 }
86 # Pre and post install commands for Tazpkg.
87 # We stop the server by default in case of upgarde.
88 pre_install_apache()
89 {
90 [ -z "$1" ] && for i in httpd lighttpd ngnix cherokee $PACKAGE ; do
91 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
92 done
93 }
95 post_install_apache()
96 {
97 local lang=$(. $1/etc/locale.conf 2>/dev/null; echo ${LANG#*_})
98 local tz=$(cat $1/etc/TZ 2>/dev/null)
99 local hostname=$(cat $1/etc/hostname 2>/dev/null)
101 # Just in case.
102 chown www.www "$1/var/log/$PACKAGE"
103 ping -c 2 $(hostname) > /dev/null 2>&1 ||
104 sed -i "s/localhost/$(hostname) localhost/" "$1/etc/hosts"
105 sed -i -e "s/^#\(LoadModule.*slotmem_shm.*\)$/\1/" \
106 -e "s/.*ServerName www.example.*/ServerName ${hostname:-slitaz}/" \
107 $1/etc/apache/httpd.conf $1/etc/apache/extra/httpd-ssl.conf
108 grep -qs Apache $1/var/www/index.html &&
109 sed -i 's|^LighTTPD.*|&\nApache configs : /etc/apache|' \
110 $1/var/www/index.html
111 [ -s "$1/etc/ssl/apache/apache.pem" ] ||
112 openssl req -new -x509 -keyout "$1/etc/ssl/apache/apache.pem" \
113 -out "$1/etc/ssl/apache/apache.pem" -days 3650 -nodes <<EOT
114 ${lang:-US}
115 ${tz:-Somewhere}
119 ${hostname:-slitaz}
121 EOT
122 [ -z "$quiet" ] && echo # Start new line
123 ( cd "$1/$INSTALLED/" ; grep -l /etc/apache/conf.d/ */receipt ) | \
124 while read file; do
125 pkg=$(dirname $file)
126 [ "$pkg" = "$PACKAGE" ] && continue
127 [ -z "$quiet" ] && echo "Reconfiguring $pkg for $PACKAGE..."
128 tazpkg reconfigure $pkg
129 done
130 [ -f "$1/etc/php.ini" ] && tazpkg get-install php-apache --root="$1"
131 [ "$1" ] || netstat -ltn 2> /dev/null | grep -q :80 ||
132 /etc/init.d/$PACKAGE start
133 }
135 # Rules to clean extras dirs or files
136 clean_wok()
137 {
138 rm -rf $WOK/$PACKAGE/${PACKAGE}.${VERSION}
139 }