install.pl bug fix and settings confirmation addition

AST_SERVER_conf.pl changed to lookup /etc/astguiclient.conf file for settings

git-svn-id: svn://192.168.202.10@41 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-07-14 20:34:57 +00:00
parent d9bb783104
commit df19fa53dc
2 changed files with 461 additions and 410 deletions
+54 -15
View File
@@ -5,21 +5,60 @@
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2 # Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# #
# Customized Variables # default path to astguiclient configuration file:
$server_ip = '10.10.10.15'; # Asterisk server IP $PATHconf = '/etc/astguiclient.conf';
$DB_server = 'localhost'; # MySQL server IP
$DB_database = 'asterisk'; # MySQL database name
$DB_user = 'cron'; # MySQL user
$DB_pass = '1234'; # MySQL pass
$DB_port = '3306'; # MySQL connection port
$LOGfile = '/home/cron/LOG_AST_update.log'; open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
$telnetlog = '/home/cron/telnetlog.log'; @conf = <conf>;
$MSLOGfile = '/home/cron/MSLOG_AST_update.log'; close(conf);
$MStelnetlog = '/home/cron/MStelnetlog.log'; $i=0;
$LILOGfile = '/home/cron/LILOG_AST_update.log'; foreach(@conf)
$LItelnetlog = '/home/cron/LItelnetlog.log'; {
$KHLOGfile = '/home/cron/KHLOG_AST_update.log'; $line = $conf[$i];
$VDADLOGfile = '/home/cron/VDLOG_AST_update.log'; $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
# Customized Variables
$server_ip = $VARserver_ip; # Asterisk server IP
$DB_server = $VARDB_server; # MySQL server IP
$DB_database = $VARDB_database; # MySQL database name
$DB_user = $VARDB_user; # MySQL user
$DB_pass = $VARDB_pass; # MySQL pass
$DB_port = $VARDB_por; # MySQL connection port
$LOGfile = "$PATHlogs/LOG_AST_update.log";
$telnetlog = "$PATHlogs/telnetlog.log";
$MSLOGfile = "$PATHlogs/MSLOG_AST_update.log";
$MStelnetlog = "$PATHlogs/MStelnetlog.log";
$LILOGfile = "$PATHlogs/LILOG_AST_update.log";
$LItelnetlog = "$PATHlogs/LItelnetlog.log";
$KHLOGfile = "$PATHlogs/KHLOG_AST_update.log";
$VDADLOGfile = "$PATHlogs/VDLOG_AST_update.log";
return 1; return 1;
+406 -394
View File
@@ -323,539 +323,551 @@ if ($manual =~ /n/i)
} }
else else
{ {
print "\nSTARTING ASTGUICLIENT MANUAL CONFIGURATION PHASE...\n"; $config_finished='NO';
##### BEGIN astguiclient home directory prompting and existence check ##### while ($config_finished =~/NO/)
$continue='NO';
while ($continue =~/NO/)
{ {
print("\nastguiclient home path or press enter for default: [$PATHhome] "); print "\nSTARTING ASTGUICLIENT MANUAL CONFIGURATION PHASE...\n";
$PROMPThome = <STDIN>; ##### BEGIN astguiclient home directory prompting and existence check #####
chomp($PROMPThome); $continue='NO';
if (length($PROMPThome)>2) while ($continue =~/NO/)
{ {
$PROMPThome =~ s/ |\n|\r|\t|\/$//gi; print("\nastguiclient home path or press enter for default: [$PATHhome] ");
if (!-e "$PROMPThome") $PROMPThome = <STDIN>;
chomp($PROMPThome);
if (length($PROMPThome)>2)
{ {
print("$PROMPThome does not exist, would you like me to create it?(y/n) [y] "); $PROMPThome =~ s/ |\n|\r|\t|\/$//gi;
$createPROMPThome = <STDIN>; if (!-e "$PROMPThome")
chomp($createPROMPThome);
if ($createPROMPThome =~ /n/i)
{ {
$continue='NO'; print("$PROMPThome does not exist, would you like me to create it?(y/n) [y] ");
$createPROMPThome = <STDIN>;
chomp($createPROMPThome);
if ($createPROMPThome =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PROMPThome`;
print " $PROMPThome directory created\n";
$PATHhome=$PROMPThome;
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PROMPThome`;
print " $PROMPThome directory created\n";
$PATHhome=$PROMPThome; $PATHhome=$PROMPThome;
$continue='YES'; $continue='YES';
} }
} }
else else
{ {
$PATHhome=$PROMPThome; if (!-e "$PATHhome")
$continue='YES';
}
}
else
{
if (!-e "$PATHhome")
{
print("$PATHhome does not exist, would you like me to create it?(y/n) [y] ");
$createPATHhome = <STDIN>;
chomp($createPATHhome);
if ($createPATHhome =~ /n/i)
{ {
$continue='NO'; print("$PATHhome does not exist, would you like me to create it?(y/n) [y] ");
$createPATHhome = <STDIN>;
chomp($createPATHhome);
if ($createPATHhome =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PATHhome`;
print " $PATHhome directory created\n";
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PATHhome`;
print " $PATHhome directory created\n";
$continue='YES'; $continue='YES';
} }
} }
else
{
$continue='YES';
}
} }
} ##### END astguiclient home directory prompting and existence check #####
##### END astguiclient home directory prompting and existence check #####
##### BEGIN astguiclient logs directory prompting and existence check ##### ##### BEGIN astguiclient logs directory prompting and existence check #####
$continue='NO'; $continue='NO';
while ($continue =~/NO/) while ($continue =~/NO/)
{
print("\nastguiclient logs path or press enter for default: [$PATHlogs] ");
$PROMPTlogs = <STDIN>;
chomp($PROMPTlogs);
if (length($PROMPTlogs)>2)
{ {
$PROMPTlogs =~ s/ |\n|\r|\t|\/$//gi; print("\nastguiclient logs path or press enter for default: [$PATHlogs] ");
if (!-e "$PROMPTlogs") $PROMPTlogs = <STDIN>;
chomp($PROMPTlogs);
if (length($PROMPTlogs)>2)
{ {
print("$PROMPTlogs does not exist, would you like me to create it?(y/n) [y] "); $PROMPTlogs =~ s/ |\n|\r|\t|\/$//gi;
$createPROMPTlogs = <STDIN>; if (!-e "$PROMPTlogs")
chomp($createPROMPTlogs);
if ($createPROMPTlogs =~ /n/i)
{ {
$continue='NO'; print("$PROMPTlogs does not exist, would you like me to create it?(y/n) [y] ");
$createPROMPTlogs = <STDIN>;
chomp($createPROMPTlogs);
if ($createPROMPTlogs =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PROMPTlogs`;
print " $PROMPTlogs directory created\n";
$PATHlogs=$PROMPTlogs;
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PROMPTlogs`;
print " $PROMPTlogs directory created\n";
$PATHlogs=$PROMPTlogs; $PATHlogs=$PROMPTlogs;
$continue='YES'; $continue='YES';
} }
} }
else else
{ {
$PATHlogs=$PROMPTlogs; if (!-e "$PATHlogs")
$continue='YES';
}
}
else
{
if (!-e "$PATHlogs")
{
print("$PATHlogs does not exist, would you like me to create it?(y/n) [y] ");
$createPATHlogs = <STDIN>;
chomp($createPATHlogs);
if ($createPATHlogs =~ /n/i)
{ {
$continue='NO'; print("$PATHlogs does not exist, would you like me to create it?(y/n) [y] ");
$createPATHlogs = <STDIN>;
chomp($createPATHlogs);
if ($createPATHlogs =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p --mode=0666 $PATHlogs`;
print " $PATHlogs directory created\n";
$continue='YES';
}
} }
else else
{ {
`mkdir -p --mode=0666 $PATHlogs`;
print " $PATHlogs directory created\n";
$continue='YES'; $continue='YES';
} }
} }
else
{
$continue='YES';
}
} }
} ##### END astguiclient logs directory prompting and existence check #####
##### END astguiclient logs directory prompting and existence check #####
##### BEGIN asterisk agi-bin directory prompting and existence check ##### ##### BEGIN asterisk agi-bin directory prompting and existence check #####
$continue='NO'; $continue='NO';
while ($continue =~/NO/) while ($continue =~/NO/)
{
print("\nasterisk agi-bin path or press enter for default: [$PATHagi] ");
$PROMPTagi = <STDIN>;
chomp($PROMPTagi);
if (length($PROMPTagi)>2)
{ {
$PROMPTagi =~ s/ |\n|\r|\t|\/$//gi; print("\nasterisk agi-bin path or press enter for default: [$PATHagi] ");
if (!-e "$PROMPTagi") $PROMPTagi = <STDIN>;
chomp($PROMPTagi);
if (length($PROMPTagi)>2)
{ {
print("$PROMPTagi does not exist, would you like me to create it?(y/n) [y] "); $PROMPTagi =~ s/ |\n|\r|\t|\/$//gi;
$createPROMPTagi = <STDIN>; if (!-e "$PROMPTagi")
chomp($createPROMPTagi);
if ($createPROMPTagi =~ /n/i)
{ {
$continue='NO'; print("$PROMPTagi does not exist, would you like me to create it?(y/n) [y] ");
$createPROMPTagi = <STDIN>;
chomp($createPROMPTagi);
if ($createPROMPTagi =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PROMPTagi`;
print " $PROMPTagi directory created\n";
$PATHagi=$PROMPTagi;
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PROMPTagi`;
print " $PROMPTagi directory created\n";
$PATHagi=$PROMPTagi; $PATHagi=$PROMPTagi;
$continue='YES'; $continue='YES';
} }
} }
else else
{ {
$PATHagi=$PROMPTagi; if (!-e "$PATHagi")
$continue='YES';
}
}
else
{
if (!-e "$PATHagi")
{
print("$PATHagi does not exist, would you like me to create it?(y/n) [y] ");
$createPATHagi = <STDIN>;
chomp($createPATHagi);
if ($createPATHagi =~ /n/i)
{ {
$continue='NO'; print("$PATHagi does not exist, would you like me to create it?(y/n) [y] ");
$createPATHagi = <STDIN>;
chomp($createPATHagi);
if ($createPATHagi =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PATHagi`;
print " $PATHagi directory created\n";
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PATHagi`;
print " $PATHagi directory created\n";
$continue='YES'; $continue='YES';
} }
} }
else
{
$continue='YES';
}
} }
} ##### END asterisk agi-bin directory prompting and existence check #####
##### END asterisk agi-bin directory prompting and existence check #####
##### BEGIN server webroot directory prompting and existence check ##### ##### BEGIN server webroot directory prompting and existence check #####
$continue='NO'; $continue='NO';
while ( ($continue =~/NO/) && ($NOWEB < 1) ) while ( ($continue =~/NO/) && ($NOWEB < 1) )
{
print("\nserver webroot path or press enter for default: [$PATHweb] ");
$PROMPTweb = <STDIN>;
chomp($PROMPTweb);
if (length($PROMPTweb)>2)
{ {
$PROMPTweb =~ s/ |\n|\r|\t|\/$//gi; print("\nserver webroot path or press enter for default: [$PATHweb] ");
if (!-e "$PROMPTweb") $PROMPTweb = <STDIN>;
chomp($PROMPTweb);
if (length($PROMPTweb)>2)
{ {
print("$PROMPTweb does not exist, would you like me to create it?(y/n) [y] "); $PROMPTweb =~ s/ |\n|\r|\t|\/$//gi;
$createPROMPTweb = <STDIN>; if (!-e "$PROMPTweb")
chomp($createPROMPTweb);
if ($createPROMPTweb =~ /n/i)
{ {
$continue='NO'; print("$PROMPTweb does not exist, would you like me to create it?(y/n) [y] ");
$createPROMPTweb = <STDIN>;
chomp($createPROMPTweb);
if ($createPROMPTweb =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PROMPTweb`;
print " $PROMPTweb directory created\n";
$PATHweb=$PROMPTweb;
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PROMPTweb`;
print " $PROMPTweb directory created\n";
$PATHweb=$PROMPTweb; $PATHweb=$PROMPTweb;
$continue='YES'; $continue='YES';
} }
} }
else else
{ {
$PATHweb=$PROMPTweb; if (!-e "$PATHweb")
$continue='YES';
}
}
else
{
if (!-e "$PATHweb")
{
print("$PATHweb does not exist, would you like me to create it?(y/n) [y] ");
$createPATHweb = <STDIN>;
chomp($createPATHweb);
if ($createPATHweb =~ /n/i)
{ {
$continue='NO'; print("$PATHweb does not exist, would you like me to create it?(y/n) [y] ");
$createPATHweb = <STDIN>;
chomp($createPATHweb);
if ($createPATHweb =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PATHweb`;
print " $PATHweb directory created\n";
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PATHweb`;
print " $PATHweb directory created\n";
$continue='YES'; $continue='YES';
} }
} }
else
{
$continue='YES';
}
} }
} ##### END server webroot directory prompting and existence check #####
##### END server webroot directory prompting and existence check #####
##### BEGIN asterisk sounds directory prompting and existence check ##### ##### BEGIN asterisk sounds directory prompting and existence check #####
$continue='NO'; $continue='NO';
while ($continue =~/NO/) while ($continue =~/NO/)
{
print("\nasterisk sounds path or press enter for default: [$PATHsounds] ");
$PROMPTsounds = <STDIN>;
chomp($PROMPTsounds);
if (length($PROMPTsounds)>2)
{ {
$PROMPTsounds =~ s/ |\n|\r|\t|\/$//gi; print("\nasterisk sounds path or press enter for default: [$PATHsounds] ");
if (!-e "$PROMPTsounds") $PROMPTsounds = <STDIN>;
chomp($PROMPTsounds);
if (length($PROMPTsounds)>2)
{ {
print("$PROMPTsounds does not exist, would you like me to create it?(y/n) [y] "); $PROMPTsounds =~ s/ |\n|\r|\t|\/$//gi;
$createPROMPTsounds = <STDIN>; if (!-e "$PROMPTsounds")
chomp($createPROMPTsounds);
if ($createPROMPTsounds =~ /n/i)
{ {
$continue='NO'; print("$PROMPTsounds does not exist, would you like me to create it?(y/n) [y] ");
$createPROMPTsounds = <STDIN>;
chomp($createPROMPTsounds);
if ($createPROMPTsounds =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PROMPTsounds`;
print " $PROMPTsounds directory created\n";
$PATHsounds=$PROMPTsounds;
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PROMPTsounds`;
print " $PROMPTsounds directory created\n";
$PATHsounds=$PROMPTsounds; $PATHsounds=$PROMPTsounds;
$continue='YES'; $continue='YES';
} }
} }
else else
{ {
$PATHsounds=$PROMPTsounds; if (!-e "$PATHsounds")
$continue='YES';
}
}
else
{
if (!-e "$PATHsounds")
{
print("$PATHsounds does not exist, would you like me to create it?(y/n) [y] ");
$createPATHsounds = <STDIN>;
chomp($createPATHsounds);
if ($createPATHsounds =~ /n/i)
{ {
$continue='NO'; print("$PATHsounds does not exist, would you like me to create it?(y/n) [y] ");
$createPATHsounds = <STDIN>;
chomp($createPATHsounds);
if ($createPATHsounds =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PATHsounds`;
print " $PATHsounds directory created\n";
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PATHsounds`;
print " $PATHsounds directory created\n";
$continue='YES'; $continue='YES';
} }
} }
else
{
$continue='YES';
}
} }
} ##### END asterisk sounds directory prompting and existence check #####
##### END asterisk sounds directory prompting and existence check #####
##### BEGIN asterisk monitor directory prompting and existence check ##### ##### BEGIN asterisk monitor directory prompting and existence check #####
$continue='NO'; $continue='NO';
while ($continue =~/NO/) while ($continue =~/NO/)
{
print("\nasterisk monitor path or press enter for default: [$PATHmonitor] ");
$PROMPTmonitor = <STDIN>;
chomp($PROMPTmonitor);
if (length($PROMPTmonitor)>2)
{ {
$PROMPTmonitor =~ s/ |\n|\r|\t|\/$//gi; print("\nasterisk monitor path or press enter for default: [$PATHmonitor] ");
if (!-e "$PROMPTmonitor") $PROMPTmonitor = <STDIN>;
chomp($PROMPTmonitor);
if (length($PROMPTmonitor)>2)
{ {
print("$PROMPTmonitor does not exist, would you like me to create it?(y/n) [y] "); $PROMPTmonitor =~ s/ |\n|\r|\t|\/$//gi;
$createPROMPTmonitor = <STDIN>; if (!-e "$PROMPTmonitor")
chomp($createPROMPTmonitor);
if ($createPROMPTmonitor =~ /n/i)
{ {
$continue='NO'; print("$PROMPTmonitor does not exist, would you like me to create it?(y/n) [y] ");
$createPROMPTmonitor = <STDIN>;
chomp($createPROMPTmonitor);
if ($createPROMPTmonitor =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PROMPTmonitor`;
print " $PROMPTmonitor directory created\n";
$PATHmonitor=$PROMPTmonitor;
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PROMPTmonitor`;
print " $PROMPTmonitor directory created\n";
$PATHmonitor=$PROMPTmonitor; $PATHmonitor=$PROMPTmonitor;
$continue='YES'; $continue='YES';
} }
} }
else else
{ {
$PATHmonitor=$PROMPTmonitor; if (!-e "$PATHmonitor")
$continue='YES';
}
}
else
{
if (!-e "$PATHmonitor")
{
print("$PATHmonitor does not exist, would you like me to create it?(y/n) [y] ");
$createPATHmonitor = <STDIN>;
chomp($createPATHmonitor);
if ($createPATHmonitor =~ /n/i)
{ {
$continue='NO'; print("$PATHmonitor does not exist, would you like me to create it?(y/n) [y] ");
$createPATHmonitor = <STDIN>;
chomp($createPATHmonitor);
if ($createPATHmonitor =~ /n/i)
{
$continue='NO';
}
else
{
`mkdir -p $PATHmonitor`;
print " $PATHmonitor directory created\n";
$continue='YES';
}
} }
else else
{ {
`mkdir -p $PATHmonitor`;
print " $PATHmonitor directory created\n";
$continue='YES'; $continue='YES';
} }
} }
}
##### END asterisk monitor directory prompting and existence check #####
##### BEGIN server_ip propmting and check #####
if (length($VARserver_ip)<7)
{
### get best guess of IP address from ifconfig output ###
# inet addr:10.10.11.17 Bcast:10.10.255.255 Mask:255.255.0.0
@ip = `/sbin/ifconfig`;
$j=0;
while($#ip>=$j)
{
if ($ip[$j] =~ /inet addr/) {$VARserver_ip = $ip[$j]; $j=1000;}
$j++;
}
$VARserver_ip =~ s/.*addr:| Bcast.*|\r|\n|\t| //gi;
}
$continue='NO';
while ($continue =~/NO/)
{
print("\nserver IP address or press enter for default: [$VARserver_ip] ");
$PROMPTserver_ip = <STDIN>;
chomp($PROMPTserver_ip);
if (length($PROMPTserver_ip)>6)
{
$PROMPTserver_ip =~ s/ |\n|\r|\t|\/$//gi;
$VARserver_ip=$PROMPTserver_ip;
$continue='YES';
}
else else
{ {
$continue='YES'; $continue='YES';
} }
} }
} ##### END server_ip propmting and check #####
##### END asterisk monitor directory prompting and existence check #####
##### BEGIN server_ip propmting and check #####
if (length($VARserver_ip)<7)
{
### get best guess of IP address from ifconfig output ###
# inet addr:10.10.11.17 Bcast:10.10.255.255 Mask:255.255.0.0
@ip = `/sbin/ifconfig`;
$j=0;
while($#ip>=$j)
{
if ($ip[$j] =~ /inet addr/) {$VARserver_ip = $ip[$j]; $j=1000;}
$j++;
}
$VARserver_ip =~ s/.*addr:| Bcast.*|\r|\n|\t| //gi;
}
$continue='NO'; ##### BEGIN DB_server propmting and check #####
while ($continue =~/NO/) if (length($VARDB_server)<7)
{
print("\nserver IP address or press enter for default: [$VARserver_ip] ");
$PROMPTserver_ip = <STDIN>;
chomp($PROMPTserver_ip);
if (length($PROMPTserver_ip)>6)
{ {
$PROMPTserver_ip =~ s/ |\n|\r|\t|\/$//gi; $VARDB_server = 'localhost';
$VARserver_ip=$PROMPTserver_ip;
$continue='YES';
} }
else $continue='NO';
while ($continue =~/NO/)
{ {
$continue='YES'; print("\nDB server address or press enter for default: [$VARDB_server] ");
$PROMPTDB_server = <STDIN>;
chomp($PROMPTDB_server);
if (length($PROMPTDB_server)>6)
{
$PROMPTDB_server =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_server=$PROMPTDB_server;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_server propmting and check #####
##### BEGIN DB_database propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB database name or press enter for default: [$VARDB_database] ");
$PROMPTDB_database = <STDIN>;
chomp($PROMPTDB_database);
if (length($PROMPTDB_database)>6)
{
$PROMPTDB_database =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_database=$PROMPTDB_database;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_database propmting and check #####
##### BEGIN DB_user propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB user login or press enter for default: [$VARDB_user] ");
$PROMPTDB_user = <STDIN>;
chomp($PROMPTDB_user);
if (length($PROMPTDB_user)>6)
{
$PROMPTDB_user =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_user=$PROMPTDB_user;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_user propmting and check #####
##### BEGIN DB_pass propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB user password or press enter for default: [$VARDB_pass] ");
$PROMPTDB_pass = <STDIN>;
chomp($PROMPTDB_pass);
if (length($PROMPTDB_pass)>6)
{
$PROMPTDB_pass =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_pass=$PROMPTDB_pass;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_pass propmting and check #####
##### BEGIN DB_port propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB connection port or press enter for default: [$VARDB_port] ");
$PROMPTDB_port = <STDIN>;
chomp($PROMPTDB_port);
if (length($PROMPTDB_port)>6)
{
$PROMPTDB_port =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_port=$PROMPTDB_port;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_port propmting and check #####
print "\n";
print " defined home path: $PATHhome\n";
print " defined logs path: $PATHlogs\n";
print " defined agi-bin path: $PATHagi\n";
print " defined webroot path: $PATHweb\n";
print " defined sounds path: $PATHsounds\n";
print " defined monitor path: $PATHmonitor\n";
print " defined server_ip: $VARserver_ip\n";
print " defined DB_server: $VARDB_server\n";
print " defined DB_database: $VARDB_database\n";
print " defined DB_user: $VARDB_user\n";
print " defined DB_pass: $VARDB_pass\n";
print " defined DB_port: $VARDB_port\n";
print "\n";
print("Are these settings correct?(y/n): [y] ");
$PROMPTconfig = <STDIN>;
chomp($PROMPTconfig);
if ( (length($PROMPTconfig)>0) or ($PROMPTconfig =~ /y/i) )
{
$config_finished='YES';
} }
} }
##### END server_ip propmting and check #####
##### BEGIN DB_server propmting and check #####
if (length($VARDB_server)<7)
{
$VARDB_server = 'localhost';
}
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB server address or press enter for default: [$VARDB_server] ");
$PROMPTserver_ip = <STDIN>;
chomp($PROMPTDB_server);
if (length($PROMPTDB_server)>6)
{
$PROMPTDB_server =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_server=$PROMPTDB_server;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_server propmting and check #####
##### BEGIN DB_database propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB database name or press enter for default: [$VARDB_database] ");
$PROMPTserver_ip = <STDIN>;
chomp($PROMPTDB_database);
if (length($PROMPTDB_database)>6)
{
$PROMPTDB_database =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_database=$PROMPTDB_database;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_database propmting and check #####
##### BEGIN DB_user propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB user login or press enter for default: [$VARDB_user] ");
$PROMPTserver_ip = <STDIN>;
chomp($PROMPTDB_user);
if (length($PROMPTDB_user)>6)
{
$PROMPTDB_user =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_user=$PROMPTDB_user;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_user propmting and check #####
##### BEGIN DB_pass propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB user password or press enter for default: [$VARDB_pass] ");
$PROMPTserver_ip = <STDIN>;
chomp($PROMPTDB_pass);
if (length($PROMPTDB_pass)>6)
{
$PROMPTDB_pass =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_pass=$PROMPTDB_pass;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_pass propmting and check #####
##### BEGIN DB_port propmting and check #####
$continue='NO';
while ($continue =~/NO/)
{
print("\nDB connection port or press enter for default: [$VARDB_port] ");
$PROMPTserver_ip = <STDIN>;
chomp($PROMPTDB_port);
if (length($PROMPTDB_port)>6)
{
$PROMPTDB_port =~ s/ |\n|\r|\t|\/$//gi;
$VARDB_port=$PROMPTDB_port;
$continue='YES';
}
else
{
$continue='YES';
}
}
##### END DB_port propmting and check #####
print "Writing to astguiclient.conf file: $PATHconf\n";
open(conf, ">$PATHconf") || die "can't open $PATHconf: $!\n";
print conf "# astguiclient.conf - configuration elements for the astguiclient package\n";
print conf "# this is the astguiclient configuration file \n";
print conf "# all comments will be lost if you run install.pl again\n";
print conf "\n";
print conf "PATHhome => $PATHhome\n";
print conf "PATHlogs => $PATHlogs\n";
print conf "PATHagi => $PATHagi\n";
print conf "PATHweb => $PATHweb\n";
print conf "PATHsounds => $PATHsounds\n";
print conf "PATHmonitor => $PATHmonitor\n\n";
print conf "VARserver_ip => $VARserver_ip\n";
print conf "VARDB_server => $VARDB_server\n";
print conf "VARDB_database => $VARDB_database\n";
print conf "VARDB_user => $VARDB_user\n";
print conf "VARDB_pass => $VARDB_pass\n";
print conf "VARDB_port => $VARDB_port\n";
close(conf);
print "\n";
print " defined home path: $PATHhome\n";
print " defined logs path: $PATHlogs\n";
print " defined agi-bin path: $PATHagi\n";
print " defined webroot path: $PATHweb\n";
print " defined sounds path: $PATHsounds\n";
print " defined monitor path: $PATHmonitor\n";
print " defined server_ip: $VARserver_ip\n";
print " defined DB_server: $VARDB_server\n";
print " defined DB_database: $VARDB_database\n";
print " defined DB_user: $VARDB_user\n";
print " defined DB_pass: $VARDB_pass\n";
print " defined DB_port: $VARDB_port\n";
print "\n";
} }
print "Writing to astguiclient.conf file: $PATHconf\n";
open(conf, ">$PATHconf") || die "can't open $PATHconf: $!\n";
print conf "# astguiclient.conf - configuration elements for the astguiclient package\n";
print conf "# this is the astguiclient configuration file \n";
print conf "# all comments will be lost if you run install.pl again\n";
print conf "\n";
print conf "PATHhome => $PATHhome\n";
print conf "PATHlogs => $PATHlogs\n";
print conf "PATHagi => $PATHagi\n";
print conf "PATHweb => $PATHweb\n";
print conf "PATHsounds => $PATHsounds\n";
print conf "PATHmonitor => $PATHmonitor\n\n";
print conf "VARserver_ip => $VARserver_ip\n";
print conf "VARDB_server => $VARDB_server\n";
print conf "VARDB_database => $VARDB_database\n";
print conf "VARDB_user => $VARDB_user\n";
print conf "VARDB_pass => $VARDB_pass\n";
print conf "VARDB_port => $VARDB_port\n";
close(conf);
print "\nSTARTING ASTGUICLIENT INSTALLATION PHASE...\n"; print "\nSTARTING ASTGUICLIENT INSTALLATION PHASE...\n";
if ($WEBONLY < 1) if ($WEBONLY < 1)