* Added NetBSD support (thanks to Dave Burgess)
* Switched username/password prompts to STDERR so they won't appear in printouts
This commit is contained in:
parent
d98fa91a3d
commit
33928700a3
1 changed files with 11 additions and 7 deletions
|
@ -6,7 +6,8 @@
|
||||||
# http://forge.mysql.com/projects/view.php?id=44
|
# http://forge.mysql.com/projects/view.php?id=44
|
||||||
#
|
#
|
||||||
# Other Contributors:
|
# Other Contributors:
|
||||||
# Paul Kehrer
|
# Paul Kehrer
|
||||||
|
# Dave Burgess
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -103,7 +104,10 @@ sub os_setup {
|
||||||
$duflags = '-b';
|
$duflags = '-b';
|
||||||
} elsif ($os =~ /Darwin/) {
|
} elsif ($os =~ /Darwin/) {
|
||||||
$physical_memory = `sysctl -n hw.memsize`;
|
$physical_memory = `sysctl -n hw.memsize`;
|
||||||
$swap_memory = `sysctl -n vm.swapusage | awk '{print \$3}' | sed 's/\..*\$//'`;
|
$swap_memory = `sysctl -n vm.swapusage | awk '{print \$3}' | sed 's/\..*\$//'`;
|
||||||
|
} elsif ($os =~ /NetBSD/) {
|
||||||
|
$physical_memory = `sysctl -n hw.physmem`;
|
||||||
|
$swap_memory = `swapctl -l | grep '^/' | awk '{ s+= \$2 } END { print s }'`;
|
||||||
} elsif ($os =~ /BSD/) {
|
} elsif ($os =~ /BSD/) {
|
||||||
$physical_memory = `sysctl -n hw.realmem`;
|
$physical_memory = `sysctl -n hw.realmem`;
|
||||||
$swap_memory = `swapinfo | grep '^/' | awk '{ s+= \$2 } END { print s }'`;
|
$swap_memory = `swapinfo | grep '^/' | awk '{ s+= \$2 } END { print s }'`;
|
||||||
|
@ -146,19 +150,19 @@ sub mysql_setup {
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
print "Please enter your MySQL login: ";
|
print STDERR "Please enter your MySQL login: ";
|
||||||
my $name = <>;
|
my $name = <>;
|
||||||
print "Please enter your MySQL password: ";
|
print STDERR "Please enter your MySQL password: ";
|
||||||
system("stty -echo"); #don't show the password
|
system("stty -echo");
|
||||||
my $password = <>;
|
my $password = <>;
|
||||||
system("stty echo"); #plz give echo back
|
system("stty echo");
|
||||||
chomp($password);
|
chomp($password);
|
||||||
chomp($name);
|
chomp($name);
|
||||||
$mysqllogin = "-u $name -p'$password'";
|
$mysqllogin = "-u $name -p'$password'";
|
||||||
my $loginstatus = `mysqladmin ping $mysqllogin 2>&1`;
|
my $loginstatus = `mysqladmin ping $mysqllogin 2>&1`;
|
||||||
if ($loginstatus =~ /mysqld is alive/) {
|
if ($loginstatus =~ /mysqld is alive/) {
|
||||||
# Login was successful, but we won't say anything to save space
|
# Login was successful, but we won't say anything to save space
|
||||||
print "\n";
|
print STDERR "\n";
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
print "\n".$bad." Attempted to use login credentials, but they were invalid.\n";
|
print "\n".$bad." Attempted to use login credentials, but they were invalid.\n";
|
||||||
|
|
Loading…
Reference in a new issue