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