#!/bin/bash cd /var/www/html wget https://github.com/phppgadmin/phppgadmin/releases/download/REL_7-13-0/phpPgAdmin-7.13.0.tar.gz tar xzf phpPgAdmin-7.13.0.tar.gz mv phpPgAdmin-7.13.0 phpPgAdmin && rm -f phpPgAdmin-7.13.0.tar.gz chown -R webapps: phpPgAdmin PHP_MAJOR=`da build used_configs | grep -P 'PHP .* configuration file:' | awk '{print substr($0, length($0)-1, 1)}'` if [ $PHP_MAJOR -ge 8 ]; then wget https://www.jvmhost.com/articles/postgresql-centos7-directadmin/phpPgAdmin-7.13.0-php8.patch.gz gunzip phpPgAdmin-7.13.0-php8.patch.gz patch -d /var/www/html/phpPgAdmin -p1 < phpPgAdmin-7.13.0-php8.patch rm -f phpPgAdmin-7.13.0-php8.patch fi mkdir -p /var/www/html/phpPgAdmin/direct_login/tokens chown -R webapps:postgres /var/www/html/phpPgAdmin/direct_login chmod 771 /var/www/html/phpPgAdmin/direct_login chmod 770 /var/www/html/phpPgAdmin/direct_login/tokens cp /usr/local/directadmin/plugins/postgres/bin/sso.pl /var/www/html/phpPgAdmin/direct_login chown root:postgres /var/www/html/phpPgAdmin/direct_login/sso.pl chmod 750 /var/www/html/phpPgAdmin/direct_login/sso.pl yum -y install perl-File-Touch perl-IO-All # Alma 9 does not have perl-File-Touch perl -MFile::Touch -e '1;' &>/dev/null if [ $? -ne 0 ]; then yum -y install perl-App-cpanminus cpanm install File::Touch fi sed -i -e "s|\(\$conf\['servers'\]\[0\]\['host'\] = \)''|\1'/var/run/postgresql'|" -e "s|\(\$conf\['servers'\]\[0\]\['desc'\] = 'PostgreSQL\)'|\1 SSO'|" \ -e "s|\(\$conf\['owned_only'\] =\) false|\1 true|" /var/www/html/phpPgAdmin/conf/config.inc.php cat > /etc/pam.d/postgresql_sso<