SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "phpldapadmin"

# SliTaz package receipt.

PACKAGE="phpldapadmin"
VERSION="1.2.1"
CATEGORY="misc"
SHORT_DESC="Administration of LDAP over the Web."
MAINTAINER="pascal.bellard@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tgz"
WEB_SITE="http://phpldapadmin.sourceforge.net/"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
DEPENDS="php-ldap"
CONFIG_FILES="/etc/phpldapadmin/config.php"

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/phpldapadmin $fs/etc $fs/usr/share/applications
    cp -a $src/. $fs/usr/share/phpldapadmin
    mv $fs/usr/share/phpldapadmin/config $fs/etc/phpldapadmin
    ln -s /etc/phpldapadmin $fs/usr/share/phpldapadmin/config
    mv $fs/etc/phpldapadmin/config.php.example $fs/etc/phpldapadmin/config.php
    cp $stuff/phpldapadmin.desktop $fs/usr/share/applications
    chown -R www.www $fs/usr/share/phpldapadmin $fs/etc/phpldapadmin
    chmod 700 $fs/etc/phpldapadmin
    chmod 600 $fs/etc/phpldapadmin/config.php
}

post_install()
{
    if [ -s $1/etc/openldap/slapd.conf ]; then
        rootdn=$(awk '/^rootdn/ { print $2 }' < $1/etc/openldap/slapd.conf | sed 's/"//g')
        sed -i "s|'login','dn','');|'login','dn','');\\n\$ldapservers->SetValue(\$i,'login','dn','$rootdn');|" $1/etc/phpldapadmin/config.php
        chown 80.80 $1/etc/phpldapadmin/config.php
    fi
    # Configure lighttpd server
    if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
        if ! grep -q /usr/share/phpldapadmin/ $1/etc/lighttpd/lighttpd.conf; then
                sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/phpldapadmin/" => "/usr/share/phpldapadmin/",|g' -i $1/etc/lighttpd/lighttpd.conf
            if [ -z "$1" ]; then
                # Start Web server.
                /etc/init.d/lighttpd stop
                /etc/init.d/lighttpd start
            fi
        fi
    fi
    # Configure apache server
    if [ -f $1/etc/apache/httpd.conf ]; then
        if [ ! -f $1/etc/apache/conf.d/phpldapadmin ]; then
            cat > $1/etc/apache/conf.d/phpldapadmin <<EOT
<IfModule mod_alias.c>
    Alias /phpldapadmin /usr/share/phpldapadmin
</IfModule>
<DirectoryMatch /usr/share/phpldapadmin/>
    DirectoryIndex index.php
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</DirectoryMatch>
EOT
            if [ -z "$1" ]; then
                # Start Web server.
                /etc/init.d/apache stop
                /etc/init.d/apache start
            fi
        fi
    fi
    cat <<EOT
------
Login DN and password are found in /etc/openldap/slapd.conf with rootdn and rootpw keywords:
$(grep ^rootdn $1/etc/openldap/slapd.conf)
$(grep ^rootpw $1/etc/openldap/slapd.conf)
------
EOT
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)