wok-next annotate apache/receipt @ rev 20545

vmtouch: create $install/usr/bin path
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 03 15:08:22 2018 +0200 (2018-04-03)
parents 3417c3ffbd13
children 342b30daff76
rev   line source
pascal@20185 1 # SliTaz package receipt v2.
pascal@1313 2
pascal@1313 3 PACKAGE="apache"
al@20469 4 VERSION="2.4.28"
pascal@1313 5 CATEGORY="network"
al@20469 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 WEB_SITE="http://www.apache.org/"
al@20469 10
al@20469 11 TARBALL="httpd-$VERSION.tar.bz2"
al@20469 12 WGET_URL="http://www.apache.org/dist/httpd/$TARBALL"
pascal@1313 13
pascal@15361 14 BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev sed expat-dev zlib-dev \
pascal@19920 15 util-linux-uuid-dev openldap-dev bash pcre-dev"
al@20469 16 SPLIT="apache-dev apache-doc apache"
pascal@15361 17
al@20469 18 compile_rules() {
pascal@1313 19 grep -q Slitaz config.layout || \
slaxemulator@9698 20 cat $stuff/slitaz.layout >> config.layout
al@20469 21 sed -i 's|mkdir |mkdir -p |' build/mkdir.sh
al@20469 22
al@20469 23 ./configure \
al@20469 24 --mandir=/usr/share/man \
erjo@14809 25 --enable-mods-shared=all \
erjo@14809 26 --enable-proxy \
erjo@14809 27 --enable-ssl \
al@20469 28 --enable-layout=Slitaz \
al@20469 29 $CONFIGURE_ARGS &&
al@20469 30 make $MAKEFLAGS && make DESTDIR=$DESTDIR install || return 1
pascal@1313 31
al@20469 32 install -Dm755 $stuff/apache $install/etc/init.d/apache
erjo@4647 33
al@20469 34 mkdir -p $install/etc/apache/extra/
al@20469 35 cp -a $stuff/fix-range-CVE-2011-3192.conf $install/etc/apache/extra/
al@20469 36
al@20469 37 sed -i \
al@20469 38 -e 's|User daemon|User www|' \
al@20469 39 -e 's|Group daemon|Group www|' \
al@20469 40 -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
al@20469 41 -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
al@20469 42 -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
al@20469 43 -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
al@20469 44 -e 's|#LoadModule ssl_module|LoadModule ssl_module|' \
al@20469 45 $install/etc/apache/httpd.conf \
al@20469 46 $install/etc/apache/extra/httpd-ssl.conf
al@20469 47
al@20469 48 echo "Include /etc/apache/conf.d" >> $install/etc/apache/httpd.conf
al@20469 49 sed -i 's/^SSLSessionCache /#&/' $install/etc/apache/extra/httpd-ssl.conf
al@20469 50 cat >> $install/etc/apache/extra/httpd-ssl.conf <<EOT
pascal@17237 51
pascal@17237 52 # Unsafe, see CVE-2014-3566 POODLE
pascal@17237 53 SSLProtocol All -SSLv2 -SSLv3
pascal@17237 54 EOT
al@20469 55
al@20469 56 chown -R root:root $install
al@20469 57 }
al@20469 58
al@20469 59 genpkg_rules() {
al@20469 60 case $PACKAGE in
al@20469 61 apache-dev)
al@20469 62 copy @dev apxs /usr/share/apache/build/
al@20469 63 rm -r $fs/usr/share/apache/error/ # here folder 'include'
al@20469 64 ;;
al@20469 65 apache-doc)
al@20469 66 copy /usr/share/doc/
al@20469 67 CAT="development|documentation"
al@20469 68 ;;
al@20469 69 apache)
al@20469 70 copy @std @rm /usr/share/apache/error/include/
al@20469 71 rm -rf $fs/etc/apache/original/
al@20469 72 CONFIG_FILES="/etc/apache/ /var/www/ /etc/ssl/apache/"
al@20469 73 TAZPANEL_DAEMON="edit::/etc/apache/httpd.conf|web::$WEB_SITE"
al@20469 74 PROVIDE="lighttpd"
al@20469 75 TAGS="webserver http server"
al@20469 76 DEPENDS="apr-util apr openssl pcre util-linux-uuid expat zlib"
al@20469 77 ;;
pascal@20185 78 esac
pascal@1313 79 }
pascal@1313 80
pascal@1313 81 # We stop the server by default in case of upgarde.
al@20469 82 pre_install_apache() {
al@20469 83 [ -n "$1" ] ||
al@20469 84 for i in httpd lighttpd ngnix cherokee $PACKAGE ; do
pascal@19147 85 [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
pascal@19147 86 done
pascal@1313 87 }
pascal@1313 88
al@20469 89 post_install_apache() {
pascal@18893 90 local lang=$(. $1/etc/locale.conf 2>/dev/null; echo ${LANG#*_})
pascal@18893 91 local tz=$(cat $1/etc/TZ 2>/dev/null)
pascal@18893 92 local hostname=$(cat $1/etc/hostname 2>/dev/null)
al@18667 93
pascal@1313 94 # Just in case.
pascal@18730 95 chown www.www "$1/var/log/$PACKAGE"
pascal@1658 96 ping -c 2 $(hostname) > /dev/null 2>&1 ||
pascal@18730 97 sed -i "s/localhost/$(hostname) localhost/" "$1/etc/hosts"
pascal@18893 98 sed -i -e "s/^#\(LoadModule.*slotmem_shm.*\)$/\1/" \
pascal@18893 99 -e "s/.*ServerName www.example.*/ServerName ${hostname:-slitaz}/" \
pascal@18960 100 $1/etc/apache/httpd.conf $1/etc/apache/extra/httpd-ssl.conf
pascal@18893 101 grep -qs Apache $1/var/www/index.html &&
pascal@18893 102 sed -i 's|^LighTTPD.*|&\nApache configs : /etc/apache|' \
pascal@18893 103 $1/var/www/index.html
pascal@18730 104 [ -s "$1/etc/ssl/apache/apache.pem" ] ||
pascal@18730 105 openssl req -new -x509 -keyout "$1/etc/ssl/apache/apache.pem" \
pascal@18730 106 -out "$1/etc/ssl/apache/apache.pem" -days 3650 -nodes <<EOT
pascal@18893 107 ${lang:-US}
pascal@18893 108 ${tz:-Somewhere}
pascal@18893 109
pascal@18893 110
pascal@1794 111
pascal@12197 112 ${hostname:-slitaz}
pascal@1794 113
pascal@1794 114 EOT
al@18667 115 [ -z "$quiet" ] && echo # Start new line
pascal@18730 116 ( cd "$1/$INSTALLED/" ; grep -l /etc/apache/conf.d/ */receipt ) | \
pascal@1922 117 while read file; do
pascal@1922 118 pkg=$(dirname $file)
pascal@1922 119 [ "$pkg" = "$PACKAGE" ] && continue
al@18667 120 [ -z "$quiet" ] && echo "Reconfiguring $pkg for $PACKAGE..."
pascal@1922 121 tazpkg reconfigure $pkg
pascal@1922 122 done
pascal@18730 123 [ -f "$1/etc/php.ini" ] && tazpkg get-install php-apache --root="$1"
pascal@18715 124 [ "$1" ] || netstat -ltn 2> /dev/null | grep -q :80 ||
pascal@18715 125 /etc/init.d/$PACKAGE start
pascal@1313 126 }