SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "apache"

# SliTaz package receipt.

PACKAGE="apache"
VERSION="2.2.29"
CATEGORY="network"
SHORT_DESC="Secure, efficient and extensible HTTP server."
MAINTAINER="pascal.bellard@slitaz.org"
SOURCE="httpd"
TARBALL="$SOURCE-$VERSION.tar.bz2"
WEB_SITE="http://www.apache.org/"
WGET_URL="${WEB_SITE}dist/$SOURCE/$TARBALL"
DEPENDS="apr-util apr openssl pcre util-linux-ng-uuid expat zlib"
BUILD_DEPENDS="apr-util-dev apr-dev openssl-dev sed expat-dev zlib-dev \
util-linux-ng-uuid-dev openldap-dev apr-dev bash"
CONFIG_FILES="/etc/apache /var/www /etc/ssl/apache"
PROVIDE="lighttpd"
TAGS="webserver http server"

# Rules to configure and make the package.
compile_rules()
{
    cd $src
    grep -q Slitaz config.layout || \
        cat $stuff/slitaz.layout >> config.layout
    ./configure --mandir=/usr/share/man --enable-mods-shared=all \
        --enable-proxy --enable-ssl \
        --enable-layout=Slitaz $CONFIGURE_ARGS &&
    make $MAKEFLAGS && make DESTDIR=$PWD/_pkg install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/apache $fs/etc/init.d $fs/etc/apache/conf.d
    mkdir -p $fs/etc/ssl/apache
    cp -a $_pkg/usr/share/apache/icons $fs/usr/share/apache
    cp -a $_pkg/usr/share/apache/error $fs/usr/share/apache
    cp -a $_pkg/usr/share/apache/modules $fs/usr/share/apache
    cp -a $_pkg/usr/bin $fs/usr
    rm -r $fs/usr/bin/apxs
    cp -a $_pkg/etc $fs
    rm -rf $fs/etc/apache/original
    cp -a $_pkg/var $fs
    
    cp -a $stuff/apache $fs/etc/init.d
    mkdir -p $fs/etc/apache/extra
    cp -a $stuff/fix-range-CVE-2011-3192.conf $fs/etc/apache/extra

    sed -i  -e 's|User daemon|User www|' -e 's|Group daemon|Group www|' \
        -e 's|ServerAdmin you@example.com|ServerAdmin root@localhost|' \
        -e 's|#Include /etc/apache/extra/httpd-ssl.conf|Include /etc/apache/extra/httpd-ssl.conf|' \
        -e 's|/etc/apache/server.crt|/etc/ssl/apache/apache.pem|' \
        -e 's|/etc/apache/server.key|/etc/ssl/apache/apache.pem|' \
        $fs/etc/apache/httpd.conf $fs/etc/apache/extra/httpd-ssl.conf
    echo "Include /etc/apache/conf.d" >> $fs/etc/apache/httpd.conf
}

# Pre and post install commands for Tazpkg.
# We stop the server by default in case of upgarde.
pre_install()
{
    echo "Processing pre-install commands..."
    [ -z "$1" ] && [ -f /etc/init.d/$PACKAGE ] && /etc/init.d/$PACKAGE stop
}

post_install()
{
    local lang=$(. /etc/locale.conf 2>/dev/null; echo ${LANG#*_})
    local tz=$(cat /etc/TZ 2>/dev/null)
    local hostname=$(cat /etc/hostname 2>/dev/null)
    echo "Processing post-install commands..."
    # Just in case.
    chown www.www $1/var/log/$PACKAGE
    ping -c 2 $(hostname) > /dev/null 2>&1 || 
        sed -i "s/localhost/$(hostname) localhost/" /etc/hosts
    [ -s $1/etc/ssl/apache/apache.pem ] ||
    openssl req -new -x509 -keyout $1/etc/ssl/apache/apache.pem \
        -out $1/etc/ssl/apache/apache.pem -days 3650 -nodes <<EOT
${lang:-us}
${tz:-UTC}

${hostname:-slitaz}



EOT
    ( cd $1/$INSTALLED/ ; grep -l /etc/apache/conf.d/ */receipt ) | \
    while read file; do
        pkg=$(dirname $file)
        [ "$pkg" = "$PACKAGE" ] && continue
        echo "Reconfiguring $pkg for $PACKAGE..."
        tazpkg reconfigure $pkg
    done
    if [ -z "$1" ]; then
        for i in lighttpd ; do
            [ -f /etc/init.d/$i ] && /etc/init.d/$i stop
        done
        /etc/init.d/$PACKAGE start
    fi
}

# Rules to clean extras dirs or files
clean_wok()
{
    rm -rf $WOK/$PACKAGE/${PACKAGE}.${VERSION}
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)