/[packages]/cauldron/mariadb/current/SOURCES/mariadb-5.5-initscript.patch
ViewVC logotype

Annotation of /cauldron/mariadb/current/SOURCES/mariadb-5.5-initscript.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 169072 - (hide annotations) (download)
Sat Nov 19 09:09:55 2011 UTC (12 years, 5 months ago) by alien
File size: 8930 byte(s)
SILENT: update initscript patch to fix warning (again) in /etc/init.d/mysqld
1 alien 166284 diff -Naur 5.5_orig/support-files/mysql.server.sh 5.5/support-files/mysql.server.sh
2     --- 5.5_orig/support-files/mysql.server.sh 2011-11-01 16:20:49.000000000 +0100
3     +++ 5.5/support-files/mysql.server.sh 2011-11-05 11:22:28.185233991 +0100
4     @@ -10,14 +10,14 @@
5     # started and shut down when the systems goes down.
6    
7     # Comments to support chkconfig on RedHat Linux
8     -# chkconfig: 2345 64 36
9     +# chkconfig: 2345 11 90
10     # description: A very fast and reliable SQL database engine.
11    
12     # Comments to support LSB init script conventions
13     ### BEGIN INIT INFO
14     -# Provides: mysql
15     +# Provides: mysqld
16     # Required-Start: $local_fs $network $remote_fs
17     -# Should-Start: ypbind nscd ldap ntpd xntpd
18     +# Should-Start: ypbind ldap ntpd
19     # Required-Stop: $local_fs $network $remote_fs
20     # Default-Start: 2 3 4 5
21     # Default-Stop: 0 1 6
22     @@ -43,6 +43,9 @@
23     # If you change base dir, you must also change datadir. These may get
24     # overwritten by settings in the MySQL configuration files.
25    
26     +# Source function library.
27     +. /etc/rc.d/init.d/functions
28     +
29     basedir=
30     datadir=
31    
32     @@ -55,7 +58,7 @@
33    
34     # Lock directory for RedHat / SuSE.
35     lockdir='/var/lock/subsys'
36     -lock_file_path="$lockdir/mysql"
37     +lock_file_path="$lockdir/mysqld"
38    
39     # The following variables are only set for letting mysql.server find things.
40    
41     @@ -107,6 +110,9 @@
42     }
43     fi
44    
45     +# Source mysql configuration.
46     +[ -f /etc/sysconfig/mysqld ] && . /etc/sysconfig/mysqld
47     +
48     PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
49     export PATH
50    
51     @@ -130,18 +136,12 @@
52     for arg do
53     case "$arg" in
54     --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
55     - bindir="$basedir/bin"
56     + bindir="@bindir@"
57     if test -z "$datadir_set"; then
58     - datadir="$basedir/data"
59     + datadir="@localstatedir@"
60     fi
61     - sbindir="$basedir/sbin"
62     - if test -f "$basedir/bin/mysqld"
63     - then
64     - libexecdir="$basedir/bin"
65     - else
66     - libexecdir="$basedir/libexec"
67     - fi
68     - libexecdir="$basedir/libexec"
69     + sbindir="@sbindir@"
70     + libexecdir="@libexecdir@"
71     ;;
72     --datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
73     datadir_set=1
74     @@ -189,7 +189,7 @@
75     fi
76    
77     # there's nothing that will affect the file.
78     - log_failure_msg "The server quit without updating PID file ($pid_file_path)."
79     + log_failure_msg "The server quit without updating PID file ($pid_file_path)."; echo
80     return 1 # not waiting any more.
81     fi
82     fi
83     @@ -200,6 +200,18 @@
84    
85     done
86    
87     + # wait for mysql to really be available
88     + if test "$verb" = "created"; then
89     + i=0
90     + echo $echo_n ",$echo_c"
91     + while test $i -ne $service_startup_timeout; do
92     + $bindir/mysqladmin ping > /dev/null 2>&1 && i='' && break
93     + echo $echo_n ".$echo_c"
94     + i=`expr $i + 1`
95     + sleep 1
96     + done
97     + fi
98     +
99     if test -z "$i" ; then
100     log_success_msg
101     return 0
102     @@ -286,13 +298,71 @@
103     # Safeguard (relative paths, core dumps..)
104     cd $basedir
105    
106     - echo $echo_n "Starting MySQL"
107     + # Bail out if there's no valid $datadir (/var/lib/mysql)
108     + if ! [ "$datadir" != "/" ]; then
109     + echo $echo_n "ERROR: invalid datadir ($datadir)"
110     + failure; echo
111     + exit 1
112     + fi
113     +
114     + # Install a new database if $datadir/mysql is empty.
115     + if [ `ls -1A $datadir/mysql|wc -l` == "0" ]; then
116     + echo "Initializing the system database: "
117     + TMPDIR=/var/tmp $bindir/mysql_install_db
118     + RETVAL=$?
119     + if [ "$RETVAL" -gt "0" ]; then
120     + echo "ERROR: The database could not be initialized."
121     + failure; echo
122     + exit 1
123     + fi
124     + # Assume this is a clean install when the above checks has passed.
125     + $libexecdir/mysqld --version | awk '{ print $3}' > $datadir/mysql_upgrade_info
126     + chown -R $user:$user "$datadir"
127     + chmod 0711 "$datadir"
128     + fi
129     +
130     + # play safe...
131     + if ! [ -f $datadir/mysql_upgrade_info ]; then
132     + $libexecdir/mysqld --version | awk '{ print $3}' > $datadir/mysql_upgrade_info
133     + fi
134     +
135     + # Check if the system database should be updated and alert the user.
136 alien 169019 + NEW_VER="`$libexecdir/mysqld --version | cut -d' ' -f4 | cut -d- -f 1`"
137 alien 169072 + OLD_VER="`cat $datadir/mysql_upgrade_info | cut -d' ' -f4 | cut -d- -f 1`"
138 alien 166284 +
139     + get_mysql_id() {
140     + MAJOR="`echo $1|cut -d. -f1`"; MINOR="`echo $1|cut -d. -f2`"; PATCH="`echo $1|cut -d. -f3`"
141     + expr 10000 \* ${MAJOR} + 100 \* ${MINOR} + ${PATCH}
142     + }
143     +
144     + if [ "`get_mysql_id $NEW_VER`" -gt "`get_mysql_id $OLD_VER`" ]; then
145     + upgrade_message="WARNING: mysql_upgrade should be run (as root). The upgrade from mysql-$OLD_VER to mysql-$NEW_VER may require it."
146     + echo $echo_n "$upgrade_message"
147     + logger -p daemon.info -t mysql $upgrade_message
148     + echo
149     + fi
150     +
151     + # Remove stale pidfiles.
152     + if [ -z "`/sbin/pidof $libexecdir/mysqld`" ] && [ -e $mysqld_pid_file_path ]; then
153     + echo $echo_n "Removing stale pid file (mysqld)."
154     + rm -f $mysqld_pid_file_path
155     + echo
156     + fi
157     +
158     + mysqld_safe_pid=`ps ax | grep $bindir/mysqld_safe | grep -v grep | awk '{ print $1 }'`
159     + if ! [ -z $mysqld_safe_pid ]; then
160     + echo $echo_n "mysqld_safe is already running: "
161     + failure; echo
162     + exit 1
163     + fi
164     +
165     + echo $echo_n "Starting MySQL: "
166     if test -x $bindir/mysqld_safe
167     then
168     # Give extra arguments to mysqld with the my.cnf file. This script
169     # may be overwritten at next upgrade.
170     $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
171     - wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
172     + wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?; echo
173    
174     # Make lock for RedHat / SuSE
175     if test -w "$lockdir"
176     @@ -302,7 +372,7 @@
177    
178     exit $return_value
179     else
180     - log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
181     + log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"; echo
182     fi
183     ;;
184    
185     @@ -316,12 +386,12 @@
186    
187     if (kill -0 $mysqld_pid 2>/dev/null)
188     then
189     - echo $echo_n "Shutting down MySQL"
190     + echo $echo_n "Shutting down MySQL: "
191     kill $mysqld_pid
192     # mysqld should remove the pid file when it exits, so wait for it.
193     - wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
194     + wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?; echo
195     else
196     - log_failure_msg "MySQL server process #$mysqld_pid is not running!"
197     + log_failure_msg "MySQL server process #$mysqld_pid is not running!"; echo
198     rm "$mysqld_pid_file_path"
199     fi
200    
201     @@ -332,7 +402,7 @@
202     fi
203     exit $return_value
204     else
205     - log_failure_msg "MySQL server PID file could not be found!"
206     + log_failure_msg "MySQL server PID file could not be found!"; echo
207     fi
208     ;;
209    
210     @@ -342,7 +412,7 @@
211     if $0 stop $other_args; then
212     $0 start $other_args
213     else
214     - log_failure_msg "Failed to stop running server, so refusing to try to start."
215     + log_failure_msg "Failed to stop running server, so refusing to try to start."; echo
216     exit 1
217     fi
218     ;;
219     @@ -350,10 +420,10 @@
220     'reload'|'force-reload')
221     if test -s "$mysqld_pid_file_path" ; then
222     read mysqld_pid < "$mysqld_pid_file_path"
223     - kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
224     - touch "$mysqld_pid_file_path"
225     + kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL: "
226     + touch "$mysqld_pid_file_path"; echo
227     else
228     - log_failure_msg "MySQL PID file could not be found!"
229     + log_failure_msg "MySQL PID file could not be found!"; echo
230     exit 1
231     fi
232     ;;
233     @@ -362,10 +432,10 @@
234     if test -s "$mysqld_pid_file_path" ; then
235     read mysqld_pid < "$mysqld_pid_file_path"
236     if kill -0 $mysqld_pid 2>/dev/null ; then
237     - log_success_msg "MySQL running ($mysqld_pid)"
238     + log_success_msg "MySQL running ($mysqld_pid)"; echo
239     exit 0
240     else
241     - log_failure_msg "MySQL is not running, but PID file exists"
242     + log_failure_msg "MySQL is not running, but PID file exists"; echo
243     exit 1
244     fi
245     else
246     @@ -373,13 +443,13 @@
247     mysqld_pid=`pidof $libexecdir/mysqld`
248     if test -z $mysqld_pid ; then
249     if test -f "$lock_file_path" ; then
250     - log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
251     + log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"; echo
252     exit 2
253     fi
254     - log_failure_msg "MySQL is not running"
255     + log_failure_msg "MySQL is not running"; echo
256     exit 3
257     else
258     - log_failure_msg "MySQL is running but PID file could not be found"
259     + log_failure_msg "MySQL is running but PID file could not be found"; echo
260     exit 4
261     fi
262     fi

  ViewVC Help
Powered by ViewVC 1.1.30