#!/usr/bin/perl use File::Copy; # Install r commands # v1.0 17-Aug-2002: basic code # v1.1 25-Mar-2003: code mods for specific customer, forked versions # v1.3 27-Oct-2003: fixes print "fixing /etc/nsswitch.conf to have correct order of resolution\n"; &fix("/etc/nsswitch.conf"); sub fix { my $in = shift ; my $out = $in."_prime"; open($fh,"<".$in) || die "Cannot open ".$in ." for reading\n"; open($fh_prime,">".$out) || die "Cannot open ".$out." for writing\n"; while($line=<$fh>) { if ($line=~/passwd:/) {$line="passwd: files nis\n";} if ($line=~/group:/) {$line="group: files nis\n";} if ($line=~/hosts:/) {$line="hosts: files dns nis\n";} printf $fh_prime "%s",$line; } close($fh); close($fh_prime); move($out,$in) || die "Unable to copy ".$out." to ".$in."\n"; }