Sophie

Sophie

distrib > PLD > ac > amd64 > by-pkgid > 1030edcaa9d0786550e0891c3e06826e > scriptlet

mysql-5.0.37-1.amd64.rpm

PREIN

/bin/sh

 
 
if [ -n "`/usr/bin/getgid mysql`" ]; then 
	if [ "`/usr/bin/getgid mysql`" != "89" ]; then 
		echo "Error: group mysql doesn't have gid=89. Correct this before installing mysql." 1>&2 
		exit 1 
	fi 
else 
	echo "Adding group mysql GID=89." 
	/usr/sbin/groupadd -g 89 -r mysql 1>&2 || exit $? 
	[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : 
fi;
 
 
 
if [ -n "`/bin/id -u mysql 2>/dev/null`" ]; then 
	if [ "`/bin/id -u mysql`" != "89" ]; then 
		echo "Error: user mysql doesn't have uid=89. Correct this before installing mysql." 1>&2 
		exit 1 
	fi 
else 
	echo "Adding user mysql UID=89." 
	/usr/sbin/useradd \
		 \
		-u 89 \
		-r \
		-d /home/services/mysql \
		-s /bin/sh \
		-c "MySQL Server"\
		-g mysql \
		 \
		 \
		mysql 1>&2 || exit $? 
	[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || : 
fi;

PREUN

/bin/sh
if [ "$1" = "0" ]; then
	{
if [ -f /var/lock/subsys/mysql ]; then
/sbin/service mysql stop 1>&2 || :;
fi };	/sbin/chkconfig --del mysql
fi

POSTIN

/bin/sh
[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c /usr/share/info >/dev/null 2>&1
/sbin/chkconfig --add mysql
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/mysql ] && . /etc/sysconfig/mysql
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/mysql ]; then
/sbin/service mysql restart 1>&2 || :;
else
echo 'Run "/sbin/service mysql start" to start mysql service.'
fi
fi };

POSTUN

/bin/sh
[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c /usr/share/info >/dev/null 2>&1
if [ "$1" = "0" ]; then
	/usr/lib/rpm/user_group.sh user del mysql
	/usr/lib/rpm/user_group.sh group del mysql
fi

Triggers

mysql <= 4.0.20-2

/bin/sh
# For clusters in /etc/mysql/clusters.conf
if [ -f "/etc/sysconfig/mysql" ]; then
	. /etc/sysconfig/mysql
	if [ -n "$MYSQL_DB_CLUSTERS" ]; then
		for i in "$MYSQL_DB_CLUSTERS"; do
			echo "$i/mysqld.conf=$i" >> /etc/mysql/clusters.conf
		done
		echo "# Do not use **obsolete** option MYSQL_DB_CLUSTERS" >> /etc/sysconfig/mysql
		echo "# USE /etc/mysql/clusters.conf instead" >> /etc/sysconfig/mysql
		echo "Converted clusters from MYSQL_DB_CLUSTERS to /etc/mysql/clusters.conf."
		echo "You NEED to fix your /etc/sysconfig/mysql and verify /etc/mysql/clusters.conf."
	fi
fi

mysql <= 4.1.1

/bin/sh
# For better compatibility with prevoius versions:
for config in $(awk -F= '!/^#/ && /=/{print $1}' /etc/mysql/clusters.conf); do
	if echo "$config" | grep -q '^/'; then
		config_file="$config"
	elif [ -f "/etc/mysql/$config" ]; then
		config_file=/etc/mysql/$config
	else
		clusterdir=$(awk -F= "/^$config/{print \$2}" /etc/mysql/clusters.conf)
		if [ -z "$clusterdir" ]; then
			echo >&2 "Can't find cluster dir for $config!"
			echo >&2 "Please remove extra (leading) spaces from /etc/mysql/clusters.conf"
			exit 1
		fi
		config_file="$clusterdir/mysqld.conf"
	fi

	if [ ! -f "$config_file" ]; then
			echo >&2 "Lost myself! Please report this (with above errors, if any) to http://bugs.pld-linux.org/"
			exit 1
	fi
	echo "Adding option old-passwords to config: $config_file"
	echo "If you want to use new, better passwords - remove it"

	# sed magic to add 'old-passwords' to [mysqld] section
	sed -i -e '/./{H;$!d;};x;/\[mysqld\]/{
		a
		a; Compatibility options:
		aold-passwords
	}
	' $config_file
done


RPM_SCRIPTVERBOSITY=5 
[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm 
if [ -x /usr/bin/banner.sh ]; then 
	CMD="/usr/bin/banner.sh --stderr $([ $RPM_SCRIPTVERBOSITY -ge 5 ] && echo -s) -m mysql-4.1.x" 
else 
	CMD="cat >&2" 
fi 
eval $CMD <<-EOF 
	If you want to use new help tables in MySQL 4.1.x then You'll need to import the help data:
	mysql -u mysql mysql < /usr/share/mysql/fill_help_tables.sql
EOF
#'