From: Andrew Ruthven Date: Wed, 19 Dec 2007 21:14:58 +0000 (+1300) Subject: Add support for architecture specific config files. X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91057ce837c00edbfd72f7116905cd98f4f918ec;p=spong.git Add support for architecture specific config files. This is useful when you are sharing a config file between a number of hosts, of which not all are the same architecture. --- diff --git a/src/spong-client.pl b/src/spong-client.pl index 083eee7..052c31b 100755 --- a/src/spong-client.pl +++ b/src/spong-client.pl @@ -167,6 +167,14 @@ sub init_logging { sub load_config_files { require $conf_file || die "Can't load $conf_file: $!"; + + my ($sysname) = (uname)[0]; + $sysname =~ s/[^A-Za-z0-9]/_/g; # Eat any nasty characters + + if( -f "$conf_file.$sysname" ) { + require "$conf_file.$sysname" || die "Can't load $conf_file.$sysname: $!"; + } + if( -f "$conf_file.$HOST" ) { require "$conf_file.$HOST" || die "Can't load $conf_file.$HOST: $!"; } else { diff --git a/src/spong-network.pl b/src/spong-network.pl index 72f7447..86d0439 100755 --- a/src/spong-network.pl +++ b/src/spong-network.pl @@ -464,6 +464,14 @@ sub init_logging { sub load_config_files { require $conf_file || die "Can't load $conf_file: $!"; + + my ($sysname) = (uname)[0]; + $sysname =~ s/[^A-Za-z0-9]/_/g; # Eat any nasty characters + + if( -f "$conf_file.$sysname" ) { + require "$conf_file.$sysname" || die "Can't load $conf_file.$sysname: $! "; + } + if( -f "$conf_file.$HOST" ) { require "$conf_file.$HOST" || die "Can't load $conf_file.$HOST: $!"; } else { diff --git a/src/spong-server.pl b/src/spong-server.pl index b804253..0f97779 100755 --- a/src/spong-server.pl +++ b/src/spong-server.pl @@ -1320,6 +1320,13 @@ sub remove_np_files { sub load_config_files { my( $evalme, $inhosts ); + my ($sysname) = (uname)[0]; + $sysname =~ s/[^A-Za-z0-9]/_/g; # Eat any nasty characters + + if( -f "$conf_file.$sysname" ) { + require "$conf_file.$sysname" || die "Can't load $conf_file.$sysname: $!"; + } + require $conf_file || die "Can't load $conf_file: $!"; if( -f "$conf_file.$HOST" ) { require "$conf_file.$HOST" || die "Can't load $conf_file.$HOST: $!";