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