Changeset 1207


Ignore:
Timestamp:
Jun 24, 2009, 12:40:51 AM (12 years ago)
Author:
mitchb
Message:
Complete overhaul of Joomla autoinstaller for version 1.5.11
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/locker/deploy/bin/joomla

    r697 r1207  
    33use lib '/mit/scripts/deploy/bin';
    44use onserver;
    5 use Cwd;
    65use File::Path;
    76
     
    1312chomp($title);
    1413
    15 fetch_uri(
    16     'installation/install2.php',
    17     {},
    18     {DBhostname => $sqlhost,
    19      DBuserName => $sqluser,
    20      DBpassword => $sqlpass,
    21      DBDel => 0,
    22      DBname => $sqldb,
    23      DBPrefix => 'jos_',
    24      DBSample => 1});
     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;
    2546
    26 fetch_uri(
    27     'installation/install4.php',
    28     {},
    29     {DBhostname => $sqlhost,
    30      DBuserName => $sqluser,
    31      DBpassword => $sqlpass,
    32      DBname => $sqldb,
    33      DBPrefix => 'jos_',
    34      sitename => $title,
    35      siteUrl => $base_uri,
    36      absolutePath => getcwd(),
    37      adminEmail => $email,
    38      adminPassword => $admin_password,
    39      filePerms => 0,
    40      dirPerms => 0});
     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");
    4160
     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";
    4281rmtree('installation');
     82
     83print "\nDone!\n";
     84exit 0;
     85
Note: See TracChangeset for help on using the changeset viewer.