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