Current Path : /var/lib/dpkg/info/ |
Current File : /var/lib/dpkg/info/ispmanager-pkg-myadmin.postinst |
#!/bin/bash # postinst script for coremanager # # see: dh_installdeb(1) #set -e # summary of how this script can be called: # * <postinst> `configure' <most-recently-configured-version> # * <old-postinst> `abort-upgrade' <new version> # * <conflictor's-postinst> `abort-remove' `in-favour' <package> # <new-version> # * <postinst> `abort-remove' # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' # <failed-install-package> <version> `removing' # <conflicting-package> <version> # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package COREDIR=/usr/local/mgr5 CONFNAME=myadmin.conf . ${COREDIR}/lib/pkgsh/core_pkg_funcs.sh . ${COREDIR}/lib/pkgsh/ispmgr_pkg_funcs.sh CONFDIR=/etc/phpmyadmin case "$1" in configure) APACHECONF=/etc/apache2/conf.d/phpmyadmin-apache.conf NGINXCONF=/etc/nginx/vhosts-includes/phpmyadmin-nginx.conf if ! grep -qE "Directory\s+/usr/share/phpmyadmin/setup" ${APACHECONF}; then cat >> ${APACHECONF} << EOF <Directory /usr/share/phpmyadmin/setup> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require all denied </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All </IfModule> </Directory> EOF RELOAD_WEB=yes fi if ! grep -qE "location\s+\^\~\s+/phpmyadmin/setup" ${NGINXCONF}; then cat >> ${NGINXCONF} << EOF location ^~ /phpmyadmin/setup { deny all; } EOF RELOAD_WEB=yes fi if [ -z ${2} ]; then if [ "#${ISPCONVERT}" = "#yes" ]; then PATHLIST="phpmyadmin-servers" PathConvert ${COREDIR}/etc/conf.d/myadmin.conf test -f /etc/nginx/vhosts-includes/phpMyAdmin.conf && rm -f /etc/nginx/vhosts-includes/phpMyAdmin.conf test -f /etc/apache2/conf.d/phpmyadmin.conf && echo "# Disabled by ISPmanager" > /etc/apache2/conf.d/phpmyadmin.conf test -f /etc/apache2/conf.d/phpMyAdmin.conf && rm -f /etc/apache2/conf.d/phpMyAdmin.conf else touch ${CONFDIR}/servers.ini.php grep -q "${CONFDIR}/servers.ini.php" ${CONFDIR}/config.inc.php || sed -i -r "/\?>/ iinclude('${CONFDIR}/servers.ini.php');" ${CONFDIR}/config.inc.php grep -q "${CONFDIR}/servers.ini.php" ${CONFDIR}/config.inc.php || echo "include('${CONFDIR}/servers.ini.php');" >> ${CONFDIR}/config.inc.php grep -q "PmaNoRelation_DisableWarning" ${CONFDIR}/config.inc.php || echo "\$cfg['PmaNoRelation_DisableWarning'] = TRUE;" >> ${CONFDIR}/config.inc.php test -f /etc/apache2/conf.d/phpmyadmin.conf && echo "# Disabled by ISPmanager" > /etc/apache2/conf.d/phpmyadmin.conf sed -i -r "s|\\\$cfg\['blowfish_secret'\] =.*|\$cfg\['blowfish_secret'\] = '$(pwgen -s 32 1)';|" ${CONFDIR}/config.inc.php test -f ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME} || ln -sf ../conf.d/myadmin.conf ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME} DBLIST=$(${MGRCTL} -R -m ${ISPMGR} db.server | grep type=mysql | tr ' ' '\n' | awk -F= '$1 == "name" {print $2}') for DB in ${DBLIST}; do ${MGRCTL} -m ${ISPMGR} db.server.edit elid=${DB} sok=ok >/dev/null 2>&1 & done ReloadWeb MakeConfigLink myadmin # Afterinstall AfterinstallModule ${ISPMGR} myadmin fi fi if ! grep -qE "Option\s+phpMyAdmin" ${COREDIR}/etc/conf.d/myadmin.conf ; then echo "Option phpMyAdmin" >> ${COREDIR}/etc/conf.d/myadmin.conf RELOAD_WEB=yes fi if [ "${RELOAD_WEB}" = "yes" ]; then ReloadWeb fi ReloadMgr ${ISPMGR} ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. exit 0