Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:aledr:Dropped
mysql-community-server
project.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File project.diff of Package mysql-community-server
--- rc.mysql-multi.orig +++ rc.mysql-multi @@ -1,7 +1,8 @@ #!/bin/bash -# Copyright (c) 1995-2002 SuSE Linux AG Nuernberg, Germany. +# Copyright (c) 1995-2011 SuSE Linux AG Nuernberg, Germany. # -# Author: Lenz Grimmer <feedback@suse.de> +# Author: Lenz Grimmer +# Maintainer: Michal Hrusecky <mhrusecky@suse.cz> # # mysqld_multi extension added by Richard Bos, 2008 # @@ -60,11 +61,13 @@ fi parse_arguments() { for arg do case "$arg" in - --basedir=*) basedir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; - --datadir=*) datadir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; - --pid-file=*) pid_file="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; - --socket=*) socket="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; - --log-error=*) log_error="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; + --basedir=*) basedir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; + --datadir=*) datadir="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; + --pid-file=*) pid_file="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; + --socket=*) socket="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; + --log-error=*) log_error="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; + --user=*) mysql_daemon_user="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; + --group=*) mysql_daemon_group="`echo "$arg" | sed -e 's/^[^=]*=//'`" ;; esac done } @@ -260,10 +263,13 @@ else log_base="`echo "$log_error" | sed 's|\.log$||'`" [ "$log_base" \!= "$log_error" ] || log_base="/var/log/mysql/mysql" log_upgrade="${log_base}-upgrade.log" + log_upgrade_run="${log_base}-upgrade-run.log" log_query="${log_base}-query.log" parse_arguments `$print_defaults $defaults mysqld mysql_server` - export TMPDIR=/var/tmp/mysql + mkdir -m 755 -p /var/run/mysql + chown $mysql_daemon_user:$mysql_daemon_group /var/run/mysql + export TEMPDIR="`cat /var/run/mysql/tmpdir 2> /dev/null`" # Safeguard (relative paths, core dumps..) cd "$basedir" @@ -275,12 +281,15 @@ else rc_status -v && rc_exit # prepare tmp dir - rm -rf "$TMPDIR" - mkdir -p "$TMPDIR" - chown mysql:mysql "$TMPDIR" - chmod 755 "$TMPDIR" - [ "`ls -ld "$TMPDIR" | grep "^drwxr-xr-x[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || { - echo "Can't create secure $TMPDIR" + unset TMPDIR + if [ "$TEMPDIR" ] && [ -d "$TEMPDIR" ] && \ + [ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ]; then + rm -rf "$TEMPDIR" + fi + TEMPDIR="`mktemp -d -p /var/tmp mysql.XXXXXX | tee /var/run/mysql/tmpdir`" + [ -z "$TEMPDIR" ] || chown "$mysql_daemon_user:$mysql_daemon_group" "$TEMPDIR" + [ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || { + echo "Can't create secure $TEMPDIR" rc_failed; rc_status -v; rc_exit; } @@ -359,21 +368,22 @@ else # us to run mysql_upgrade, we start a full-featured server with # --skip-grant-tables and restict access to it by unix # permissions of the named socket - protected=/var/run/mysql/protected + protected="`cat /var/run/mysql/protecteddir 2> /dev/null`" if [ -d "$protected" ]; then pid="`cat "$protected/mysqld.pid" 2> /dev/null`" if [ "$pid" ] && [ -d "/proc/$pid" ] && [ "`readlink "/proc/$pid/exe" | grep "mysql"`" ]; then echo "Can't update as another updating process is currently running" | tee -a "$log_upgrade" echo "Please check process $pid and terminate it before restarting MySQL" | tee -a "$log_upgrade" - rc_failed; rc_status -v; rc_exit; + rc_failed; rc_status -v; rc_exit; + else + rm -rf "$protected" fi fi - rm -rf "$protected" - mkdir -p "$protected" - chown "$mysql_daemon_user:$mysql_daemon_group" "$protected" - chmod 700 "$protected" - [ "`ls -ld "$protected" | grep "^drwx------[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || { + protected="`mktemp -d -p /var/tmp mysql-protected.XXXXXX | tee /var/run/mysql/protecteddir`" + export TMPDIR="$TEMPDIR" + [ -z "$protected" ] || chown "$mysql_daemon_user:$mysql_daemon_group" "$protected" + [ "`ls -ld "$protected" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ] || { echo "Can't create secure $protected" | tee -a "$log_upgrade" rc_failed; rc_status -v; rc_exit; } @@ -382,20 +392,21 @@ else $SAFE_MYSQLD \ --mysqld=${MYSQLD#/usr/sbin/} \ $debug_flags \ - --datadir="$datadir" \ - --skip-grant-tables \ --skip-networking \ + --skip-grant-tables \ + --datadir="$datadir" \ --user="$mysql_daemon_user" \ - --pid-file="$protected/mysqld.pid" \ + --log-error="$log_upgrade_run" \ --socket="$protected/mysql.sock" \ + --pid-file="$protected/mysqld.pid" \ --group="$mysql_daemon_group" &>/dev/null & wait_for_socket "$protected/mysql.sock" || { echo "error: $protected/mysql.sock file didn't appeared... " | tee -a "$log_upgrade" + echo " Try checking \"$log_upgrade_run\"... " | tee -a "$log_upgrade" rc_failed; rc_status -v; rc_exit; } echo "Upgrading MySQL... " | tee -a "$log_upgrade" /usr/bin/mysql_upgrade \ - --basedir="$basedir" \ --socket="$protected/mysql.sock" | tee -a "$log_upgrade" [ "$PIPESTATUS" -ne 0 ] && { rc_failed; rc_status -v; @@ -404,17 +415,15 @@ else kill -TERM "`cat $protected/mysqld.pid`" rm -rf "$protected" # Fix ownerships and permissions for $datadir - chmod 755 "$datadir" + chmod 750 "$datadir" chown -R "$mysql_daemon_user:$mysql_daemon_group" "$datadir" rm -f "$datadir/.run-mysql_upgrade" \ "$datadir"/{update-stamp-*,mysql/stamp-4.1} # used in the past - if test -f "$datadir/mysql/stamp-4.1" ; then - rm "$datadir/mysql/stamp-4.1" - fi - chown mysql:mysql "$log_upgrade" - chmod 660 "$log_upgrade" + chown "$mysql_daemon_user:$mysql_daemon_group" "$log_upgrade" + chmod 640 "$log_upgrade" fi + export TMPDIR="$TEMPDIR" echo -n "Starting service MySQL " @@ -439,8 +448,10 @@ else stop) echo -n "Shutting down service MySQL " kill_mysql - rm -rf "$TMPDIR" - + if [ "$TEMPDIR" ] && [ -d "$TEMPDIR" ] && \ + [ "`ls -ld "$TEMPDIR" | grep "^drwx------[\\.\+]\?[[:blank:]]\+[0-9]\+[[:blank:]]\+$mysql_daemon_user[[:blank:]]\+$mysql_daemon_group[[:blank:]]\+.*"`" ]; then + rm -rf "$TEMPDIR" + fi # Remember status and be verbose rc_status -v ;;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor