wok view phpldapadmin/receipt @ rev 25037

Up glza (0.11.4)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 21 21:38:29 2022 +0000 (24 months ago)
parents d25f12337a71
children e0747fd04e6a
line source
1 # SliTaz package receipt.
3 PACKAGE="phpldapadmin"
4 VERSION="1.2.5"
5 CATEGORY="misc"
6 SHORT_DESC="Administration of LDAP over the Web."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="https://github.com/leenooks/phpLDAPadmin/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="${WEB_SITE}archive/$VERSION.tar.gz"
14 DEPENDS="php-ldap"
16 CONFIG_FILES="/etc/phpldapadmin/config.php"
18 HOST_ARCH="any"
20 current_version()
21 {
22 wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \
23 sed '/archive.*tar/!d;s|.*/\(.*\).tar.*|\1|;q'
24 }
26 # Rules to gen a SliTaz package suitable for Tazpkg.
27 genpkg_rules()
28 {
29 mkdir -p $fs/usr/share/phpldapadmin
30 mkdir -p $fs/etc
31 mkdir -p $fs/usr/share/applications
33 cp -a $src/. $fs/usr/share/phpldapadmin
34 mv $fs/usr/share/phpldapadmin/config $fs/etc/phpldapadmin
35 ln -s /etc/phpldapadmin $fs/usr/share/phpldapadmin/config
36 mv $fs/etc/phpldapadmin/config.php.example $fs/etc/phpldapadmin/config.php
37 cp $stuff/phpldapadmin.desktop $fs/usr/share/applications
38 chown -R www.www $fs/usr/share/phpldapadmin $fs/etc/phpldapadmin
39 chmod 700 $fs/etc/phpldapadmin
40 chmod 600 $fs/etc/phpldapadmin/config.php
41 }
43 post_install()
44 {
45 if [ -s "$1/etc/openldap/slapd.conf" ]
46 then
47 rootdn=$(awk '/^rootdn/ { print $2 }' < "$1/etc/openldap/slapd.conf" | sed 's/"//g')
48 sed -i "s|'login','dn','');|'login','dn','');\\n\$ldapservers->SetValue(\$i,'login','dn','$rootdn');|" \
49 "$1/etc/phpldapadmin/config.php"
50 chown 80.80 "$1/etc/phpldapadmin/config.php"
51 fi
53 # Configure lighttpd server
54 if [ -f "$1/etc/lighttpd/lighttpd.conf" ]
55 then
56 if ! grep -q /usr/share/phpldapadmin/ "$1/etc/lighttpd/lighttpd.conf"
57 then
58 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/phpldapadmin/" => "/usr/share/phpldapadmin/",|g' -i "$1/etc/lighttpd/lighttpd.conf"
59 if [ -z "$1" ]
60 then
61 # Start Web server.
62 /etc/init.d/lighttpd stop
63 /etc/init.d/lighttpd start
64 fi
65 fi
66 fi
68 # Configure apache server
69 if [ -f "$1/etc/apache/httpd.conf" ]
70 then
71 if [ ! -f "$1/etc/apache/conf.d/phpldapadmin" ]
72 then
73 cat > "$1/etc/apache/conf.d/phpldapadmin" <<EOT
74 <IfModule mod_alias.c>
75 Alias /phpldapadmin /usr/share/phpldapadmin
76 </IfModule>
77 <DirectoryMatch /usr/share/phpldapadmin/>
78 DirectoryIndex index.php
79 Options +FollowSymLinks
80 AllowOverride None
81 Order allow,deny
82 Allow from all
83 </DirectoryMatch>
84 EOT
85 if [ -z "$1" ]
86 then
87 # Start Web server.
88 /etc/init.d/apache stop
89 /etc/init.d/apache start
90 fi
91 fi
92 fi
93 cat <<EOT
94 ------
95 Login DN and password are found in /etc/openldap/slapd.conf with rootdn and rootpw keywords:
96 $(grep ^rootdn "$1/etc/openldap/slapd.conf")
97 $(grep ^rootpw "$1/etc/openldap/slapd.conf")
98 ------
99 EOT
100 }