summaryrefslogtreecommitdiff
path: root/net/rtg/files/patch-etc_createdb.in
diff options
context:
space:
mode:
Diffstat (limited to 'net/rtg/files/patch-etc_createdb.in')
-rw-r--r--net/rtg/files/patch-etc_createdb.in146
1 files changed, 146 insertions, 0 deletions
diff --git a/net/rtg/files/patch-etc_createdb.in b/net/rtg/files/patch-etc_createdb.in
new file mode 100644
index 000000000000..4c9826397a6b
--- /dev/null
+++ b/net/rtg/files/patch-etc_createdb.in
@@ -0,0 +1,146 @@
+--- etc/createdb.in.orig 2018-04-02 22:52:32 UTC
++++ etc/createdb.in
+@@ -23,11 +23,8 @@ echo ""
+
+ # Create the necessary SQL in two /tmp files
+ cat <<EOT >/tmp/mysql.sql
+-INSERT INTO user (Host, User, Password) VALUES ('$HOST','$USER',PASSWORD("$RTGPASS"));
+-INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
+-Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv)
+-VALUES ('$HOST','$DATABASE','$USER','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+-FLUSH PRIVILEGES;
++CREATE USER '$USER'@'$HOST' IDENTIFIED BY '$RTG_PASS';
++GRANT ALL ON '$DATABASE'.* TO '$USER'@'$HOST';
+ EOT
+
+ cat <<EOT >/tmp/rtg.sql
+@@ -35,81 +32,81 @@ cat <<EOT >/tmp/rtg.sql
+ # Table structure for table 'router'
+ #
+
+-CREATE TABLE router (
+- rid int(11) unsigned NOT NULL auto_increment,
+- name char(120) NOT NULL default '',
+- pop char(10) NOT NULL default '',
+- popid tinyint(3) unsigned NOT NULL default '0',
+- PRIMARY KEY (rid)
++CREATE TABLE `router` (
++ `rid` int(11) unsigned NOT NULL auto_increment,
++ `name` char(120) NOT NULL default '',
++ `pop` char(10) NOT NULL default '',
++ `popid` tinyint(3) unsigned NOT NULL default '0',
++ PRIMARY KEY (`rid`)
+ );
+
+ #
+ # Table structure for table 'interface'
+ #
+
+-CREATE TABLE interface (
+- id int(11) unsigned NOT NULL auto_increment,
+- name char(255) NOT NULL default '',
+- rid int(11) NOT NULL default '0',
+- speed bigint(11) default NULL,
+- description char(255) default NULL,
+- status enum('active','inactive') default 'active',
+- PRIMARY KEY (id)
++CREATE TABLE `interface` (
++ `id` int(11) unsigned NOT NULL auto_increment,
++ `name` char(255) NOT NULL default '',
++ `rid` int(11) NOT NULL default '0',
++ `speed` bigint(11) default NULL,
++ `description` char(255) default NULL,
++ `status` enum('active','inactive') default 'active',
++ PRIMARY KEY (`id`)
+ );
+
+ #
+ # Table structure for table 'ifInOctets'
+ #
+
+-CREATE TABLE ifInOctets (
+- id int(11) NOT NULL default '0',
+- dtime datetime NOT NULL default '0000-00-00 00:00:00',
+- counter bigint(20) NOT NULL default '0',
+- KEY ifInOctets_idx (dtime)
++CREATE TABLE `ifInOctets` (
++ `id` int(11) NOT NULL default '0',
++ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++ `counter` bigint(20) NOT NULL default '0',
++ KEY `ifInOctets_idx` (`dtime`)
+ );
+
+ #
+ # Table structure for table 'ifOutOctets'
+ #
+
+-CREATE TABLE ifOutOctets (
+- id int(11) NOT NULL default '0',
+- dtime datetime NOT NULL default '0000-00-00 00:00:00',
+- counter bigint(20) NOT NULL default '0',
+- KEY ifOutOctets_idx (dtime)
++CREATE TABLE `ifOutOctets` (
++ `id` int(11) NOT NULL default '0',
++ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++ `counter` bigint(20) NOT NULL default '0',
++ KEY `ifOutOctets_idx` (`dtime`)
+ );
+
+ #
+ # Table structure for table 'ifInUcastPkts'
+ #
+
+-CREATE TABLE ifInUcastPkts (
+- id int(11) NOT NULL default '0',
+- dtime datetime NOT NULL default '0000-00-00 00:00:00',
+- counter bigint(20) NOT NULL default '0',
+- KEY ifInUcastPkts_idx (dtime)
++CREATE TABLE `ifInUcastPkts` (
++ `id` int(11) NOT NULL default '0',
++ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++ `counter` bigint(20) NOT NULL default '0',
++ KEY `ifInUcastPkts_idx` (`dtime`)
+ );
+
+ #
+ # Table structure for table 'ifOutUcastPkts'
+ #
+
+-CREATE TABLE ifOutUcastPkts (
+- id int(11) NOT NULL default '0',
+- dtime datetime NOT NULL default '0000-00-00 00:00:00',
+- counter bigint(20) NOT NULL default '0',
+- KEY ifOutUcastPkts_idx (dtime)
++CREATE TABLE `ifOutUcastPkts` (
++ `id` int(11) NOT NULL default '0',
++ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++ `counter` bigint(20) NOT NULL default '0',
++ KEY `ifOutUcastPkts_idx` (`dtime`)
+ );
+
+ #
+ # Table structure for table 'ifInErrors'
+ #
+
+-CREATE TABLE ifInErrors (
+- id int(11) NOT NULL default '0',
+- dtime datetime NOT NULL default '0000-00-00 00:00:00',
+- counter bigint(20) NOT NULL default '0',
+- KEY ifInErrors_idx (dtime)
++CREATE TABLE `ifInErrors` (
++ `id` int(11) NOT NULL default '0',
++ `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++ `counter` bigint(20) NOT NULL default '0',
++ KEY `ifInErrors_idx` (`dtime`)
+ );
+ EOT
+
+@@ -117,8 +114,6 @@ echo "Adding user \"$USER\" to MySQL dat
+ cat /tmp/mysql.sql | $MYSQLBIN/mysql -u root -p$ROOTPASS mysql
+ echo "Creating RTG database \"$DATABASE\"..."
+ $MYSQLBIN/mysqladmin -u root -p$ROOTPASS create $DATABASE
+-echo "Reloading MySQL privileges..."
+-$MYSQLBIN/mysqladmin -u root -p$ROOTPASS flush-privileges
+ echo "Creating RTG tables..."
+ cat /tmp/rtg.sql | $MYSQLBIN/mysql -u $USER -p$RTGPASS $DATABASE
+ echo "Done."