source: trunk/locker/deploy/bin/joomla @ 1215

Last change on this file since 1215 was 1207, checked in by mitchb, 15 years ago
Complete overhaul of Joomla autoinstaller for version 1.5.11
  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/usr/bin/perl
2use strict;
3use lib '/mit/scripts/deploy/bin';
4use onserver;
5use File::Path;
6
7setup();
8
9print "\nPlease decide upon a title for your site and enter it below.\n";
10print "Desired title: ";
11my $title = <STDIN>;
12chomp($title);
13
14print "\nSetting up your configuration file...\n";
15open CONFIGTEMPLATE, "configuration.php-dist";
16open CONFIGURATION, ">configuration.php";
17while (<CONFIGTEMPLATE>) {
18  chomp;
19  if (/var \$sitename /) {
20    $_ = "      var \$sitename = '$title';";
21  } elsif (/var \$dbtype /) {
22    $_ = "      var \$dbtype = 'mysql';";
23  } elsif (/var \$host /) {
24    $_ = "      var \$host = '$sqlhost';";
25  } elsif (/var \$user /) {
26    $_ = "      var \$user = '$sqluser';";
27  } elsif (/var \$password /) {
28    $_ = "      var \$password = '$sqlpass';";
29  } elsif (/var \$db /) {
30    $_ = "      var \$db = '$sqldb';";
31  } elsif (/var \$dbprefix /) {
32    $_ = "      var \$dbprefix = 'jos_';";
33  } elsif (/var \$secret /) {
34    my $random = `dd if=/dev/urandom bs=1k count=1 | md5sum | cut -c1-32`;
35    $random =~ s/\n//;
36    $_ = "      var \$secret = '$random';";
37  } elsif (/var \$mailfrom /) {
38    $_ = "      var \$mailfrom = '$email';";
39  } elsif (/var \$fromname /) {
40    $_ = "      var \$fromname = '$title';";
41  }
42  print CONFIGURATION "$_\n";
43}
44close CONFIGURATION;
45close CONFIGTEMPLATE;
46
47print "\nInitializing database schema...\n";
48my $schemafile = "installation/sql/mysql/joomla-real.sql";
49open SCHEMATEMPLATE, "installation/sql/mysql/joomla.sql";
50open SCHEMA, ">$schemafile";
51while (<SCHEMATEMPLATE>) {
52  if (/#__/) {
53    $_ =~ s/#__/jos_/g;
54  }
55  print SCHEMA "$_";
56}
57close SCHEMA;
58close SCHEMATEMPLATE;
59system("cat $schemafile | mysql $sqldb");
60
61print "\nLoading sample data...\n";
62my $sampledatafile = "installation/sql/mysql/sample_data-real.sql";
63open SAMPLETEMPLATE, "installation/sql/mysql/sample_data.sql";
64open SAMPLE, ">$sampledatafile";
65while (<SAMPLETEMPLATE>) {
66  if (/#__/) {
67    $_ =~ s/#__/jos_/g;
68  }
69  print SAMPLE "$_";
70}
71close SAMPLE;
72close SAMPLETEMPLATE;
73system("cat $sampledatafile | mysql $sqldb");
74
75print "\nCreating your admin account...\n";
76system("mysql -e \"INSERT INTO jos_users VALUES (62, 'Administrator', '$admin_username', '$email', MD5('$admin_password'), 'Super Administrator', 0, 1, 25, NOW(), NOW(), '', '')\" $sqldb");
77system("mysql -e \"INSERT INTO jos_core_acl_aro VALUES (10, 'users', '62', 0, 'Administrator', 0)\" $sqldb");
78system("mysql -e \"INSERT INTO jos_core_acl_groups_aro_map VALUES (25, '', 10)\" $sqldb");
79
80print "\nCleaning up installation tree...\n";
81rmtree('installation');
82
83print "\nDone!\n";
84exit 0;
85
Note: See TracBrowser for help on using the repository browser.