Annotation of loncom/build/postinstall.pl, revision 1.11
1.1 harris41 1: #!/usr/bin/perl
2:
3: # A post-installation script
4: # to finalize a LON-CAPA
5: # installation.
6:
1.2 harris41 7: # set /etc/hosts.deny to be ALL: ALL
8: open OUT, ">/etc/hosts.deny";
9: print OUT "ALL: ALL\n";
10: close OUT;
11:
12: # get wget and install
13: system('lynx -source http://install.lon-capa.org/3.1/SupplementalRPMS/wget-1.5.3-6.i386.rpm > wget-1.5.3-6.i386.rpm');
1.6 harris41 14: system('rpm -Uvh --force wget-1.5.3-6.i386.rpm');
1.2 harris41 15:
16: # download SupplementalRPMS and install
1.10 harris41 17: system('wget','-r','-np','http://install.lon-capa.org/3.1/SupplementalRPMS');
1.6 harris41 18: system('rpm -Uvh --force install.lon-capa.org/3.1/SupplementalRPMS/*.rpm');
1.2 harris41 19:
20: # download remove_extra.sh and run
1.10 harris41 21: system('wget','-r','-np','http://install.lon-capa.org/3.1/scripts/remove_extra.sh');
1.2 harris41 22: system('sh','./remove_extra.sh');
23:
24: # download FinalRPMS and install
1.11 ! harris41 25: system('wget','-r','-np','http://install.lon-capa.org/3.1/FinalRPMS');
1.7 harris41 26: system('rpm -Uvh --force install.lon-capa.org/3.1/FinalRPMS/*.rpm');
27:
28: my $okay=0;
29: DEV: while ($okay==0) {
30: print "\n\nWill this machine be used to develop future LON-CAPA software? (y/n)\n";
31: my $input=<>;
32: if ($input=~/^y/i) {
33: $okay=1;
34: }
35: elsif ($input=~/^n/i) {
36: last DEV;
37: }
38: }
39: if (!$okay) {
40: system('wget','http://install.lon-capa.org/3.1/scripts/remove_extra_dev.sh');
41: system('sh','./remove_extra_dev.sh');
42: }
1.2 harris41 43:
1.1 harris41 44: # allow entry of new access.conf parameters
1.2 harris41 45: my @perlsetvars=("lonHostID","lonRole","lonAdmEMail","lonDefDomain","lonLoadLim","lonExpire");
46: my %psvinfo=(
47: "lonHostID" => <<END
48: LON Host ID is an internal ID within the LON-CAPA
49: network used to specify the uniqueness of a particular
50: LON-CAPA server. Current examples include "msul1", "msua3",
51: "103l1", "fsul1", and "107a1".
52: END
53: , "lonRole" => <<END
54: LON Role specifies the role this machine plays within
55: the LON-CAPA network. There are two valid values for
56: this:
57: * library
58: * access
59: END
60: , "lonAdmEMail" => <<END
61: LON System Administrator E-Mail specifies the e-mail
62: address of an institutional member responsible for
63: direct upkeep of this server.
64: END
65: , "lonDefDomain" => <<END
66: LON Domain is a unique internal identifier within the LON-CAPA network
67: specific to the home institution. Current examples include
68: "msu", "fsu", "103", and "107".
69: END
70: , "lonLoadLim" => <<END
71: LON Load Limit specifies a threshold of activity within The Learning
72: Online Network that this machine should provide. We strongly recommend
73: a value of 2.00. Depending on processor architecture (dual processor),
74: this value may be increased, but there is no readily available measure
75: in this regard.
76: END
77: , "lonExpire" => <<END
78: LON Expiration Time indicates, in seconds, how long distributed resources
79: should be held in the server's cache when not being accessed by students,
80: instructors, or any other class of user. We recommend a value of 86400.
81: END
82: );
83: my $template=`/bin/cat /etc/httpd/conf/access.conf`;
1.7 harris41 84: $okay=0;
1.2 harris41 85: while ($okay==0) {
86: foreach my $psv (@perlsetvars) {
87: print "\n";
88: print $psvinfo{$psv};
89: print "\nEnter in value for $psv: "; my $input=<>; chop $input;
90: my $pval=$input;
91: $template=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/;
92: $pvar{$psv}=$pval;
93: }
94: print "\n\nThese are the current values:\n";
95: foreach my $psv (@perlsetvars) {
96: print "$psv\t\t$pvar{$psv}\n";
97: }
98: print "Are these correct? (y/n)";
99: my $input=<>;
100: if ($input=~/^y/i) {
101: $okay=1;
102: }
103: }
104: open OUT,">/etc/httpd/conf/access.conf";
105: print OUT $template;
106: close OUT;
107:
108: $template=`/bin/cat /etc/smb.conf`;
109: foreach my $psv (@perlsetvars) {
110: $template=~s/\{\{\{\{\[(.*?)\]\}\}\}\}/$pvar{$1}/ge;
111: }
112: open OUT,">/etc/smb.conf";
113: print OUT $template;
114: close OUT;
1.4 harris41 115:
1.1 harris41 116: # unshadow passwords
1.2 harris41 117: # change this line in /etc/pam.d/login
118: # password required /lib/security/pam_pwdb.so nullok use_authtok md5 shadow
119: $template=`/bin/cat /etc/pam.d/login`;
120: $template=~s|password required /lib/security/pam_pwdb\.so nullok use_authtok md5 shadow|password required /lib/security/pam_pwdb.so nullok use_authtok|;
121: open OUT, ">/etc/pam.d/login";
122: print OUT $template;
123: close OUT;
124: # change this line in /etc/pam.d/passwd
125: # password required /lib/security/pam_pwdb.so use_authtok nullok md5 shadow
126: $template=`/bin/cat /etc/pam.d/passwd`;
127: $template=~s|password required /lib/security/pam_pwdb\.so nullok use_authtok md5 shadow|password required /lib/security/pam_pwdb.so nullok use_authtok|;
128: open OUT, ">/etc/pam.d/passwd";
129: print OUT $template;
130: close OUT;
131: `/usr/sbin/pwunconv`;
132: `/usr/sbin/grpunconv`;
133: # set new passwords
134: print "Now we need to have passwords entered in order to unshadow this machine.\n";
135: system('stty -echo');
136: $okay=0;
137: my $input1;
138: my $input2;
139: while ($okay==0) {
140: print "Enter in password for root: ";
141: $input1=<>; chop $input1;
142: print "\nEnter in password again for root: ";
143: $input2=<>; chop $input2;
144: if ($input1 ne $input2) {
145: print "\nPasswords do not match, try again.\n";
146: }
147: else {
148: $okay=1;
149: }
150: }
151: open OUT, "|/usr/sbin/chpasswd";
152: print OUT "root:$input1\n";
153: close OUT;
154:
155: $okay=0;
156: while ($okay==0) {
157: print "\nEnter in password for www: ";
158: $input1=<>; chop $input1;
159: print "\nEnter in password again for www: ";
160: $input2=<>; chop $input2;
161: if ($input1 ne $input2) {
162: print "\nPasswords do not match, try again.\n";
163: }
164: else {
165: $okay=1;
166: }
167: }
168: open OUT, "|/usr/sbin/chpasswd";
169: print OUT "www:$input1\n";
170: close OUT;
171: system('stty echo');
172:
1.1 harris41 173: # create mime.types link
1.2 harris41 174: `ln -s /etc/mime.types /etc/httpd/conf/mime.types`;
175:
1.1 harris41 176: # restart network and inet services
1.2 harris41 177: system('/etc/rc.d/init.d/network','reload');
178: system('/etc/rc.d/init.d/inet','restart');
1.1 harris41 179: # restart httpd
1.2 harris41 180: system('/etc/rc.d/init.d/httpd','restart');
181:
182: # fix the setup of init.d processes
183: # nfs
1.3 harris41 184: # bash$ diff nfs nfs~
185: # 6c6
186: # < # chkconfig: 345 60 20
187: # ---
188: # > # chkconfig: - 60 20
189: # then chkconfig
1.4 harris41 190: $template=`/bin/cat /etc/rc.d/init.d/nfs`;
191: $template=~s/\# chkconfig: - 60 20/\# chkconfig: 345 60 20/;
192: open OUT,">/etc/rc.d/init.d/nfs";
193: print OUT $template;
194: close OUT;
195: $template=`/bin/cat /etc/rc.d/init.d/xntpd`;
196: $template=~s/\# chkconfig: - 55 10/\# chkconfig: 345 55 10/;
197: open OUT,">/etc/rc.d/init.d/xntpd";
198: print OUT $template;
199: close OUT;
1.3 harris41 200:
201: # ntp
202: # chkconfig 345
203: # then chkconfig
204:
1.2 harris41 205: # make atalk specific modifications
1.3 harris41 206: # /etc/atalk/config
207: open OUT, ">/etc/atalk/config";
208: print OUT <<END;
209: # Appletalk configuration
210: # Change this to increase the maximum number of clients that can connect:
211: AFPD_MAX_CLIENTS=5
212: # Change this to set the machine's atalk name:
213: # ATALK_NAME=`echo \${HOSTNAME}|cut -d. -f1`
1.8 harris41 214: ATALK_NAME=`grep '^PerlSetVar.*lonHostID' /etc/httpd/conf/access.conf | perl -e '\$_=<>; split(/\\s+/); print "LONCAPA_\$_[2]";
1.3 harris41 215: '`
216: # Set which daemons to run:
217: PAPD_RUN=no
218: AFPD_RUN=yes
219: # Control whether the daemons are started in the background
220: ATALK_BGROUND=no
221: END
222: close OUT;
223: # /etc/conf.modules should have this line
224: # alias net-pf-5 appletalk
225: # depmod -a
226: $template=`/bin/cat /etc/conf.modules`;
227: $template.="alias net-pf-5 appletalk\n";
228: open OUT, ">/etc/conf.modules";
229: print OUT $template;
230: close OUT;
231: system('depmod -a');
1.2 harris41 232:
1.4 harris41 233: # restart nfs, smb, xntpd and atalk services
1.2 harris41 234: system('/etc/rc.d/init.d/smb','restart');
235: system('/etc/rc.d/init.d/atalk','restart');
1.3 harris41 236: system('/etc/rc.d/init.d portmap','stop');
237: system('/etc/rc.d/init.d nfs','stop');
238: system('/etc/rc.d/init.d portmap','start');
239: system('/etc/rc.d/init.d nfs','start');
240: system('/etc/rc.d/init.d/smb','restart');
241: system('/etc/rc.d/init.d/inet','restart');
1.4 harris41 242: system('/etc/rc.d/init.d/xntpd','restart');
1.2 harris41 243:
1.1 harris41 244: # restart loncontrol
1.2 harris41 245: print "Please be patient while loncontrol services are restarted (approximately 10 minutes).\n";
246: system('/etc/rc.d/init.d/loncontrol','restart');
247:
1.1 harris41 248: # warn about /etc/hosts.allow
1.2 harris41 249: print <<END;
250: Final note: Currently your machine is set-up
251: to disable many different kinds of network
252: connectivity. To enable network connectivity
253: different than that needed for LON-CAPA, you
254: must make appropriate adjustment to the
255: /etc/hosts.allow file.
256: END
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>