mysql: Fix updating the package.

The mysql server daemon will now be stopped before the update
is executed and all configuration and data files will be
backed up.
This commit is contained in:
Michael Tremer
2014-01-26 16:55:33 +01:00
parent fa37e705d9
commit 98f3d9b581
6 changed files with 49 additions and 3 deletions

View File

@@ -22,11 +22,17 @@
############################################################################
#
. /opt/pakfire/lib/functions.sh
extract_files
ln -svf ../init.d/mysql /etc/rc.d/rc0.d/K26mysql
ln -svf ../init.d/mysql /etc/rc.d/rc3.d/S34mysql
ln -svf ../init.d/mysql /etc/rc.d/rc6.d/K26mysql
/etc/init.d/mysql start
restore_backup "${NAME}"
start_service "${NAME}"
COUNTER=0
while [ "$COUNTER" -lt "10" ]; do
[ -e "/var/run/mysql/mysql.sock" ] && break
@@ -34,6 +40,8 @@ while [ "$COUNTER" -lt "10" ]; do
sleep 5
COUNTER=$(($COUNTER + 1))
done
[ -e "/var/run/mysql/mysql.sock" ] || (echo "MySQL still noch running... Exiting."; \
exit 1)
mysqladmin -u root --password='' password 'mysqlfire'

View File

@@ -22,5 +22,14 @@
############################################################################
#
. /opt/pakfire/lib/functions.sh
# Stop the mysql service
stop_service "${NAME}"
# Make backup
make_backup "${NAME}"
remove_files
# Remove start links.
rm -rvf /etc/rc.d/rc*.d/*mysql

View File

@@ -22,5 +22,29 @@
############################################################################
#
. /opt/pakfire/lib/functions.sh
./uninstall.sh
./install.sh
# Create backup include file if it is missing.
if [ ! -e "/var/ipfire/backup/addons/includes/mysql" ]; then
cat <<EOF > /var/ipfire/backup/addons/includes/mysql
/etc/my.cnf
/srv/mysql
EOF
fi
# Stop the mysql service
stop_service "${NAME}"
# Make backup
make_backup "${NAME}"
# Update files
remove_files
extract_files
# Restore backup
restore_backup "${NAME}"
# Restart the service
start_service "${NAME}"
exit 0