Your IP : 3.137.174.253


Current Path : /var/lib/dpkg/info/
Upload File :
Current File : /var/lib/dpkg/info/coremanager-pkg-mysql.preinst

#!/bin/bash
# preinst script for coremanager
#
# see: dh_installdeb(1)

#set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

COREDIR=/usr/local/mgr5
MGR=core

case "$1" in
	install)
	. ${COREDIR}/lib/pkgsh/core_pkg_funcs.sh

	if [ "#${ISPCONVERT}" = "#yes" ]; then
		exit 0
	fi
	
	if [ ! -d ${COREDIR}/etc ]; then
		# There is no coremgr dir
		exit 1
	fi
	mkdir -p ${COREDIR}/tmp
	if [ -z "${1}" ]; then
		# Empty arg"
		exit 1
	fi
	
	TMPCNF=/usr/local/mgr5/tmp/.$$.cnf
	CORECNF=/usr/local/mgr5/etc/my.cnf
	
	export PATH="${PATH}:/usr/sbin:/usr/bin:/bin:/sbin"
	Service ${MYSQL_SERVICE} start
	
	
	DLIST=$(check_connect)
	if [ $? -eq 0 ]; then
		if ! check_my_cnf ; then
			#Alarm! There is empty paswwd
			create_root_passwd
			create_coremgr_passwd
		fi
	fi
	DLIST=$(check_core_cnf)
	if [ $? -ne 0 ]; then
		OLDROOTPW=$(reset_root_passwd)
		create_coremgr_passwd
		restore_root_passwd ${OLDROOTPW}
	fi
	;;
	upgrade)
	;;
	abort-upgrade)
	;;
	
	*)
		echo "preinst 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