1 # Copyright 2000, International Business Machines Corporation and others.
4 # This software has been released under the terms of the IBM Public
5 # License. For details, see the LICENSE file in the top-level source
6 # directory or online at http://www.openafs.org/dl/license10.html
8 # An InstallGuide for installing the initialization script
9 # For HP 9000 systems running HPUX 9.x
16 # Add AFS kernel loader to RC file
17 &VPrint("Updating $rcfile file");
19 &DisplaceFile("/etc/rc.afs");
21 # Append the generic RC file
22 &ReadInstallGuide("$InstallGuideDir/GENERIC/rc");
25 # Read in the current RC file
27 $rc = open(RC, $rcfile);
28 &ErrorMsg("Could not read file", $rcfile) if (!$rc);
32 # Check if AFS is already referenced
33 if (grep(/\bAFS\b/, @line) || grep(/\/usr\/vice\/etc/, @line)) {
34 &Print("AFS appears to already be in $rcfile");
37 # Find where function localrc() is. If it is not there, put it in after
38 # all of the leading comments
41 foreach $n (0 ... $#line) {
42 $comments = $n unless (@line[$n] =~ /^#/ || $comments > 0);
43 if (@line[$n] =~ /^localrc\(\)/) {
47 # Insert a localrc() function if one was not already there
49 splice(@line, $comments, 0, "localrc()\n", "{\n", "}\n", "\n");
51 &Print("Inserted function localrc() in $rcfile");
52 &Print("This should be run after NFS is started"); };
54 # Skip past the function name and opening curly brace. Account for "{}"
55 until (@line[$localrc] =~ /\{/ || $localrc > $#line) { $localrc ++; };
56 if (@line[$localrc] =~ /\}/) {
57 @line[$localrc] =~ s/\}//;
58 splice(@line, $localrc+1, 0, "}\n"); };
61 # Insert a call to the AFS rc file
62 splice(@line, $localrc, 0,
64 "if [ -f /etc/rc.afs ]; then\n",
65 " /bin/sh /etc/rc.afs\n",
69 $rc = open(RC, "> $rcfile");
70 &ErrorMsg("Could not rewrite file" , $rcfile) if (!$rc);
71 foreach $line (@line) {