]> git.etc.gen.nz Git - spong.git/commitdiff
Add support for architecture specific config files.
authorAndrew Ruthven <andrew@etc.gen.nz>
Wed, 19 Dec 2007 21:14:58 +0000 (10:14 +1300)
committerAndrew Ruthven <andrew@cerberus.etc.gen.nz>
Wed, 19 Dec 2007 21:14:58 +0000 (10:14 +1300)
This is useful when you are sharing a config file between
a number of hosts, of which not all are the same architecture.

src/spong-client.pl
src/spong-network.pl
src/spong-server.pl

index 083eee74de3a0e1fe5b7f15fb8707dee7a33165e..052c31bd708c290bfd7094b047e0bdd866e5c739 100755 (executable)
@@ -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 {
index 72f744729ded0c865a342fe036f12a182bff2e4e..86d04397dace22ba20ccbd4c346da327137aed18 100755 (executable)
@@ -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 {
index b804253c1c80dcec3ce5fbf8d05b939af4dd1568..0f97779e9ab56f7c54136cea73c5bd473020087b 100755 (executable)
@@ -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: $!";