/[libdata]/branches/paul_xx/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 /branches/paul_xx/admin/install/libload.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69 - (hide annotations)
Thu Mar 18 20:01:09 2004 UTC (20 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 4435 byte(s)
current libdata with replaced mysql_* calls to xx_*

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 dpavlin 67 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 dpavlin 1 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 dpavlin 69 # my $xx_host;
46     # $xx_host = <STDIN>;
47     # chomp($xx_host);
48 dpavlin 1
49     print ("mySQL user name capable of adding/dropping databases: ");
50 dpavlin 69 my $xx_user;
51     $xx_user = <STDIN>;
52     chomp($xx_user);
53 dpavlin 1
54     print ("mySQL password associated with the specified user: ");
55     use Term::ReadKey;
56     ReadMode('noecho');
57 dpavlin 69 $xx_pwd = ReadLine(0);
58     chomp($xx_pwd);
59 dpavlin 1 ReadMode('normal');
60    
61     # confirm for delete, display settings
62     print ("\n\nYou entered:\n");
63 dpavlin 69 print ("mySQL server name: $xx_host\n");
64     print ("mySQL user name: $xx_user\n");
65 dpavlin 1
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 dpavlin 69 `cat drop.sql | mysql -u$xx_user -p$xx_pwd`;
80 dpavlin 1
81     # create new databases
82     print ("Creating new libdata, libstats and libsessions databases.\n");
83 dpavlin 69 `cat create.sql | mysql -u$xx_user -p$xx_pwd`;
84 dpavlin 1
85     print ("Populating libdata tables & data.\n");
86 dpavlin 69 `cat libdata.sql | mysql -u$xx_user -p$xx_pwd libdata`;
87 dpavlin 1
88     print ("Populating libstats tables.\n");
89 dpavlin 69 `cat libstats.sql | mysql -u$xx_user -p$xx_pwd libstats`;
90 dpavlin 1
91     print ("Populating libsession tables.\n");
92 dpavlin 69 `cat libsession.sql | mysql -u$xx_user -p$xx_pwd libsession`;
93 dpavlin 1
94     # refresh/reload grants tables
95     print("Reloading and refreshing the mySQL grants tables.\n");
96 dpavlin 69 `mysqladmin -u$xx_user -p$xx_pwd refresh`;
97     `mysqladmin -u$xx_user -p$xx_pwd reload`;
98 dpavlin 1
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