More cleanup.

This commit is contained in:
Elijah Perrault committed 2011-02-06 21:25:30 -07:00
1 parent 8ba8bf4d43
commit 02bb546587
1 file changed
+24 -24
+24 -24
View File
@@ -101,7 +101,7 @@ println <<'EOF';
88 8 88 8 88 8 8 88 8 88 8 88 8 8
88 8 88ee8 88 8eee8 88 8 88ee8 88 8eee8
EOF EOF
println "* ".NAME." (version ".VER.".".SVER.".".REV.RSTAGE.") is starting up..."; println '* '.NAME.' (version '.VER.'.'.SVER.'.'.REV.RSTAGE.') is starting up...';
our ($APID, %TIMERS); our ($APID, %TIMERS);
@@ -136,12 +136,12 @@ if (!$NUC and RSTAGE ne 'd') {
$dll = $c; $dll = $c;
} }
elsif ($v eq 'version') { elsif ($v eq 'version') {
if (VER.".".SVER.".".REV.RSTAGE ne $c) { if (VER.'.'.SVER.'.'.REV.RSTAGE ne $c) {
println("!!! NOTICE !!! Your copy of Auto is outdated. Current version: ".VER.".".SVER.".".REV.RSTAGE." - Latest version: ".$c); println('!!! NOTICE !!! Your copy of Auto is outdated. Current version: '.VER.'.'.SVER.'.'.REV.RSTAGE.' - Latest version: '.$c);
println("!!! NOTICE !!! You can get the latest Auto by downloading ".$dll); println('!!! NOTICE !!! You can get the latest Auto by downloading '.$dll);
} }
else { else {
println("* Auto is up-to-date."); println('* Auto is up-to-date.');
} }
} }
} }
@@ -153,15 +153,15 @@ if ($ENFEAT =~ /ipv6/) {
} }
# Parse configuration file. # Parse configuration file.
println "* Parsing configuration file auto.conf..."; println '* Parsing configuration file auto.conf...';
our $CONF = Parser::Config->new("auto.conf") or err(1, "Failed to parse configuration file!", 1); our $CONF = Parser::Config->new('auto.conf') or err(1, 'Failed to parse configuration file!', 1);
our %SETTINGS = $CONF->parse or err(1, "Failed to parse configuration file!", 1); our %SETTINGS = $CONF->parse or err(1, 'Failed to parse configuration file!', 1);
println " Success"; println ' Success';
if (conf_get("die")) { if (conf_get('die')) {
if ((conf_get("die"))[0][0] == 1) { if ((conf_get('die'))[0][0] == 1) {
println "!!! You didn't read the whole config."; println "!!! You didn't read the whole config.";
println "!!! Insert new user then try again."; println '!!! Insert new user then try again.';
exit; exit;
} }
} }
@@ -171,7 +171,7 @@ my @REQCVALS = qw(locale expire_logs server fantasy_pf);
foreach my $REQCVAL (@REQCVALS) { foreach my $REQCVAL (@REQCVALS) {
if (!conf_get($REQCVAL)) { if (!conf_get($REQCVAL)) {
my $err = 2; my $err = 2;
if ($REQCVAL eq "expire_logs") { if ($REQCVAL eq 'expire_logs') {
$err = 1; $err = 1;
} }
err($err, "Missing required configuration value: $REQCVAL", 1); err($err, "Missing required configuration value: $REQCVAL", 1);
@@ -180,12 +180,12 @@ foreach my $REQCVAL (@REQCVALS) {
undef @REQCVALS; undef @REQCVALS;
# Parse translations. # Parse translations.
println "* Parsing translation files..."; println '* Parsing translation files...';
our $LOCALE = (conf_get("locale"))[0][0]; our $LOCALE = (conf_get('locale'))[0][0];
my @lang = split('_', $LOCALE); my @lang = split('_', $LOCALE);
Parser::Lang::parse($lang[0]) or err(2, "Failed to parse translation files!", 1); Parser::Lang::parse($lang[0]) or err(2, 'Failed to parse translation files!', 1);
undef @lang; undef @lang;
println " Success"; println ' Success';
# Expire old logs. # Expire old logs.
API::Log::expire_logs(); API::Log::expire_logs();
@@ -196,9 +196,9 @@ DB::load();
# Parse privileges. # Parse privileges.
our (%PRIVILEGES); our (%PRIVILEGES);
# If there are any privsets. # If there are any privsets.
if (conf_get("privset")) { if (conf_get('privset')) {
# Get them. # Get them.
my %tcprivs = conf_get("privset"); my %tcprivs = conf_get('privset');
foreach my $tckpriv (keys %tcprivs) { foreach my $tckpriv (keys %tcprivs) {
# For each privset, get the inner values. # For each privset, get the inner values.
@@ -209,7 +209,7 @@ if (conf_get("privset")) {
# Switch statement for the values. # Switch statement for the values.
given ($mckpriv) { given ($mckpriv) {
# If it's 'priv', save it as a privilege. # If it's 'priv', save it as a privilege.
when ("priv") { when ('priv') {
if (defined $PRIVILEGES{$tckpriv}) { if (defined $PRIVILEGES{$tckpriv}) {
# If this privset exists, push to it. # If this privset exists, push to it.
push(@{ $PRIVILEGES{$tckpriv} }, ($mcprivs{$mckpriv})[0][0]); push(@{ $PRIVILEGES{$tckpriv} }, ($mcprivs{$mckpriv})[0][0]);
@@ -220,7 +220,7 @@ if (conf_get("privset")) {
} }
} }
# If it's 'inherit', inherit the privileges of another privset. # If it's 'inherit', inherit the privileges of another privset.
when ("inherit") { when ('inherit') {
# If the privset we're inheriting exists, continue. # If the privset we're inheriting exists, continue.
if (defined $PRIVILEGES{($mcprivs{$mckpriv})[0][0]}) { if (defined $PRIVILEGES{($mcprivs{$mckpriv})[0][0]}) {
# Iterate through each privilege. # Iterate through each privilege.
@@ -244,12 +244,12 @@ if (conf_get("privset")) {
# Successful startup. # Successful startup.
our $STARTTIME = time; our $STARTTIME = time;
println "* Auto successfully started at ".POSIX::strftime("%Y-%m-%d %I:%M:%S %p", localtime)."."; println '* Auto successfully started at '.POSIX::strftime('%Y-%m-%d %I:%M:%S %p', localtime).'.';
alog "Auto successfully started."; alog 'Auto successfully started.';
# Fork into the background if not in debug mode. # Fork into the background if not in debug mode.
if (!$DEBUG) { if (!$DEBUG) {
println "*** Becoming a daemon..."; println '*** Becoming a daemon...';
open(STDIN, q{<}, '/dev/null') or err(2, "Can't read /dev/null: $!", 1); open(STDIN, q{<}, '/dev/null') or err(2, "Can't read /dev/null: $!", 1);
open(STDOUT, q{>>}, '/dev/null') or err(2, "Can't write to /dev/null: $!", 1); open(STDOUT, q{>>}, '/dev/null') or err(2, "Can't write to /dev/null: $!", 1);
open(STDERR, q{>>}, '/dev/null') or err(2, "Can't write to /dev/null: $!", 1); open(STDERR, q{>>}, '/dev/null') or err(2, "Can't write to /dev/null: $!", 1);