[Pkg-mysql-commits] r1562 - mysql-dfsg-5.1/branches/experimental/debian

Norbert Tretkowski nobse at alioth.debian.org
Tue Apr 7 11:15:18 UTC 2009


Author: nobse
Date: 2009-04-07 11:15:18 +0000 (Tue, 07 Apr 2009)
New Revision: 1562

Modified:
   mysql-dfsg-5.1/branches/experimental/debian/changelog
   mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.postinst
Log:
Revert change to use mysql_fix_privilege_table

Modified: mysql-dfsg-5.1/branches/experimental/debian/changelog
===================================================================
--- mysql-dfsg-5.1/branches/experimental/debian/changelog	2009-04-07 10:48:58 UTC (rev 1561)
+++ mysql-dfsg-5.1/branches/experimental/debian/changelog	2009-04-07 11:15:18 UTC (rev 1562)
@@ -1,6 +1,5 @@
 mysql-dfsg-5.1 (5.1.33-2) UNRELEASED; urgency=low
 
-  * Use mysql_fix_privilege_tables.sql to fix privilege tables.
   * Remove no longer active developers from uploaders.
 
  -- Norbert Tretkowski <nobse at debian.org>  Tue, 07 Apr 2009 11:23:25 +0200

Modified: mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.postinst
===================================================================
--- mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.postinst	2009-04-07 10:48:58 UTC (rev 1561)
+++ mysql-dfsg-5.1/branches/experimental/debian/mysql-server-5.1.postinst	2009-04-07 11:15:18 UTC (rev 1562)
@@ -186,14 +186,69 @@
     chown 0:0 $dc
     chmod 0600 $dc
 
+    # update privilege tables
+    password_column_fix_query=`/bin/echo -e \
+        "USE mysql\n" \
+        "ALTER TABLE user CHANGE Password Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL"`;
+    replace_query=`/bin/echo -e \
+        "USE mysql\n" \
+        "REPLACE INTO user SET " \
+        "  host='localhost', user='debian-sys-maint', password=password('$pass'), " \
+        "  Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \
+        "  Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \
+        "  Process_priv='Y',  File_priv='Y', Grant_priv='Y', References_priv='Y', " \
+        "  Index_priv='Y', Alter_priv='Y' __EXTRA_PRIVS__"`;
+    extra_privs=`/bin/echo -e \
+        ", Show_db_priv='Y' " \
+        ", Super_priv='Y' " \
+        ", Create_tmp_table_priv='Y' " \
+        ", Lock_tables_priv='Y' " \
+        ", Execute_priv='Y' " \
+        ", Repl_slave_priv='Y' " \
+        ", Repl_client_priv='Y' " \
+        ", Create_view_priv='Y' " \
+        ", Show_view_priv='Y' " \
+        ", Create_routine_priv='Y' " \
+        ", Alter_routine_priv='Y' " \
+        ", Create_user_priv='Y' " \
+        ", Event_priv='Y' " \
+        ", Trigger_priv='Y' " `;
+    fix_privs=`/bin/echo -e \
+        "USE mysql;\n" \
+        "ALTER TABLE user ADD column Create_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
+        "ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
+        "ALTER TABLE user ADD column Create_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
+        "ALTER TABLE user ADD column Alter_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
+        "ALTER TABLE user ADD column Create_user_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
+        "ALTER TABLE user ADD column Event_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
+        "ALTER TABLE user ADD column Trigger_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " `
+    # Engines supported by etch should be installed per default. The query sequence is supposed
+    # to be aborted if the CREATE TABLE fails due to an already existent table in which case the
+    # admin might already have chosen to remove one or more plugins. Newlines are necessary.
+    install_plugins=`/bin/echo -e \
+        "USE mysql;\n" \
+        "CREATE TABLE plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \
+        "  dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \
+        "  PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';\n" \
+        "INSERT INTO plugin VALUES ('innodb',    'ha_innodb.so');\n" \
+        "INSERT INTO plugin VALUES ('federated', 'ha_federated.so');\n" \
+        "INSERT INTO plugin VALUES ('blackhole', 'ha_blackhole.so');\n" \
+        "INSERT INTO plugin VALUES ('archive',   'ha_archive.so');" `
+
+    # Upgrade password column format before the root password gets set.
+    echo "$password_column_fix_query"                             | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
+
     db_get mysql-server/root_password && rootpw="$RET"
     if ! set_mysql_rootpw; then
         password_error="yes"
     fi
 
-    # update privilege tables
-    echo "use mysql; `cat /usr/share/mysql/mysql_fix_privilege_tables.sql`" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
-
+    echo "$fix_privs"                                             | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
+    echo "$replace_query" | sed "s/__EXTRA_PRIVS__//"             | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
+    set +e
+    echo "$replace_query" | sed "s/__EXTRA_PRIVS__/$extra_privs/" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
+    echo "$install_plugins"                                       | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
+    set -e
   ;;
 
   abort-upgrade|abort-remove|abort-configure)




More information about the Pkg-mysql-commits mailing list