Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / afsinstall / lib / InstallGuides / RS_AIX4x / rc
CommitLineData
805e021f
CE
1# Copyright 2000, International Business Machines Corporation and others.
2# All Rights Reserved.
3#
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
7
8# An InstallGuide for installing the initialization script
9# For IBM RS/6000 systems running AIX 4.x
10#
11
12sub rc {
13my($rcfile,$initfile, $method,$line,$method,%Method);
14
15# Defaults
16$rcfile = "/etc/rc.afs";
17$initfile = "/etc/inittab";
18
19&ErrorsAreFatal(1);
20
21# Add AFS kernel loader to RC file
22&VPrint("Creating $rcfile file");
23&DisplaceFile($rcfile);
24$rc = open(RC, "> $rcfile");
25&ErrorMsg("Could not overwrite", $rcfile) if (!$rc);
26
27
28$method = "none";
29if ($Configuration{"NFSEXTENSIONS"}) {
30 $method = "nfs";
31 # Determine if this AIX system uses the iauth system
32 # AIX 4.1.x for x>=5
33 # AIX 4.2.x for x>=1
34 # AIX 4.x for x>=3
35 open(LPP, "/bin/lslpp -L |");
36 while ($line = <LPP>) {
37 next unless ($line =~ /bos.rte\s/);
38 $line =~ /bos.rte\s+(\d)\.(\d)\.(\d)/;
39 ($a,$b,$c) = ($1,$2,$3);
40 $method = "iauth" if ($a == 4 && $b == 1 && $c >= 5);
41 $method = "iauth" if ($a == 4 && $b == 2 && $c >= 1);
42 $method = "iauth" if ($a == 4 && $b >= 3);
43 last; };
44 close(LPP); };
45
46$Method{"none"} = "#USENFS=\"none\"";
47$Method{"nfs"} = "#USENFS=\"nfs\"";
48$Method{"iauth"} = "#USENFS=\"iauth\"";
49$Method{$method} =~ s:#::;
50
51print RC <<"EORC";
52#!/bin/sh
53
54
55# Choose one depending on how much usage this client gets
56#OPTIONS="-stat 300 -dcache 100 -daemons 2 -volumes 50"
57#OPTIONS="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
58OPTIONS="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
59
60# Choose one depending on how you want NFS requests handled by AFS
61$Method{"none"}
62$Method{"nfs"}
63$Method{"iauth"}
64
65if [ "\$USENFS" = "nfs" ]; then
66 ExportExt=""
67 AFSExt=".trans"
68 NFS="-rmtsys"
69elif [ "\$USENFS" = "iauth" ]; then
70 ExportExt=".nonfs"
71 AFSExt=".iauth"
72 NFS="-rmtsys"
73else
74 ExportExt=".nonfs"
75 AFSExt=""
76 NFS=""
77fi
78
79# Load AFS into the kernel
80cd /usr/vice/etc/dkload
81/usr/vice/etc/dkload/cfgexport -a /usr/vice/etc/dkload/export.ext\${ExportExt}
82/usr/vice/etc/dkload/cfgafs -a /usr/vice/etc/dkload/afs.ext\${AFSExt}
83
84# Start bosserver
85if [ -x /usr/afs/bin/bosserver ]; then
86 echo 'Starting bosserver' > /dev/console
87 /usr/afs/bin/bosserver &
88fi
89
90# Start afsd
91/usr/vice/etc/afsd \$OPTIONS \$NFS
92
93# Start AFS inetd services
94if [ -f /etc/inetd.afs -a -f /etc/inetd.conf.afs ]; then
95 /etc/inetd.afs /etc/inetd.conf.afs
96fi
97
98EORC
99close(RC);
100
101# Add AFS entry to the inittab file
102&VPrint("Adding AFS entry to $initfile");
103
104&Patch::Verbose if ($InstallVerbose);
105&Patch::FileOpen($initfile);
106$SearchString = <<"xxENDxx";
107rcnfs:2:wait:/etc/rc.nfs > /dev/console 2>&1 # Start NFS Daemons
108xxENDxx
109
110$NewString = <<"xxENDxx";
111rcafs:2:wait:/etc/rc.afs > /dev/console 2>&1 # Start AFS Daemons
112xxENDxx
113
114if (!&Patch::Patch($initfile, [[0, "Insert", $SearchString, $NewString]])) {
115 &ErrorMsg("Did not succeed with patch", $initfile);
116}
117&Chmod (0755, $rcfile);
118&Chown (0,0, $rcfile);
119}