Current Path : /var/lib/dpkg/info/ |
Current File : /var/lib/dpkg/info/coremanager-pkg-mysql.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 MGR=core . ${COREDIR}/lib/pkgsh/core_pkg_funcs.sh if [ "${MYSQL_SERVICE}" = "mariadb" ]; then MYCNF=/etc/mysql/mariadb.conf.d/50-server.cnf MYCNF_SAFE=/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf else MYCNF=/etc/mysql/mysql.conf.d/mysqld.cnf MYCNF_SAFE=/etc/mysql/mysql.conf.d/mysqld.cnf fi case "$1" in configure) if [ -z ${2} ]; then if [ "#${ISPCONVERT}" = "#yes" ]; then if [ -f ${COREDIR}/etc/common.conf ]; then if [ ! -f /root/.my.cnf ]; then PASS=$(sed -n -r '/section\s+name="mysql/,/\/section/{ /rootpassword/ s/\s*<\/*property(\sname="rootpassword")*>//gp }' ${COREDIR}/etc/common.conf) touch /root/.my.cnf chmod 0400 /root/.my.cnf echo "[client]" > /root/.my.cnf echo "user = root" >> /root/.my.cnf echo "password = ${PASS}" >> /root/.my.cnf fi fi ReloadMgr all else # Fix #28109 if ! grep -qE "^innodb_file_per_table" ${MYCNF} ; then sed -i -r '/\[mysqld\]/a innodb_file_per_table = 1' ${MYCNF} fi if ! grep -qE '\s*log-error=' ${MYCNF_SAFE} ; then sed -i -r '/\[mysqld_safe\]/a log-error=/var/log/mysql.log' ${MYCNF_SAFE} fi # Fix #ISP-1299 # libmariadb does not support caching_sha2_password password type. Fallback to native(for alt php) if [[ $(lsb_release -c -s) =~ focal|jammy ]]; then if ! grep -qE '^\s*default-authentication-plugin=mysql_native_password' ${MYCNF} ; then sed -i -r '/\[mysqld\]/a default-authentication-plugin=mysql_native_password' ${MYCNF} fi fi if [ "${MYSQL_SERVICE}" = "mysql" ]; then if [ -f /etc/mysql/my.cnf ] && [ -d /etc/mysql/mysql.conf.d ] && ! grep -qE '\!includedir /etc/mysql/mysql.conf.d/' /etc/mysql/my.cnf ; then echo '!includedir /etc/mysql/mysql.conf.d/' >> /etc/mysql/my.cnf fi fi ReloadService ${MYSQL_SERVICE} ReloadMgr all # Afterinstall AfterinstallModule ${MGR} mysql fi fi if ! grep -qE "^local-infile" ${MYCNF} ; then sed -i -r '/\[mysqld\]/a local-infile=0' ${MYCNF} ReloadService ${MYSQL_SERVICE} fi ;; 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