wok annotate tazwikiss/receipt @ rev 9514

busybox/httpd: allow multiple headers
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Apr 06 17:03:44 2011 +0200 (2011-04-06)
parents 9272b69b5779
children 5b2d6ec39fb5
rev   line source
pascal@5859 1 # SliTaz package receipt.
pascal@5859 2
pascal@5859 3 PACKAGE="tazwikiss"
slaxemulator@9242 4 VERSION="1.0.5"
pascal@5859 5 CATEGORY="office"
pascal@5859 6 SHORT_DESC="Tiny SliTaz Wiki"
pascal@5859 7 MAINTAINER="pascal.bellard@slitaz.org"
slaxemulator@8851 8 BUILD_DEPENDS="mercurial"
slaxemulator@8851 9 SOURCE="slitaz-dev-tools"
slaxemulator@8851 10 WGET_URL="mercurial|http://hg.slitaz.org/slitaz-dev-tools"
slaxemulator@8851 11 BRANCH="$VERSION"
pascal@5859 12 WEB_SITE="http://www.slitaz.org/"
pascal@5859 13 CONFIG_FILES="/var/www/wiki/config*.sh"
pascal@5859 14
pascal@5859 15 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@5859 16 genpkg_rules()
pascal@5859 17 {
slaxemulator@8851 18 cp -a $src/$PACKAGE/rootfs/* $fs
pascal@5859 19 chown -R 80.80 $fs/var/www
pascal@5859 20 }
pascal@5859 21
pascal@5859 22 # Pre and post install commands for Tazpkg.
pascal@5859 23 post_install()
pascal@5859 24 {
pascal@5859 25 server=busybox
pascal@5859 26 # Configure lighttpd server
pascal@5859 27 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
pascal@5859 28 server=lighttpd
pascal@5859 29 if ! grep -q '"/wiki/"' $1/etc/lighttpd/lighttpd.conf; then
pascal@5859 30 sed -e 's|# Fast CGI|$HTTP["url"] =~ "/wiki/" {\
pascal@5859 31 cgi.assign = (\
pascal@5859 32 ".sh" => "/bin/sh"\
pascal@5859 33 )\
pascal@5859 34 index-file.names = ( "index.sh" )\
pascal@5859 35 }\n\n&|' -i $1/etc/lighttpd/lighttpd.conf
pascal@5859 36 if [ -z "$1" ]; then
pascal@5859 37 # Start Web server.
pascal@5859 38 /etc/init.d/lighttpd stop
pascal@5859 39 /etc/init.d/lighttpd start
pascal@5859 40 fi
pascal@5859 41 fi
pascal@5859 42 fi
pascal@5859 43 # Configure apache server
pascal@5859 44 if [ -f $1/etc/apache/httpd.conf ]; then
pascal@5859 45 server=apache
pascal@5859 46 if [ ! -f $1/etc/apache/conf.d/tazwikiss ]; then
pascal@5859 47 cat > $1/etc/apache/conf.d/tazwikiss <<EOT
pascal@5859 48 <DirectoryMatch /var/www/wiki/>
pascal@5859 49 Options +ExecCGI
pascal@5859 50 AddHandler cgi-script .sh
pascal@5859 51 DirectoryIndex index.sh
pascal@5859 52 AllowOverride None
pascal@5859 53 Order allow,deny
pascal@5859 54 Allow from all
pascal@5859 55 </DirectoryMatch>
pascal@5859 56 EOT
pascal@5859 57 if [ -z "$1" ]; then
pascal@5859 58 # Start Web server.
pascal@5859 59 /etc/init.d/apache stop
pascal@5859 60 /etc/init.d/apache start
pascal@5859 61 fi
pascal@5859 62 fi
pascal@5859 63 fi
pascal@5859 64 # Configure busybox/httpd server by default
pascal@5859 65 if [ "$server" == "busybox" ]; then
pascal@5859 66 sed -i 's/lighttpd/httpd/' $1/etc/rcS.conf
pascal@5859 67 if [ ! -s $1/etc/httpd.conf ]; then
pascal@5859 68 cat > $1/etc/httpd.conf <<EOT
pascal@5859 69 H:/var/www
pascal@5859 70 A:0.0.0.0/0
pascal@9514 71 .xml:text/xml
pascal@9514 72 .tgz:application/x-tgz
pascal@9514 73 .tar.gz:application/x-tgz
pascal@9514 74 .tazpkg:application/x-tazpkg
pascal@5859 75 EOT
pascal@5859 76 fi
pascal@5859 77 while read line; do
pascal@7124 78 grep -q "$line" $1/etc/httpd.conf && continue
pascal@5859 79 echo "$line" >> $1/etc/httpd.conf
pascal@5859 80 done <<EOT
pascal@5859 81 *.sh:/bin/sh
pascal@5859 82 EOT
pascal@7124 83 grep -q ' httpd ' $1/etc/rcS.conf ||
pascal@7124 84 sed -i 's/ slim"/ httpd slim"/' $1/etc/rcS.conf
pascal@5859 85 if [ -z "$1" ]; then
pascal@5859 86 # Start Web server.
pascal@5859 87 /etc/init.d/httpd stop
pascal@5859 88 /etc/init.d/httpd start
pascal@5859 89 fi
pascal@5859 90 fi
pascal@5859 91 while read line; do
pascal@5859 92 [ -x $1/$line ] && continue
pascal@5859 93 echo "WARNING: $line not found, $PACKAGE will not work !"
pascal@5859 94 done <<EOT
pascal@5859 95 /usr/sbin/httpd
pascal@5859 96 /usr/bin/httpd_helper.sh
pascal@5859 97 EOT
pascal@5859 98 echo "The default password to edit pages is 'test'"
pascal@5859 99 }