wok-current annotate apache/receipt @ rev 20486

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