HEX
Server: Apache
System: Linux hz.vslconceptsdomains.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: dkfounda (3233)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //var/lib/dpkg/info/cpanel-phppgadmin.preinst
#!/bin/sh

set -e

## <asset scriplets/pre>


set -e

USER=cpanelphppgadmin
GROUP=$USER
CPPA=/var/cpanel/userhomes/cpanelphppgadmin

PREFIX_BASE=/usr/local/cpanel/base/3rdparty
PREFIX=${PREFIX_BASE}/phpMyAdmin

checkUser() {
    echo "check $USER user"

    # add group
    /usr/bin/getent group $GROUP >/dev/null || \
        /usr/sbin/groupadd -r $GROUP

    # add user if needed
    /usr/bin/getent passwd $USER >/dev/null || \
        /usr/sbin/useradd -r -g $GROUP -M -d /var/cpanel/userhomes/$USER \
            -s /usr/local/cpanel/bin/noshell \
            -c "phpPgAdmin for cPanel & WHM" $USER
}


checkPerms() {
    echo "Check directories permissions"

    # ensure directories, perms & ownership
    #`  required for Ubuntu, not necessary for CentOS
    /bin/mkdir -p $CPPA
    chmod 711 $CPPA
    chown $USER:$GROUP $CPPA

    /bin/mkdir -p $CPPA/cache
    chmod 700 $CPPA/cache
    chown $USER:$GROUP $CPPA/cache

    /bin/mkdir -p $CPPA/mail
    chmod 711 $CPPA/mail
    chown $USER:$GROUP $CPPA/mail

    /bin/mkdir -p $CPPA/sessions
    chmod 700 $CPPA/sessions
    chown $USER:$GROUP $CPPA/sessions

    /bin/mkdir -p $CPPA/tmp
    chmod 700 $CPPA/tmp
    chown $USER:$GROUP $CPPA/tmp

}

runPre() {
    checkUser;
    checkPerms;
}

## </asset>


case "$1" in
  install)
    runPre;
    ;;
  upgrade)
    runPre;
    ;;
esac

exit 0