/[libdata]/trunk/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

Annotation of /trunk/admin/install/libload.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 72 - (hide annotations)
Thu Mar 18 20:33:37 2004 UTC (20 years, 1 month ago) by dpavlin
File MIME type: text/plain
File size: 3992 byte(s)
changes made in version 2.00

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26