wok view apache/receipt @ rev 24126

Add eudev-lib
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Oct 14 06:54:52 2021 +0000 (2021-10-14)
parents 9580ac12b123
children 1dc83097496b
line source
1 # SliTaz package receipt.
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="https://www.apache.org/"
12 SOURCE="httpd"
13 TARBALL="$SOURCE-$VERSION.tar.bz2"
14 WGET_URL="${WEB_SITE}dist/$SOURCE/$TARBALL"
16 PROVIDE="lighttpd"
17 DEPENDS="apr apr-util expat openssl pcre util-linux-uuid zlib"
18 BUILD_DEPENDS="apr-dev apr-util-dev bash expat-dev lua5.1-dev
19 openldap-dev openssl-dev sed util-linux-uuid-dev zlib-dev"
21 CONFIG_FILES="/etc/apache /var/www /etc/ssl/apache"
22 TAZPANEL_DAEMON="edit::/etc/apache/httpd.conf|web::$WEB_SITE"
24 # What is the latest version available today?
25 current_version()
26 {
27 wget -O - https://downloads.apache.org/httpd/ 2>/dev/null | \
28 sed "/$SOURCE-/!d;/tar/!d;s|.*$SOURCE-\\(.*\\).tar.*|\\1|" | sort -Vr | sed q
29 }
31 # Rules to configure and make the package.
32 compile_rules()
33 {
34 grep -q Slitaz config.layout || \
35 cat $stuff/slitaz.layout >> config.layout
37 ./configure \
38 --mandir=/usr/share/man \
39 --enable-mods-shared=all \
40 --enable-proxy \
41 --enable-ssl \
42 --enable-layout=Slitaz \
43 $CONFIGURE_ARGS &&
44 make $MAKEFLAGS &&
45 make -j 1 DESTDIR=$DESTDIR install
46 }
48 # Rules to gen a SliTaz package suitable for Tazpkg.
49 genpkg_rules()
50 {
51 mkdir -p $fs/usr/share/apache
52 mkdir -p $fs/etc/init.d
53 mkdir -p $fs/etc/apache/conf.d
54 mkdir -p $fs/etc/apache/extra
55 mkdir -p $fs/etc/ssl/apache
57 cp -a $install/usr/share/apache/icons $fs/usr/share/apache
58 cp -a $install/usr/share/apache/error $fs/usr/share/apache
59 cp -a $install/usr/share/apache/modules $fs/usr/share/apache
60 cp -a $install/usr/bin $fs/usr
61 rm -r $fs/usr/bin/apxs
62 cp -a $install/etc $fs
63 rm -rf $fs/etc/apache/original
64 cp -a $install/var $fs
66 cp -a $stuff/apache $fs/etc/init.d
67 cp -a $stuff/fix-range-CVE-2011-3192.conf $fs/etc/apache/extra
69 sed -i -e 's|User daemon|User www|' \
70 -e 's|Group daemon|Group www|' \
71 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
72 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
73 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
74 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
75 -e 's|#LoadModule ssl_module|LoadModule ssl_module|' \
76 $fs/etc/apache/httpd.conf \
77 $fs/etc/apache/extra/httpd-ssl.conf
79 echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf
80 sed -i 's/^SSLSessionCache /#&/' $fs/etc/apache/extra/httpd-ssl.conf
82 cat >> $fs/etc/apache/extra/httpd-ssl.conf <<EOT
84 # Unsafe, see CVE-2014-3566 POODLE
85 SSLProtocol All -SSLv2 -SSLv3
86 EOT
87 }
89 # Pre and post install commands for Tazpkg.
90 # We stop the server by default in case of upgrade.
91 pre_install()
92 {
93 [ -z "$1" ] &&
94 for i in httpd lighttpd ngnix cherokee $PACKAGE
95 do
96 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
97 done
98 }
100 post_install()
101 {
102 local lang=$(. $1/etc/locale.conf 2>/dev/null; echo ${LANG#*_})
103 local tz=$(cat $1/etc/TZ 2>/dev/null)
104 local hostname=$(cat $1/etc/hostname 2>/dev/null)
106 # Just in case.
107 chown www.www "$1/var/log/$PACKAGE"
108 ping -c 2 $(hostname) > /dev/null 2>&1 ||
109 sed -i "s/localhost/$(hostname) localhost/" "$1/etc/hosts"
110 sed -i -e "s/^#\(LoadModule.*slotmem_shm.*\)$/\1/" \
111 -e "s/.*ServerName www.example.*/ServerName ${hostname:-slitaz}/" \
112 $1/etc/apache/httpd.conf $1/etc/apache/extra/httpd-ssl.conf
113 grep -qs Apache $1/var/www/index.html &&
114 sed -i 's|^LighTTPD.*|&\nApache configs : /etc/apache|' \
115 $1/var/www/index.html
116 [ -s "$1/etc/ssl/apache/apache.pem" ] ||
117 openssl req -new -x509 -keyout "$1/etc/ssl/apache/apache.pem" \
118 -out "$1/etc/ssl/apache/apache.pem" -days 3650 -nodes <<EOT
119 ${lang:-US}
120 ${tz:-Somewhere}
124 ${hostname:-slitaz}
126 EOT
127 [ -z "$quiet" ] && echo # Start new line
128 ( cd "$1/$INSTALLED/" ; grep -l /etc/apache/conf.d/ */receipt ) | \
129 while read file
130 do
131 pkg=$(dirname $file)
132 [ "$pkg" = "$PACKAGE" ] && continue
133 [ -z "$quiet" ] && echo "Reconfiguring $pkg for $PACKAGE..."
134 tazpkg reconfigure $pkg
135 done
136 [ -f "$1/etc/php.ini" ] && tazpkg get-install php-apache --root="$1"
137 [ "$1" ] || netstat -ltn 2> /dev/null | grep -q :80 ||
138 /etc/init.d/$PACKAGE start
139 }
141 # Rules to clean extras dirs or files
142 clean_wok()
143 {
144 rm -rf $WOK/$PACKAGE/${PACKAGE}.${VERSION}
145 }