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

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