#!/usr/bin/perl
use strict;
use lib '/mit/scripts/deploy/bin';
use onserver;

setup();

undef $/;
open(FILE, "include/contemp.php");
my $a = <FILE>;
close(FILE);
$a =~ s/localhost/$sqlhost/g;
$a =~ s/dbuser/$sqluser/g;
$a =~ s/dbpass/$sqlpass/g;
$a =~ s/polldb/$sqldb/g;
open(FILE, ">include/config.inc.php");
print FILE $a;
close(FILE);

fetch_uri('install.php', {action => 'step_2'});
fetch_uri('install.php', {action => 'step_3'});
fetch_uri('install.php', {action => 'step_4'});

fetch_uri(
    'install.php',
    {action => 'step_6'},
    {action => 'step_6',
     username => $admin_username,
     password => $admin_password});

unlink('include/contemp.php');

print <<END;
Your $sname Admin Panel is at
http://$server/~$USER/$addrend/admin
You can use this admin panel to create your first poll.
END
press_enter();
