SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "phpldapadmin"

# SliTaz package receipt.

PACKAGE="phpldapadmin"
VERSION="1.2.6.3"
CATEGORY="misc"
SHORT_DESC="Administration of LDAP over the Web."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://github.com/leenooks/phpLDAPadmin"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$WEB_SITE/archive/$VERSION.tar.gz"

DEPENDS="php-ldap"

CONFIG_FILES="/etc/phpldapadmin/config.php"

HOST_ARCH="any"

current_version()
{
    wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \
    sed '/archive.*tar/!d;s|.*/\(.*\).tar.*|\1|;q'
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/phpldapadmin
    mkdir -p $fs/etc
    mkdir -p $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
    chown -R www.www                $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
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)