X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;ds=sidebyside;f=config;h=16e37cc27a06d339622dc74e5b2ca45abd9539f8;hb=facacfb22f09fe7c34ae5c6cdeaa62397322b3f9;hp=d9d49e651058ab534de54114c0cc2148219bfe81;hpb=0c863672d721034d3d63ba62afe8857ea0308cf3;p=ian-dotfiles.git diff --git a/config b/config index d9d49e6..16e37cc 100644 --- a/config +++ b/config @@ -1,17 +1,46 @@ @@- -chomp($hostname= `uname -n`); $? and die 'uname $?'; -($hostname)=(gethostbyname $hostname) or die "hostname $hostname ?"; +chomp($nodename= `uname -n`); $? and die "uname $?"; +chomp($username= `whoami`); $? and die "whoami $?"; -chomp($s= `uname`); $? and die 'platform $?'; -if ($s =~ m/^Linux$/) { - chomp($_= `uname -m`); $? and die 'platform $?'; +@he= gethostbyname $nodename or die "gethostbyname $nodename ?"; +@hostnames= ($he[0], split /\s/, $he[1]); +($hostname)= grep /\./, @hostnames or die "no fqdn in @hostnames"; + +$nodename =~ s/\..*//; +$xbindir= '/usr/bin/X11'; + +chomp($uname= `uname`); $? and die "platform $?"; +if ($uname =~ m/^Linux$/) { + chomp($_= `uname -m`); $? and die "platform $?"; if (m/^i\d86/) { $platform= 'linux-i386'; } else { - die '$_ ?'; + die "$_ ?"; } +} elsif ($uname =~ m/^SunOS$/) { + chomp($_= `uname -r`); $? and die "platform $?"; + m/^\d+\.\d+/ or die "$_ ?"; + $platform= "SunOS$&"; + $xbindir= '/usr/openwin/bin'; +} elsif ($uname =~ m/^FreeBSD/) { + chomp($_= `uname -r`); $? and die "platform $?"; + m/^(\d+\.\d+)\-/ or die "$_ ?"; + $platform= "FreeBSD-$1"; +} elsif ($uname =~ m/^HP\-UX/) { + chomp($_= `uname -r`); $? and die "platform $?"; + m/^B\.(\d+\.\d+)$/ or die "$_ ?"; + $platform= "HP-UX$1"; +} elsif ($uname =~ m/^AIX/) { + chomp($_= `uname -rv`); $? and die "platform $?"; + m/^\d+ (\d+)$/ or die "$_ ?"; + $platform= "AIX$1"; +} else { + die "$uname ?"; } -$ncipher= $hostname =~ m/\.ncipher\.com$/ ? 'cam' : - $hostname =~ m/\.ncipherusa\.com$/ ? 'bos' : +$ncipher= $hostname =~ m/\.(ncipher\.com$)/ ? 'cam' : + $hostname =~ m/\.(ncipherusa\.com$)/ ? 'bos' : 0; + +%ncipherdom= ('cam' => 'ncipher.com', + 'bos' => 'ncipherusa.com');