wok annotate tazwikiss/receipt @ rev 18730

Quote root dir in post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 20 15:13:45 2015 +0100 (2015-12-20)
parents f9743cf20afc
children 77be6b57303b
rev   line source
pascal@5859 1 # SliTaz package receipt.
pascal@5859 2
pascal@5859 3 PACKAGE="tazwikiss"
al@18545 4 VERSION="250"
pascal@5859 5 CATEGORY="office"
pascal@5859 6 SHORT_DESC="Tiny SliTaz Wiki"
pascal@5859 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15363 8 LICENSE="BSD"
slaxemulator@8851 9 SOURCE="slitaz-dev-tools"
pankso@10475 10 TARBALL="$SOURCE-$VERSION.tar.bz2"
slaxemulator@10728 11 WGET_URL="http://hg.slitaz.org/slitaz-dev-tools/archive/$VERSION.tar.bz2"
pascal@5859 12 WEB_SITE="http://www.slitaz.org/"
al@18599 13 CONFIG_FILES="/var/www/wiki/config.sh /var/www/wiki/config-de.sh \
al@18599 14 /var/www/wiki/config-fr.sh"
pascal@16264 15 HOST_ARCH="any"
pascal@5859 16
pascal@10471 17 # Rules to configure and make the package.
pascal@10471 18 compile_rules()
pascal@10471 19 {
pascal@10471 20 mkdir -p $DESTDIR 2> /dev/null
pascal@10471 21 cp -a $src/$PACKAGE/rootfs/* $DESTDIR
pascal@10471 22 }
pascal@10471 23
pascal@5859 24 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@5859 25 genpkg_rules()
pascal@5859 26 {
pascal@15603 27 cp -a $install/* $fs
pascal@5859 28 chown -R 80.80 $fs/var/www
pascal@5859 29 }
pascal@5859 30
pascal@5859 31 # Pre and post install commands for Tazpkg.
pascal@5859 32 post_install()
pascal@5859 33 {
pascal@5859 34 server=busybox
pascal@5859 35 # Configure lighttpd server
pascal@18730 36 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]; then
pascal@5859 37 server=lighttpd
pascal@18730 38 if ! grep -q '"/wiki/"' "$1/etc/lighttpd/lighttpd.conf"; then
pascal@5859 39 sed -e 's|# Fast CGI|$HTTP["url"] =~ "/wiki/" {\
pascal@5859 40 cgi.assign = (\
pascal@5859 41 ".sh" => "/bin/sh"\
pascal@5859 42 )\
pascal@5859 43 index-file.names = ( "index.sh" )\
pascal@18730 44 }\n\n&|' -i "$1/etc/lighttpd/lighttpd.conf"
pascal@5859 45 if [ -z "$1" ]; then
pascal@5859 46 # Start Web server.
pascal@5859 47 /etc/init.d/lighttpd stop
pascal@5859 48 /etc/init.d/lighttpd start
pascal@5859 49 fi
pascal@5859 50 fi
pascal@5859 51 fi
pascal@5859 52 # Configure apache server
pascal@18730 53 if [ -f "$1/etc/apache/httpd.conf" ]; then
pascal@5859 54 server=apache
pascal@18730 55 if [ ! -f "$1/etc/apache/conf.d/tazwikiss" ]; then
pascal@18730 56 cat > "$1/etc/apache/conf.d/tazwikiss" <<EOT
pascal@5859 57 <DirectoryMatch /var/www/wiki/>
pascal@5859 58 Options +ExecCGI
pascal@5859 59 AddHandler cgi-script .sh
pascal@5859 60 DirectoryIndex index.sh
pascal@5859 61 AllowOverride None
pascal@5859 62 Order allow,deny
pascal@5859 63 Allow from all
pascal@5859 64 </DirectoryMatch>
pascal@5859 65 EOT
pascal@5859 66 if [ -z "$1" ]; then
al@18640 67 echo
pascal@5859 68 # Start Web server.
pascal@5859 69 /etc/init.d/apache stop
pascal@5859 70 /etc/init.d/apache start
pascal@5859 71 fi
pascal@5859 72 fi
pascal@5859 73 fi
pascal@5859 74 # Configure busybox/httpd server by default
pascal@5859 75 if [ "$server" == "busybox" ]; then
pascal@18730 76 sed -i 's/lighttpd/httpd/' "$1/etc/rcS.conf"
pascal@18730 77 if [ ! -s "$1/etc/httpd.conf" ]; then
pascal@18730 78 cat > "$1/etc/httpd.conf" <<EOT
pascal@5859 79 H:/var/www
pascal@5859 80 A:0.0.0.0/0
pascal@9514 81 .xml:text/xml
pascal@9514 82 .tgz:application/x-tgz
pascal@9514 83 .tar.gz:application/x-tgz
pascal@9514 84 .tazpkg:application/x-tazpkg
pascal@5859 85 EOT
pascal@5859 86 fi
pascal@5859 87 while read line; do
pascal@18730 88 grep -q "$line" "$1/etc/httpd.conf" && continue
pascal@18730 89 echo "$line" >> "$1/etc/httpd.conf"
pascal@5859 90 done <<EOT
pascal@5859 91 *.sh:/bin/sh
pascal@5859 92 EOT
pascal@18730 93 grep -q ' httpd ' "$1/etc/rcS.conf" ||
pascal@18730 94 sed -i 's/ slim"/ httpd slim"/' "$1/etc/rcS.conf"
pascal@5859 95 if [ -z "$1" ]; then
pascal@5859 96 # Start Web server.
pascal@5859 97 /etc/init.d/httpd stop
pascal@5859 98 /etc/init.d/httpd start
pascal@5859 99 fi
pascal@5859 100 fi
pascal@5859 101 while read line; do
pascal@18730 102 [ -x "$1/$line" ] && continue
pascal@5859 103 echo "WARNING: $line not found, $PACKAGE will not work !"
pascal@5859 104 done <<EOT
pascal@5859 105 /usr/sbin/httpd
mojo@17273 106 /usr/lib/slitaz/httphelper.sh
pascal@5859 107 EOT
pascal@5859 108 echo "The default password to edit pages is 'test'"
al@18640 109 echo
pascal@5859 110 }