wok-next view apache/receipt @ rev 20891

cookutils: up (1085); syslinux: remove docs
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Jul 19 18:27:17 2018 +0300 (2018-07-19)
parents 577783a50854
children d5aab818505e
line source
1 # SliTaz package receipt v2.
3 PACKAGE="apache"
4 VERSION="2.4.28"
5 CATEGORY="network"
6 SHORT_DESC="Secure, efficient and extensible HTTP server"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="Apache"
9 WEB_SITE="http://www.apache.org/"
11 TARBALL="httpd-$VERSION.tar.bz2"
12 WGET_URL="http://www.apache.org/dist/httpd/$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-dev apache-doc apache"
18 compile_rules() {
19 grep -q Slitaz config.layout || \
20 cat $stuff/slitaz.layout >> config.layout
21 sed -i 's|mkdir |mkdir -p |' build/mkdir.sh
23 ./configure \
24 --mandir=/usr/share/man \
25 --enable-mods-shared=all \
26 --enable-proxy \
27 --enable-ssl \
28 --enable-layout=Slitaz \
29 $CONFIGURE_ARGS &&
30 make $MAKEFLAGS && make DESTDIR=$DESTDIR install || return 1
32 install -Dm755 $stuff/apache $install/etc/init.d/apache
34 mkdir -p $install/etc/apache/extra/
35 cp -a $stuff/fix-range-CVE-2011-3192.conf $install/etc/apache/extra/
37 sed -i \
38 -e 's|User daemon|User www|' \
39 -e 's|Group daemon|Group www|' \
40 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
41 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
42 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
43 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
44 -e 's|#LoadModule ssl_module|LoadModule ssl_module|' \
45 $install/etc/apache/httpd.conf \
46 $install/etc/apache/extra/httpd-ssl.conf
48 echo "Include /etc/apache/conf.d" >> $install/etc/apache/httpd.conf
49 sed -i 's/^SSLSessionCache /#&/' $install/etc/apache/extra/httpd-ssl.conf
50 cat >> $install/etc/apache/extra/httpd-ssl.conf <<EOT
52 # Unsafe, see CVE-2014-3566 POODLE
53 SSLProtocol All -SSLv2 -SSLv3
54 EOT
56 chown -R root:root $install
57 }
59 genpkg_rules() {
60 case $PACKAGE in
61 apache-dev)
62 copy @dev apxs /usr/share/apache/build/
63 rm -r $fs/usr/share/apache/error/ # here folder 'include'
64 ;;
65 apache-doc)
66 copy /usr/share/doc/
67 CAT="development|documentation"
68 ;;
69 apache)
70 copy @std @rm /usr/share/apache/error/include/
71 rm -rf $fs/etc/apache/original/
72 CONFIG_FILES="/etc/apache/ /var/www/ /etc/ssl/apache/"
73 TAZPANEL_DAEMON="edit::/etc/apache/httpd.conf|web::$WEB_SITE"
74 PROVIDE="lighttpd"
75 TAGS="webserver http server"
76 DEPENDS="apr apr-util libldap libpcre openssl zlib"
77 ;;
78 esac
79 }
81 # We stop the server by default in case of upgarde.
82 pre_install_apache() {
83 [ -n "$1" ] ||
84 for i in httpd lighttpd ngnix cherokee $PACKAGE ; do
85 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
86 done
87 }
89 post_install_apache() {
90 local lang=$(. $1/etc/locale.conf 2>/dev/null; echo ${LANG#*_})
91 local tz=$(cat $1/etc/TZ 2>/dev/null)
92 local hostname=$(cat $1/etc/hostname 2>/dev/null)
94 # Just in case.
95 chown www.www "$1/var/log/$PACKAGE"
96 ping -c 2 $(hostname) > /dev/null 2>&1 ||
97 sed -i "s/localhost/$(hostname) localhost/" "$1/etc/hosts"
98 sed -i -e "s/^#\(LoadModule.*slotmem_shm.*\)$/\1/" \
99 -e "s/.*ServerName www.example.*/ServerName ${hostname:-slitaz}/" \
100 $1/etc/apache/httpd.conf $1/etc/apache/extra/httpd-ssl.conf
101 grep -qs Apache $1/var/www/index.html &&
102 sed -i 's|^LighTTPD.*|&\nApache configs : /etc/apache|' \
103 $1/var/www/index.html
104 [ -s "$1/etc/ssl/apache/apache.pem" ] ||
105 openssl req -new -x509 -keyout "$1/etc/ssl/apache/apache.pem" \
106 -out "$1/etc/ssl/apache/apache.pem" -days 3650 -nodes <<EOT
107 ${lang:-US}
108 ${tz:-Somewhere}
112 ${hostname:-slitaz}
114 EOT
115 [ -z "$quiet" ] && echo # Start new line
116 ( cd "$1/$INSTALLED/" ; grep -l /etc/apache/conf.d/ */receipt ) | \
117 while read file; do
118 pkg=$(dirname $file)
119 [ "$pkg" = "$PACKAGE" ] && continue
120 [ -z "$quiet" ] && echo "Reconfiguring $pkg for $PACKAGE..."
121 tazpkg reconfigure $pkg
122 done
123 [ -f "$1/etc/php.ini" ] && tazpkg get-install php-apache --root="$1"
124 [ "$1" ] || netstat -ltn 2> /dev/null | grep -q :80 ||
125 /etc/init.d/$PACKAGE start
126 }