wok-4.x view phpldapadmin/receipt @ rev 3370
Childsplay: Add post_install()
author | Claudinei Pereira <claudinei@slitaz.org> |
---|---|
date | Thu Jun 11 19:05:25 2009 +0000 (2009-06-11) |
parents | 9622723b3408 |
children | e0cee896adcf |
line source
1 # SliTaz package receipt.
3 PACKAGE="phpldapadmin"
4 VERSION="1.1.0.5"
5 CATEGORY="misc"
6 SHORT_DESC="Administration of LDAP over the Web."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://$PACKAGE.sourceforge.net/"
10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
11 DEPENDS="php-ldap"
12 CONFIG_FILES="/etc/phpldapadmin/config.php"
14 # Rules to gen a SliTaz package suitable for Tazpkg.
15 genpkg_rules()
16 {
17 mkdir -p $fs/usr/share/phpldapadmin $fs/etc $fs/usr/share/applications
18 cp -a $src/. $fs/usr/share/phpldapadmin
19 mv $fs/usr/share/phpldapadmin/config $fs/etc/phpldapadmin
20 ln -s /etc/phpldapadmin $fs/usr/share/phpldapadmin/config
21 mv $fs/etc/phpldapadmin/config.php.example $fs/etc/phpldapadmin/config.php
22 cp stuff/phpldapadmin.desktop $fs/usr/share/applications
23 chown -R www.www $fs/usr/share/phpldapadmin $fs/etc/phpldapadmin
24 chmod 700 $fs/etc/phpldapadmin
25 chmod 600 $fs/etc/phpldapadmin/config.php
26 }
28 post_install()
29 {
30 if [ -s $1/etc/openldap/slapd.conf ]; then
31 rootdn=$(awk '/^rootdn/ { print $2 }' < $1/etc/openldap/slapd.conf | sed 's/"//g')
32 sed -i "s|'login','dn','');|'login','dn','');\\n\$ldapservers->SetValue(\$i,'login','dn','$rootdn');|" $1/etc/phpldapadmin/config.php
33 chown 80.80 $1/etc/phpldapadmin/config.php
34 fi
35 # Configure lighttpd server
36 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
37 if ! grep -q /usr/share/phpldapadmin/ $1/etc/lighttpd/lighttpd.conf; then
38 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/phpldapadmin/" => "/usr/share/phpldapadmin/",|g' -i $1/etc/lighttpd/lighttpd.conf
39 if [ -z "$1" ]; then
40 # Start Web server.
41 /etc/init.d/lighttpd stop
42 /etc/init.d/lighttpd start
43 fi
44 fi
45 fi
46 # Configure apache server
47 if [ -f $1/etc/apache/httpd.conf ]; then
48 if [ ! -f $1/etc/apache/conf.d/phpldapadmin ]; then
49 cat > $1/etc/apache/conf.d/phpldapadmin <<EOT
50 <IfModule mod_alias.c>
51 Alias /phpldapadmin /usr/share/phpldapadmin
52 </IfModule>
53 <DirectoryMatch /usr/share/phpldapadmin/>
54 DirectoryIndex index.php
55 Options +FollowSymLinks
56 AllowOverride None
57 Order allow,deny
58 Allow from all
59 </DirectoryMatch>
60 EOT
61 if [ -z "$1" ]; then
62 # Start Web server.
63 /etc/init.d/apache stop
64 /etc/init.d/apache start
65 fi
66 fi
67 fi
68 cat <<EOT
69 ------
70 Login DN and password are found in /etc/openldap/slapd.conf with rootdn and rootpw keywords:
71 $(grep ^rootdn /etc/openldap/slapd.conf)
72 $(grep ^rootpw /etc/openldap/slapd.conf)
73 ------
74 EOT
75 }