/[smecontribs]/rpms/smeserver-mysql57/contribs9/smeserver-mysql57-2.0.0-SME10148-initializeDB.patch
ViewVC logotype

Contents of /rpms/smeserver-mysql57/contribs9/smeserver-mysql57-2.0.0-SME10148-initializeDB.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon Mar 13 05:25:37 2017 UTC (7 years, 8 months ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-mysql57-2_0_0-12_el6_sme, smeserver-mysql57-2_0_0-9_el6_sme, smeserver-mysql57-2_0_0-11_el6_sme, smeserver-mysql57-2_0_0-8_el6_sme, smeserver-mysql57-2_0_0-10_el6_sme, HEAD
* Sun Mar 12 2017 Jean-Philipe Pialasse <tests@pialasse.com> 2.0.0-7.sme
- update run file and template paths [SME: 10148]
- r8: add link for configuration ln -s /etc/opt/rh/rh-mysql57 /opt/rh/rh-mysql57/root/etc
- update run, set.password and my.cnf for rh-mysql57

1 diff -Nur smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file
2 --- smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file 2017-03-13 00:21:57.815000000 -0400
3 +++ smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/006pid-file 2017-03-13 00:55:06.661000000 -0400
4 @@ -1 +1 @@
5 -pid-file=/opt/rh/rh-mysql57/root/var/run/mysqld/mysqld.pid
6 +pid-file=/var/run/rh-mysql57-mysqld/mysqld.pid
7 diff -Nur smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir
8 --- smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir 1969-12-31 19:00:00.000000000 -0500
9 +++ smeserver-mysql57-2.0.0/root/etc/e-smith/templates/opt/rh/rh-mysql57/root/etc/my.cnf/0095lcmessagesdir 2017-03-13 00:56:02.390000000 -0400
10 @@ -0,0 +1 @@
11 +lc-messages-dir=/opt/rh/rh-mysql57/root/usr/share/rh-mysql57-mysql/english/
12 diff -Nur smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password smeserver-mysql57-2.0.0/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password
13 --- smeserver-mysql57-2.0.0.old/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password 2017-02-19 09:44:53.000000000 -0500
14 +++ smeserver-mysql57-2.0.0/root/etc/e-smith/templates/var/service/mysql57-mysqld/set.password 2017-03-13 01:19:45.555000000 -0400
15 @@ -4,8 +4,8 @@
16 my $pw = esmith::util::LdapPassword();
17
18 $OUT .= "use mysql;\n";
19 - $OUT .= "ALTER TABLE user MODIFY Password char(41) NOT NULL default '';\n";
20 - $OUT .= "UPDATE user SET password=password('$pw') WHERE user='root';\n";
21 + $OUT .= "ALTER TABLE user MODIFY authentication_string TEXT NULL default NULL;\n";
22 + $OUT .= "UPDATE user SET authentication_string=password('$pw'), password_expired='n' WHERE user='root';\n";
23 $OUT .= "DELETE FROM user WHERE user='';\n";
24 $OUT .= "FLUSH PRIVILEGES;\n";
25 }
26 diff -Nur smeserver-mysql57-2.0.0.old/root/var/service/mysql57-mysqld/run smeserver-mysql57-2.0.0/root/var/service/mysql57-mysqld/run
27 --- smeserver-mysql57-2.0.0.old/root/var/service/mysql57-mysqld/run 2017-03-13 00:21:57.817000000 -0400
28 +++ smeserver-mysql57-2.0.0/root/var/service/mysql57-mysqld/run 2017-03-13 01:23:10.052000000 -0400
29 @@ -1,5 +1,7 @@
30 #! /bin/sh
31
32 +datadir="/opt/rh/rh-mysql57/root/var/lib/mysql"
33 +
34 # We have to re-enable SCL environment, because /sbin/service
35 # clears almost all environment variables.
36 # Since X_SCLS is cleared as well, we lose information about other
37 @@ -7,20 +9,38 @@
38 . /opt/rh/rh-mysql57/service-environment
39 for sclname in $RH_MYSQL57_SCLS_ENABLED ; do
40 . /opt/rh/$sclname/enable
41 - export X_SCLS="$X_SCLS $sclname"
42 - done
43 -
44 - # we want start daemon only inside "scl enable" invocation
45 - if ! scl_enabled $sclname ; then
46 - echo "Collection $sclname has to be listed in /opt/rh/rh-mysql57/service-environment"
47 - exit 1
48 - fi
49 -
50 + export X_SCLS="$X_SCLS $sclname"
51 +done
52 +
53 +# we want start daemon only inside "scl enable" invocation
54 +if ! scl_enabled $sclname ; then
55 + echo "Collection $sclname has to be listed in /opt/rh/rh-mysql57/service-environment"
56 + exit 1
57 +fi
58 +
59 exec 2>&1
60 +
61 if [ ! -f /opt/rh/rh-mysql57/root/var/lib/mysql/mysql/user.frm ]
62 then
63 - setuidgid mysql sh /opt/rh/rh-mysql57/root/usr/bin/mysql_install_db
64 - /opt/rh/rh-mysql57/root/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables --socket=/var/lib/mysql/mysql57.sock < ./set.password
65 + echo "Initializing MySQL database"
66 + /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir="$datadir" --user="mysql"
67 + ret=$?
68 + if [ $ret -ne 0 ] ; then
69 + echo "Initialization of MySQL database failed." >&2
70 + echo "Perhaps /etc/opt/rh/rh-mysql57/my.cnf is misconfigured." >&2
71 + # Clean up any partially-created database files
72 + if [ ! -e "$datadir/mysql/user.frm" ] ; then
73 + rm -rf "$datadir"/*
74 + fi
75 + exit $ret
76 + fi
77 + # set root password
78 + /opt/rh/rh-mysql57/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < ./set.password
79 + # upgrade does not need to be run on a fresh datadir
80 + echo "5.7.16" >"$datadir/mysql_upgrade_info"
81 + # In case we're running as root, make sure files are owned properly
82 + chown -R "mysql:mysql" "$datadir"
83 +
84 if [ -f /home/e-smith/db/mysql57/mysql.dump ]
85 then
86 /sbin/e-smith/expand-template /etc/e-smith/sql/init57/00_restore_dumped_dbs
87 @@ -30,7 +50,8 @@
88 exec /opt/rh/rh-mysql57/root/usr/libexec/mysqld \
89 --defaults-file=/opt/rh/rh-mysql57/root/etc/my.cnf \
90 --basedir=/opt/rh/rh-mysql57/root/usr \
91 - --datadir=/opt/rh/rh-mysql57/root/var/lib/mysql \
92 + --datadir=$datadir \
93 --user=mysql \
94 - --pid-file=/opt/rh/rh-mysql57/root/var/run/mysqld/mysqld.pid \
95 - --socket=/var/lib/mysql/mysql57.sock
96 + --pid-file=/var/run/rh-mysql57-mysqld/mysqld.pid \
97 + --socket=/var/lib/mysql/mysql57.sock \
98 + --lc-messages-dir=/opt/rh/rh-mysql57/root/usr/share/rh-mysql57-mysql/english/

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed