/[libdata]/branches/paul/admin/install/libload.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /branches/paul/admin/install/libload.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 67 - (show annotations)
Thu Mar 18 19:24:54 2004 UTC (20 years, 1 month ago) by dpavlin
File MIME type: text/plain
File size: 4507 byte(s)
updated to libdata 2.00

1 #!/usr/bin/perl
2
3 print `clear`;
4 print ("************************************************************\n");
5 print ("** LibData OS Rel. 1.0 mySQL Database Loader - 10.06.2003 **\n");
6 print ("************************************************************\n");
7 print ("** WARNING! Do NOT run this script if you have a current **\n");
8 print ("** LibData installation. It will purge required libdata **\n");
9 print ("** databases and libdata users from the mysql.user and **\n");
10 print ("** mysql.db tables. **\n");
11 print ("************************************************************\n");
12 print ("** NOTE: This script works only against mySQL 3.x. **\n");
13 print ("** Since the number of columns in the mysql.user table **\n");
14 print ("** and potential security issues differ between 3.x and **\n");
15 print ("** 4.x, some modifications to the create.sql script are **\n");
16 print ("** necessary. **\n");
17 print ("************************************************************\n\n");
18 print ("This script performs the following installation steps:\n");
19 print ("(1) Prompt for a mySQL account (typically root) and password\n");
20 print (" capable of creating/dropping databases, modifying the\n");
21 print (" grants tables, and reloading/refreshing them.\n");
22 print ("(2) It will then confirm your decision and DESTROY any\n");
23 print (" currently existing mySQL databases named libdata, libstats,\n");
24 print (" or libsession.\n");
25 print ("(3) The libdata and libsession users in the mysql.user table\n");
26 print (" will be purged, as well as references to these databases\n");
27 print (" in the mysql.db table.\n");
28 print ("(4) New libdata, libstats, and libsession databases will be\n");
29 print (" created. They'll be populated with minimal data sets.\n");
30 print ("(5) New entries for libdata and libsession will be added with\n");
31 print (" minimal required SQL rights to the mysql.user and mysql.db\n");
32 print (" grants tables.\n\n");
33
34 print ("************************************************************\n");
35 print ("** Do NOT run this script if there is data in libdata, **\n");
36 print ("** libstats, or libsession databases that you wish to **\n");
37 print ("** keep! **\n");
38 print ("************************************************************\n\n");
39
40 # collect inputs
41
42
43 # This part commented out for now - not a good idea to offer this capability?
44 # print ("DNS name or IP of the mySQL host upon which to install lidata: ");
45 # my $mysql_host;
46 # $mysql_host = <STDIN>;
47 # chomp($mysql_host);
48
49 print ("mySQL user name capable of adding/dropping databases: ");
50 my $mysql_user;
51 $mysql_user = <STDIN>;
52 chomp($mysql_user);
53
54 print ("mySQL password associated with the specified user: ");
55 use Term::ReadKey;
56 ReadMode('noecho');
57 $mysql_pwd = ReadLine(0);
58 chomp($mysql_pwd);
59 ReadMode('normal');
60
61 # confirm for delete, display settings
62 print ("\n\nYou entered:\n");
63 print ("mySQL server name: $mysql_host\n");
64 print ("mySQL user name: $mysql_user\n");
65
66 print ("Continue with install? WARNING: This will DROP any databases \n");
67 print ("named libdata, libstats, and session on the specified mySQL\n");
68 print ("server. Type YES (caps) if you wish to continue.\n\n");
69
70 print ("Load fresh LibData installation? ");
71 my $load_flag;
72 $load_flag = <STDIN>;
73 chomp($load_flag);
74
75 if ($load_flag eq "YES") {
76
77 # dump existing libdata, libstats, session
78 print ( "Dropping libdata, libstats, and session databases!\n" );
79 `cat drop.sql | mysql -u$mysql_user -p$mysql_pwd`;
80
81 # create new databases
82 print ("Creating new libdata, libstats and libsessions databases.\n");
83 `cat create.sql | mysql -u$mysql_user -p$mysql_pwd`;
84
85 print ("Populating libdata tables & data.\n");
86 `cat libdata.sql | mysql -u$mysql_user -p$mysql_pwd libdata`;
87
88 print ("Populating libstats tables.\n");
89 `cat libstats.sql | mysql -u$mysql_user -p$mysql_pwd libstats`;
90
91 print ("Populating libsession tables.\n");
92 `cat libsession.sql | mysql -u$mysql_user -p$mysql_pwd libsession`;
93
94 # refresh/reload grants tables
95 print("Reloading and refreshing the mySQL grants tables.\n");
96 `mysqladmin -u$mysql_user -p$mysql_pwd refresh`;
97 `mysqladmin -u$mysql_user -p$mysql_pwd reload`;
98
99 # The "done" message
100 print ("\nInstallation steps finished. Script terminated.\n");
101
102 }
103
104 else {
105
106 print ("Installation cancelled. No changes made.\n\n");
107
108 }
109

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26