1: <!-- updatequery.piml -->
2:
3: <!-- $Id: updatequery.piml,v 1.84.2.3 2020/01/07 01:29:06 raeburn Exp $ -->
4:
5: <!--
6:
7: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
8:
9: LON-CAPA is free software; you can redistribute it and/or modify
10: it under the terms of the GNU General Public License as published by
11: the Free Software Foundation; either version 2 of the License, or
12: (at your option) any later version.
13:
14: LON-CAPA is distributed in the hope that it will be useful,
15: but WITHOUT ANY WARRANTY; without even the implied warranty of
16: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: GNU General Public License for more details.
18:
19: You should have received a copy of the GNU General Public License
20: along with LON-CAPA; if not, write to the Free Software
21: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22:
23: /home/httpd/html/adm/gpl.txt
24:
25: http://www.lon-capa.org/
26:
27: -->
28:
29: <piml>
30: <targetroot>/</targetroot>
31: <files>
32: <file>
33: <target dist='default'>/</target>
34: <perlscript mode='fg'>
35: $|=1;
36: use strict;
37:
38: print(<<END);
39:
40:
41: *********************************************
42: *********************************************
43: **** ****
44: **** LON-CAPA SYSTEM INFORMATION REQUEST ****
45: **** ****
46: **** Please respond to the choices below ****
47: **** ****
48: *********************************************
49: *********************************************
50:
51: END
52: #sleep(3);
53: </perlscript>
54: </file>
55: <file>
56: <target dist='default'>loncom/hosts.tab</target>
57: <perlscript mode='fg'>
58: my $lonCluster;
59: unless (-l "<TARGET />") {
60: print(<<END);
61:
62: ===============================================================================
63: Which cluster option would you like to have installed?
64: IMPORTANT: to take advantage of the cluster options 1) and 3),
65: you must contact loncapa\@loncapa.org.
66:
67: 1) PRODUCTION - you want to eventually connect this machine to the
68: LON-CAPA content sharing network. This setting is for
69: schools, colleges, and universities, that currently
70: are running - or in the future will run - courses.
71: 2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and
72: not be connected to other LON-CAPA machines for now.
73: 3) DEVELOPMENT - you want to do software (not content!) development with
74: this workstation and eventually link it with the
75: workstations of other LON-CAPA software developers.
76: 4) RUNNING YOUR OWN CLUSTER - this machine is not in the standard LON-CAPA
77: clusters and won't be in the future and you want the existing
78: hosts.tab and domain.tab files to be left alone.
79: (This choice is unlikely what you want to select.)
80: END
81: # Option number 26 will install rawhide_hosts.tab, but
82: # the typical user does not want to be part of an intensive
83: # machine test cluster.
84:
85: # get input
86: # if valid then process, otherwise loop
87: my $flag=0;
88: while (!$flag) {
89: print "ENTER 1, 2, 3, or 4:\n";
90: my $choice=<>;
91: chomp($choice);
92: if ($choice==1) {
93: $lonCluster='production'; $flag=1;
94: }
95: elsif ($choice==2) {
96: $lonCluster='standalone'; $flag=1;
97: }
98: elsif ($choice==3) {
99: $lonCluster='development'; $flag=1;
100: }
101: elsif ($choice==4) {
102: $lonCluster='existing'; $flag=1;
103: foreach my $file ('hosts.tab','dns_hosts.tab',
104: 'domain.tab','dns_domain.tab') {
105: if (-e '/home/httpd/lonTabs/'.$file) {
106: `cp /home/httpd/lonTabs/$file ../existing_$file`;
107: }
108: else {
109: print <<END;
110: There is no existing /home/httpd/lonTabs/$file
111: END
112: die('');
113: }
114: }
115: }
116: elsif ($choice==26) {
117: $lonCluster='rawhide'; $flag=1;
118: }
119: }
120: }
121: </perlscript>
122: </file>
123: <file>
124: <target dist='default'>/home/httpd/lonTabs/hosts.tab</target>
125: <perlscript mode='fg'>
126: $|=1;
127: my $domainDescription;
128: my $domainTabExtras;
129: my $primaryLibServer;
130: my $protocol;
131: my $intdom;
132: my $desiredhostname;
133: my @libservers = ();
134: unless (-e "<TARGET />") {
135: print(<<END);
136: WELCOME TO LON-CAPA!
137:
138: If you have questions, please visit http://install.loncapa.org
139: or contact helpdesk\@loncapa.org.
140:
141: ===============================================================================
142: The following 8 values are needed to configure LON-CAPA:
143: * Machine Role
144: * LON-CAPA Domain Name
145: * LON-CAPA Machine ID Name
146: * Server Administration E-mail Address
147: * LON-CAPA Domain's Primary Library Server Machine ID
148: * Web Server Protocol
149: * Internet Domain Name of Your Institution
150: * Hostname
151: ===============================================================================
152:
153: In addition, a Support E-mail Address can also be included. If
154: an address is included then one of the options in the LON-CAPA
155: help menu will be a link to a form that a user will complete to
156: request LON-CAPA help.
157:
158: END
159:
160: open(OUT,'>/tmp/loncapa_updatequery.out');
161: close(OUT);
162:
163: # query for Machine Role
164: print(<<END);
165: **** Machine Role ****
166: Library server (recommended if first-time installation of LON-CAPA):
167: Servers that are repositories of authoritative educational resources.
168: These servers also provide the authoring spaces in which content
169: creators (e.g., faculty instructors) create their learning content.
170: Access server:
171: Servers that load-balance high-traffic delivery of educational resources
172: over the world-wide web.
173: 1) Will this be a library server? (recommended if this is your first install)
174: 2) Or, will this be an access server?
175: END
176: my $flag=0;
177: my $r='';
178: my $lonRole;
179: while (!$flag) {
180: print "ENTER A CHOICE OF 1 or 2:\n";
181: my $choice=<>;
182: chomp($choice);
183: if ($choice==1) {
184: open(OUT,'>>/tmp/loncapa_updatequery.out');
185: print(OUT 'lonRole'."\t".'library'."\n");
186: close(OUT);
187: $lonRole='library';
188: $r='l';
189: $flag=1;
190: }
191: elsif ($choice==2) {
192: open(OUT,'>>/tmp/loncapa_updatequery.out');
193: print(OUT 'lonRole'."\t".'access'."\n");
194: close(OUT);
195: $lonRole='access';
196: $r='a';
197: $flag=2;
198: }
199: else {
200:
201: }
202: }
203:
204: # need to recommend a machine ID name (ipdomain.l.somenumber)
205: my $hostname=`hostname -f`; chomp($hostname);
206: my $ipdomain='';
207: if ($hostname=~/([^\.]*)\.([^\.]*)$/) {
208: $ipdomain=$1;
209: }
210:
211: print(<<END);
212:
213: **** Domain ****
214: [This does NOT need to correspond to an internet address domain.
215: Please make this name short AND descriptive of your organization.
216: Domain names are close to impossible to change later!!!
217: Good examples might be "msu" or "bionet" or "vermontcc".
218: Bad examples are "physics" (too general)
219: or "michiganstateuniversity" (too long)
220: or "msuedu" (just make it "msu", or else make it msu.edu)
221: or "msuphysics" (only if there is a good reason to limit to department
222: - we don't know of one)
223: or "mydomain" (what is that?)
224: Avoid multiple domains at the same institution, even if it means that you
225: have to actually work together with your colleagues. You can still run
226: multiple library servers within the same domain.
227: If this domain is eventually going to be part of the main production
228: cluster, you MUST contact the LON-CAPA group at MSU (loncapa\@loncapa.org)
229: to have a domain name assigned, and then use it exactly as given. This is
230: also true for test installs that might eventually turn into production setups.
231: The short domain name needs to be unique, if your aim is to join a cluster
232: containing existing domains. Stop now if you have not yet contacted the
233: MSU LON-CAPA group.]
234: END
235:
236: # get domain name
237: # accept if valid, if not valid, tell user and repeat
238: $flag=0;
239: my $lonDefDomain;
240: while (!$flag) {
241: if ($ipdomain) {
242: print(<<END);
243: ENTER LONCAPA DOMAIN [$ipdomain]:
244: END
245: }
246: else {
247: print(<<END);
248: ENTER LONCAPA DOMAIN:
249: END
250: }
251: my $choice=<>;
252: chomp($choice);
253: my $bad_domain_flag=0;
254: my @bad_domain_names=('res','raw','userfiles','priv','adm','uploaded',
255: 'editupload');
256: foreach my $bad (@bad_domain_names) {
257: $bad_domain_flag=1 if $choice eq $bad;
258: }
259: if ($choice=~/capa/i) {
260: $bad_domain_flag=1;
261: }
262: if ($ipdomain and $choice=~/^\s*$/) {
263: $choice=$ipdomain;
264: open(OUT,'>>/tmp/loncapa_updatequery.out');
265: print(OUT 'lonDefDomain'."\t".$choice."\n");
266: close(OUT);
267: $lonDefDomain=$choice;
268: $flag=1;
269: } elsif (length($choice)>35) {
270: print "Name too long\n";
271: } elsif (length($choice)<2) {
272: print "Name too short\n";
273: } elsif ($bad_domain_flag) {
274: print "Invalid input ('$choice' conflicts with LON-CAPA namespace).\n";
275: print "Please try something different than '$choice'\n";
276: } elsif ($choice!~/\_/ and $choice=~/^[\w\-.]+$/) {
277: open(OUT,'>>/tmp/loncapa_updatequery.out');
278: print(OUT 'lonDefDomain'."\t".$choice."\n");
279: close(OUT);
280: $lonDefDomain=$choice;
281: $r='l';
282: $flag=1;
283: } else {
284: print "Invalid input (only alphanumeric characters, '-', and '.' supported).\n";
285: }
286: }
287:
288: # get domain description
289: # accept if valid, if not valid, tell user and repeat
290: $flag=0;
291:
292: while (!$flag) {
293: print(<<END);
294:
295: **** Domain Description ****
296: String describing the domain, to be shown to users.
297: [Example, msu is Michigan State University]
298: ENTER DOMAIN DESCRIPTION:
299: END
300:
301: my $choice=<>;
302: chomp($choice);
303: if ($choice!~/:/) {
304: open(OUT,'>>/tmp/loncapa_updatequery.out');
305: print(OUT 'domainDescription'."\t".$choice."\n");
306: close(OUT);
307: $domainDescription=$choice;
308: $flag=1;
309: }
310: else {
311: print "Invalid input (no ':' allowed).\n";
312: }
313: }
314:
315: my $lonHostID;
316: if ($lonDefDomain) {
317: $lonHostID=$lonDefDomain.$r.int(1+rand(9)); # should be probably also detect
318: # against the hosts.tab
319: }
320:
321: print(<<END);
322:
323: **** Machine ID Name ****
324: [This does NOT need to correspond to internet address names;
325: this name MUST be unique to the whole LON-CAPA network;
326: we recommend that you use a name based off of your institution.
327: Good examples: "msul1" or "bioneta2".
328: Bad examples: "loncapabox" or "studentsinside".
329: Note that machine names are very hard to change later.]
330: END
331: # get machine name
332: # accept if valid, if not valid, tell user and repeat
333: $flag=0;
334: while (!$flag) {
335: if ($ipdomain) {
336: print(<<END);
337: ENTER LONCAPA MACHINE ID [$lonHostID]:
338: END
339: }
340: else {
341: print(<<END);
342: ENTER LONCAPA MACHINE ID:
343: END
344: }
345: my $choice=<>;
346: chomp($choice);
347: if ($choice=~/capa/i) {
348: print "Invalid input (names containing 'capa' are reserved).\n";
349: } elsif ($lonHostID and $choice=~/^\s*$/) {
350: $choice=$lonHostID;
351: open(OUT,'>>/tmp/loncapa_updatequery.out');
352: print(OUT 'lonHostID'."\t".$choice."\n");
353: close(OUT);
354: $lonHostID=$choice;
355: $flag=1;
356: } elsif (length($choice)>45) {
357: print "Name too long\n";
358: } elsif (length($choice)<4) {
359: print "Name too short\n";
360: } elsif ($choice!~/\_/ and $choice=~/^[\w\-.]+$/) {
361: open(OUT,'>>/tmp/loncapa_updatequery.out');
362: print(OUT 'lonHostID'."\t".$choice."\n");
363: close(OUT);
364: $lonHostID=$choice;
365: $flag=1;
366: } else {
367: print "Invalid input (only alphanumeric characters, '-', and '.' supported).\n";
368: }
369: }
370:
371: # get primary library server in domain
372: if ($lonRole eq 'library') {
373: if (!grep/^\Q$lonHostID\E$/,@libservers) {
374: push(@libservers,$lonHostID);
375: }
376: if (@libservers == 1) {
377: $primaryLibServer = $libservers[0];
378: }
379: }
380:
381: $flag=0;
382: while (!$flag) {
383: print(<<END);
384: **** Domain's Primary Library Server ID ****
385: This should be the LON-CAPA machine ID of a library server in your
386: domain. If you only have a single library server in your domain, then
387: the Primary Library server ID will be the machine ID of that server.
388: This server will be where domain data which are not associated with any
389: specific home library server will be stored (e.g., configurations that
390: apply to all nodes in the domain).
391: END
392: if (defined($primaryLibServer)) {
393: print(<<END);
394: ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$primaryLibServer]:
395: END
396: } elsif (@libservers > 0) {
397: print(<<END);
398: ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$libservers[0]]
399: END
400: } else {
401: print (<<END);
402: No library servers could be identified for this domain. If you have already installed LON-CAPA on a different server (designated as a library server) in this domain, please enter the LONCAPA MACHINE ID of that server. If not, you will need to install a LON-CAPA library server. Enter the MACHINE ID of the server you plan to designate as a library server.
403: END
404: }
405:
406: my $choice=<>;
407: chomp($choice);
408: if ($primaryLibServer and $choice=~/^\s*$/) {
409: $choice=$primaryLibServer;
410: open(OUT,'>>/tmp/loncapa_updatequery.out');
411: print(OUT 'primaryLibServer'."\t".$choice."\n");
412: close(OUT);
413: $flag=1;
414: } elsif (length($choice)>35) {
415: print "Name too long\n";
416: } elsif (length($choice)<4) {
417: print "Name too short\n";
418: } elsif ($choice!~/\_/ and $choice=~/^[\w\-.]+$/) {
419: open(OUT,'>>/tmp/loncapa_updatequery.out');
420: print(OUT 'primaryLibServer'."\t".$choice."\n");
421: close(OUT);
422: $primaryLibServer=$choice;
423: $flag=1;
424: } else {
425: print "Invalid input (only alphanumeric characters, '-', and '.' supported).\n";
426: }
427: }
428:
429:
430: # get admin e-mail address
431: # accept if valid, if not valid, tell user and repeat
432: $flag=0;
433: my $lonAdmEMail;
434: while (!$flag) {
435: print(<<END);
436:
437: **** Server Administrators E-mail ****
438: E-mail address of the person who will manage this machine
439: [should be in the form somebody\@somewhere]
440: ENTER ADMIN E-MAIL ADDRESS:
441: END
442:
443: my $choice=<>;
444: chomp($choice);
445: if ($choice=~/\@/) {
446: open(OUT,'>>/tmp/loncapa_updatequery.out');
447: print(OUT 'lonAdmEMail'."\t".$choice."\n");
448: close(OUT);
449: $lonAdmEMail=$choice;
450: $flag=1;
451: }
452: else {
453: print "Invalid input (this needs to look like an e-mail address!).\n";
454: }
455: }
456:
457:
458: # get support e-mail address
459: # accept if valid, if not valid, tell user and repeat
460: $flag=0;
461: my $lonSupportEMail;
462: while (!$flag) {
463: print(<<END);
464:
465: **** Support E-mail ****
466: E-mail address of the person who will receive
467: help requests from LON-CAPA users who access
468: the system via this server. If the address is left blank,
469: then a help support form will not be displayed
470: as part of the help menu.
471: [should be in the form somebody\@somewhere]
472: ENTER SUPPORT E-MAIL ADDRESS:
473: END
474:
475: my $choice=<>;
476: chomp($choice);
477: $choice =~ s/\s//g;
478: if ( ($choice=~/\@/) || $choice eq '') {
479: open(OUT,'>>/tmp/loncapa_updatequery.out');
480: print(OUT 'lonSupportEMail'."\t".$choice."\n");
481: close(OUT);
482: $lonSupportEMail=$choice;
483: $flag=1;
484: }
485: else {
486: print "Invalid input (this either needs to be blank, or look like an e-mail address!).\n";
487: }
488: }
489:
490: # get protocol
491: # accept if valid, if not valid, tell user and repeat
492: $flag=0;
493: while (!$flag) {
494: print(<<END);
495:
496: **** Web Server Protocol ****
497: If you plan to run the Apache server with SSL enabled,
498: the protocol should be: https; otherwise it should be http.
499: ENTER WEB SERVER PROTOCOL [http]:
500: END
501:
502: my $choice=<>;
503: chomp($choice);
504: if ($choice =~ /^https?$/) {
505: open(OUT,'>>/tmp/loncapa_updatequery.out');
506: print(OUT 'protocol'."\t".$choice."\n");
507: close(OUT);
508: $protocol=$choice;
509: $flag=1;
510: } elsif ($choice eq '') {
511: open(OUT,'>>/tmp/loncapa_updatequery.out');
512: print(OUT 'protocol'."\t".'http'."\n");
513: close(OUT);
514: $protocol = 'http';
515: $flag = 1;
516: } else {
517: print "Invalid input (only http or https allowed).\n";
518: }
519: }
520:
521: # get internet domain
522: # accept if valid, if not valid, tell user and repeat
523: $flag=0;
524: while (!$flag) {
525: print(<<END);
526:
527: **** Internet Domain Name of Your Institution ****
528:
529: The internet domain name used for servers at your institution
530: should be provided. This will be similar to: ustate.edu or
531: topcollege.ac.uk or myhostingcompany.com, i.e., the part of
532: a server hostname which indicates to which organization the
533: server belongs.
534:
535: ENTER INTERNET DOMAIN NAME:
536: END
537:
538: my $choice=<>;
539: chomp($choice);
540: if ($choice =~/[^.]+\.[^.]+/) {
541: open(OUT,'>>/tmp/loncapa_updatequery.out');
542: print(OUT 'internet domain'."\t".$choice."\n");
543: close(OUT);
544: $intdom=$choice;
545: $flag=1;
546: }
547: else {
548: print "Invalid input (must be at least two levels separated by . - e.g., ustate.edu).\n";
549: }
550: }
551:
552: # get hostname
553: # accept if valid, if not valid, tell user and repeat
554: $flag=0;
555: my $posshostname;
556: if (($hostname =~ /^[A-Za-z0-9\-]+$/) && ($intdom ne '')) {
557: $posshostname = $hostname.'.'.$intdom;
558: }
559: if (($hostname =~ /^[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+/) &&
560: ($hostname =~ /^[A-Za-z0-9.\-]+$/)) {
561: $posshostname = $hostname;
562: }
563: while (!$flag) {
564: print(<<END);
565:
566: ****** Hostname of the server/VM *****
567:
568: The hostname of the server/VM is required. This will be similar to:
569: somename.ustate.edu or somename.department.ustate.edu, and would be
570: the web address which users would point their web browsers at to
571: access the server.
572:
573: END
574:
575: if ($posshostname) {
576: print "ENTER HOSTNAME OF SERVER [$posshostname]:\n";
577: } else {
578: print "ENTER HOSTNAME OF SERVER:\n";
579: }
580:
581: my $choice=<>;
582: chomp($choice);
583: if (($choice =~ /^[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+/) &&
584: ($choice =~ /^[A-Za-z0-9.\-]+$/)) {
585: open(OUT,'>>/tmp/loncapa_updatequery.out');
586: print(OUT 'hostname'."\t".$choice."\n");
587: close(OUT);
588: $desiredhostname=$choice;
589: $flag=1;
590: } elsif (($choice eq '') && ($posshostname ne '')) {
591: open(OUT,'>>/tmp/loncapa_updatequery.out');
592: print(OUT 'hostname'."\t$posshostname\n");
593: close(OUT);
594: $desiredhostname = $posshostname;
595: $flag = 1;
596: } else {
597: print "Invalid input (only letters, numbers, - and . allowed, with at least one .).\n";
598: }
599: }
600:
601: # update loncapa.conf
602: my $confdir = '/etc/httpd/conf/';
603: if ('<DIST />' eq 'sles10' || '<DIST />' eq 'sles11' || '<DIST />' eq 'sles12' || '<DIST />' eq 'sles15' || '<DIST />' eq 'suse10.1' || '<DIST />' eq 'suse10.2' || '<DIST />' eq 'suse10.3' || '<DIST />' eq 'suse11.1' || '<DIST />' eq 'suse11.2' || '<DIST />' eq 'suse11.3' || '<DIST />' eq 'suse11.4' || '<DIST />' eq 'suse12.1' || '<DIST />' eq 'suse12.2' || '<DIST />' eq 'suse12.3' || '<DIST />' eq 'suse13.1' || '<DIST />' eq 'suse13.2' || '<DIST />' eq 'debian5' || '<DIST />' eq 'debian6' || '<DIST />' eq 'ubuntu6' || '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10' || '<DIST />' eq 'ubuntu12' || '<DIST />' eq 'ubuntu14' || '<DIST />' eq 'ubuntu16' || '<DIST />' eq 'ubuntu18' || '<DIST />' eq 'ubuntu20') {
604: $confdir = '/etc/apache2/';
605: }
606: my $filename='loncapa.conf';
607: my %perlvar;
608: if (-e "$confdir$filename") {
609: open(CONFIG,'<'.$confdir.$filename) or die("Can't read $confdir$filename");
610: while (my $configline=<CONFIG>) {
611: if ($configline =~ /^[^\#]*PerlSetVar/) {
612: my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
613: chomp($varvalue);
614: $perlvar{$varname}=$varvalue if $varvalue!~/^\{\[\[\[\[/;
615: }
616: }
617: close(CONFIG);
618: }
619: $perlvar{'lonHostID'}=$lonHostID;
620: $perlvar{'lonDefDomain'}=$lonDefDomain;
621: $perlvar{'lonAdmEMail'}=$lonAdmEMail;
622: $perlvar{'lonSupportEMail'}=$lonSupportEMail;
623: $perlvar{'lonRole'}=$lonRole;
624: unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) {
625: $perlvar{'lonLoadLim'}='2.00';
626: }
627: unless ($perlvar{'lonUserLoadLim'} and $perlvar{'lonUserLoadLim'}!~/\{\[\[\[\[/) {
628: $perlvar{'lonUserLoadLim'}='0';
629: }
630: unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) {
631: $perlvar{'lonExpire'}='86400';
632: }
633: unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
634: my $lonReceipt='';
635: srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
636: my @alnum=(0..9,"a".."z");
637: foreach my $i (1..20) {
638: $lonReceipt.=$alnum[int(rand(36))];
639: }
640: $perlvar{'lonReceipt'}=$lonReceipt;
641: }
642: open(OUT,">$confdir$filename") or
643: die("Cannot output to $confdir$filename\n");
644: foreach my $key (keys %perlvar) {
645: my $value=$perlvar{$key};
646: my $line = "PerlSetVar $key $value";
647: if ($value eq '') {
648: $line = '#'.$line;
649: }
650: print(OUT <<END);
651: $line
652: END
653: }
654: close(OUT);
655: }
656: </perlscript>
657: </file>
658: <file>
659: <target dist='default'>/etc/httpd/conf/</target>
660: <target dist='sles10 sles11 sles12 sles15 suse10.1 suse10.2 suse10.3 suse11.1 suse11.2 suse11.3 suse11.4 suse12.1 suse12.2 suse12.3 suse13.1 suse13.2 debian5 debian6 ubuntu6 ubuntu8 ubuntu10 ubuntu12 ubuntu14 ubuntu16 ubuntu18 ubuntu20'>/etc/apache2/</target>
661: <perlscript mode='fg'>
662: sub securesetting {
663: my (%perlvar)=@_;
664: my $securestatus='unknown';
665: my $securenum='';
666: if ( $perlvar{'loncAllowInsecure'}&& $perlvar{'londAllowInsecure'}) {
667: $securestatus='no'; $securenum='4';
668: } elsif ( $perlvar{'loncAllowInsecure'}&& !$perlvar{'londAllowInsecure'}) {
669: $securestatus='lond'; $securenum='3';
670: } elsif (!$perlvar{'loncAllowInsecure'}&& $perlvar{'londAllowInsecure'}) {
671: $securestatus='lonc'; $securenum='2';
672: } elsif (!$perlvar{'loncAllowInsecure'}&& !$perlvar{'londAllowInsecure'}) {
673: $securestatus='yes (lond and lonc)'; $securenum='1';
674: }
675: return ($securestatus,$securenum);
676: }
677: # read values from loncapa.conf
678: my $confdir = "<TARGET />";
679: my $filename='loncapa.conf';
680: my %perlvar;
681: my ($securestatus,$securenum);
682: if (-e "$confdir$filename") {
683: open(CONFIG,'<'.$confdir.$filename) or
684: die("Can't read $confdir$filename");
685: while (my $configline=<CONFIG>) {
686: if ($configline =~ /^[^\#]*PerlSetVar/) {
687: my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
688: chomp($varvalue);
689: $perlvar{$varname}=$varvalue;
690: }
691: }
692: close(CONFIG);
693: }
694: unless ($perlvar{'lonLoadLim'} and $perlvar{'lonLoadLim'}!~/\{\[\[\[\[/) {
695: $perlvar{'lonLoadLim'}='2.00';
696: }
697: unless ($perlvar{'lonUserLoadLim'} and $perlvar{'lonUserLoadLim'}!~/\{\[\[\[\[/) {
698: $perlvar{'lonUserLoadLim'}='0';
699: }
700: unless ($perlvar{'lonExpire'} and $perlvar{'lonExpire'}!~/\{\[\[\[\[/) {
701: $perlvar{'lonExpire'}='86400';
702: }
703: unless ($perlvar{'londAllowInsecure'} and $perlvar{'londAllowInsecure'}!~/\{\[\[\[\[/) {
704: $perlvar{'londAllowInsecure'}='1';
705: }
706: unless ($perlvar{'loncAllowInsecure'} and $perlvar{'loncAllowInsecure'}!~/\{\[\[\[\[/) {
707: $perlvar{'loncAllowInsecure'}='1';
708: }
709: ($securestatus,$securenum)=&securesetting(%perlvar);
710: unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
711: my $lonReceipt='';
712: srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
713: my @alnum=(0..9,"a".."z");
714: foreach my $i (1..20) {
715: $lonReceipt.=$alnum[int(rand(36))];
716: }
717: $perlvar{'lonReceipt'}=$lonReceipt;
718: }
719: my %perlvarstatic;
720: if (-e "${confdir}loncapa_apache.conf") {
721: open(CONFIG,'<'.$confdir.'loncapa_apache.conf') or
722: die("Can't read ${confdir}loncapa_apache.conf");
723: while (my $configline=<CONFIG>) {
724: if ($configline =~ /^[^\#]*PerlSetVar/) {
725: my ($unused,$varname,$varvalue)=split(/\s+/,$configline);
726: chomp($varvalue);
727: $perlvarstatic{$varname}=$varvalue;
728: }
729: }
730: close(CONFIG);
731: }
732:
733: my (@hosts_files, @domain_files);
734: if ( $lonCluster ne 'existing') {
735: push(@domain_files,'../'.$lonCluster.'_domain.tab',
736: '../'.$lonCluster.'_dns_domain.tab');
737: push(@hosts_files,'../'.$lonCluster.'_hosts.tab',
738: '../'.$lonCluster.'_dns_hosts.tab');
739: }
740: push(@domain_files,'/home/httpd/lonTabs/domain.tab',
741: '/home/httpd/lonTabs/dns_domain.tab');
742: push(@hosts_files,'/home/httpd/lonTabs/hosts.tab',
743: '/home/httpd/lonTabs/dns_hosts.tab');
744:
745: if (!$domainDescription) {
746: foreach my $file (@domain_files) {
747: open(IN,'<'.$file);
748: while(my $line = <IN>) {
749: if ($line =~ /^\Q$perlvar{'lonDefDomain'}\E\:/) {
750: (undef,$domainDescription,$domainTabExtras)=split(/:/,$line,3);
751: chomp($domainDescription);
752: chomp($domainTabExtras);
753: # the remaining field (primary lib server) is handled later
754: $domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]);
755: last;
756: }
757: }
758: close(IN);
759: last if ($domainDescription);
760: }
761: }
762:
763: if ((!$protocol) || (!$desiredhostname)) {
764: foreach my $file (@hosts_files) {
765: open(IN,'<'.$file);
766: while(my $line = <IN>) {
767: if ($line =~ /^\Q$perlvar{'lonHostID'}\E:\Q$perlvar{'lonDefDomain'}\E\:(?:access|library)\:([^:]+)\:(https?)/) {
768: if (!$desiredhostname) {
769: $desiredhostname = $1;
770: }
771: if (!$protocol) {
772: $protocol = $2;
773: chomp($protocol);
774: }
775: last;
776: }
777: }
778: }
779: }
780:
781: if (!$protocol) {
782: $protocol = 'http';
783: }
784:
785: if (!$intdom) {
786: foreach my $file (@hosts_files) {
787: open(IN,'<'.$file);
788: while(my $line = <IN>) {
789: if ($line =~ /^\Q$perlvar{'lonHostID'}\E:\Q$perlvar{'lonDefDomain'}\E\:(?:access|library)\:[^:]+\:https?\:([^:]+)/) {
790: $intdom = $1;
791: chomp($intdom);
792: last;
793: }
794: }
795: }
796: }
797:
798: while(!$primaryLibServer && (@hosts_files || @domain_files)) {
799: my $file = shift(@domain_files);
800: open(IN,'<'.$file);
801: while(my $line = <IN>) {
802: if ($line =~ /^\Q$perlvar{'lonDefDomain'}\E\:/) {
803: $primaryLibServer=(split(/:/,$line))[8];
804: chomp($primaryLibServer);
805: }
806: }
807: close(IN);
808: last if ($primaryLibServer);
809: $file = shift(@hosts_files);
810: open(IN,'<'.$file);
811: while(my $line = <IN>) {
812: if ($line =~ /^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
813: push(@libservers,$1);
814: }
815: }
816: # make list unique
817: @libservers = keys(%{{ map { $_ => 1 } (@libservers) }});
818: close(IN);
819: if (@libservers == 1) {
820: $primaryLibServer = $libservers[0];
821: }
822: }
823:
824: # implement editing logic below, interactively
825: # update loncapa.conf until 15 is entered
826:
827: my $flag=0;
828:
829: while (!$flag) {
830: print(<<END);
831:
832: ===============================================================================
833: This is now the current configuration of your machine.
834: 1) Domain Name: $perlvar{'lonDefDomain'}
835: 2) Domain Description: $domainDescription
836: 3) Machine Name: $perlvar{'lonHostID'}
837: 4) ID of primary library server for domain: $primaryLibServer
838: 5) Server Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
839: 6) Support E-mail Address: $perlvar{'lonSupportEMail'}
840: 7) Web Server Protocol (http or https): $protocol
841: 8) Internet Domain Name: $intdom
842: 9) Hostname: $desiredhostname
843: 10) Role: $perlvar{'lonRole'}
844: 11) Cache Expiration Time: $perlvar{'lonExpire'}
845: 12) Server Load: $perlvar{'lonLoadLim'}
846: 13) User Load: $perlvar{'lonUserLoadLim'}
847: 14) Allow only secure connections: $securestatus
848: 15) Everything is correct up above
849: END
850:
851: my @error;
852: foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) {
853: if (length($v)>35) { push(@error,"Name $v too long"); }
854: if (length($v)<2) { push(@error,"Name $v too short"); }
855: if ($v=~/capa/i) {
856: if ($v!~/^oucapa\d+$/ &&
857: ($v!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
858: push(@error,"Name $v contains 'capa'");
859: }
860: }
861: foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
862: 'editupload') {
863: push(@error,"\nName $v reserved.") if $v eq $bad;
864: }
865: if ($v=~/[^\w\-.]/) { push(@error,"Name $v contains special characters"); }
866: }
867: if ($domainDescription =~ /^\s*$/) {
868: push(@error,"Domain Description is blank.");
869: } elsif ($domainDescription!~/^[\(\)\-\w\s,]+$/) {
870: push(@error,"Domain Description contains special characters.");
871: }
872: foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) {
873: unless ($v=~/^[\d+\.]+$/) { push(@error,"Number expected instead of $v"); }
874: }
875: unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) {
876: push(@error,"Invalid Role");
877: }
878:
879: unless (($protocol eq 'http') || ($protocol eq 'https')) {
880: push(@error,"Invalid Protocol (must be http or https");
881: }
882:
883: if (!defined($intdom)) {
884: push(@error,"No internet domain name designated. Enter something like ustate.edu");
885: } elsif ($intdom !~ /[^.]+\.\w{2,6}$/) {
886: push(@error,"Invalid Internet domain name (must be at least two levels separated by . - e.g., ustate.edu");
887: }
888:
889: if (!defined($primaryLibServer)) {
890: if (@libservers > 0) {
891: push(@error,"No primary library server ID designated. Choose from: ".join(',',sort(@libservers)));
892: } else {
893: push(@error,"No library servers in this domain (including current server)");
894: }
895: } else {
896: if (length($primaryLibServer)>35) { push(@error,"Primary Library Server ID: $primaryLibServer too long"); }
897: if (length($primaryLibServer)<2) { push(@error,"Primary Library Server ID: $primaryLibServer too short"); }
898: if ($primaryLibServer =~/capa/i) {
899: if ($primaryLibServer!~/^oucapa\d+$/ &&
900: ($primaryLibServer!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
901: push(@error,"Primary library server ID $primaryLibServer contains 'capa'")
902: }
903: }
904: foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
905: 'editupload') {
906: push(@error,"Primary library server ID $primaryLibServer reserved.") if $primaryLibServer eq $bad;
907: }
908: if ($primaryLibServer=~/[^\w\-.]/) { push(@error,"Primary library server ID $primaryLibServer contains special characters"); }
909: }
910:
911:
912: if (@error) { print "\n*** ERRORS: \n\t".join("\n\t",@error)."\n"; }
913: print(<<END);
914: ENTER A CHOICE OF 1-14 TO CHANGE, otherwise ENTER 15:
915: END
916: my $choice=<>;
917: chomp($choice);
918: if ($choice==1) {
919: print(<<END);
920: 1) Domain Name: $perlvar{'lonDefDomain'}
921: ENTER NEW VALUE (this is an internal value used to identify a group of
922: LON-CAPA machines, it must be alphanumerical, we suggest
923: using a part of your actual DNS domain. For example, for
924: the machine loncapa.msu.edu, we set the Domain to msu):
925: END
926: my $choice2=<>;
927: chomp($choice2);
928: $perlvar{'lonDefDomain'}=$choice2;
929: }
930: elsif ($choice==2) {
931: print(<<END);
932: 2) Domain Description: $domainDescription
933: ENTER NEW VALUE (this should be a string that describes your domain, spaces
934: and punctuation are fine except for ':'):
935: END
936: my $choice2=<>;
937: chomp($choice2);
938: $domainDescription=$choice2;
939: }
940: elsif ($choice==3) {
941: print(<<END);
942: 3) Machine Name: $perlvar{'lonHostID'}
943: ENTER NEW VALUE (this will be the name of the machine in the LON-CAPA network
944: it cannot contain any of '_' '-' '.' or ':'. We suggest that
945: if you are in the domain 'example' and are the first library
946: server you enter 'examplel1') :
947: END
948: my $choice2=<>;
949: chomp($choice2);
950: $perlvar{'lonHostID'}=$choice2;
951: }
952: elsif ($choice==4) {
953: print(<<END);
954: 4) ID of primary library server for domain: $primaryLibServer
955: ENTER NEW VALUE (this will be the LON-CAPA Machine ID of a library server in
956: your domain; it cannot contain any of '_' '-' '.' or ':'.
957: This server will be where domain data which are not
958: associated with any specific home library server
959: will be stored (e.g., e-mail broadcast by Domain Coordinators
960: to users in the domain).
961: END
962: my $choice2=<>;
963: chomp($choice2);
964: $primaryLibServer=$choice2;
965: }
966: elsif ($choice==5) {
967: print(<<END);
968: 5) Server Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
969: ENTER NEW VALUE:
970: END
971: my $choice2=<>;
972: chomp($choice2);
973: $perlvar{'lonAdmEMail'}=$choice2;
974: }
975: elsif ($choice==6) {
976: print(<<END);
977: 6) Support E-mail Address: $perlvar{'lonSupportEMail'}
978: ENTER NEW VALUE:
979: END
980: my $choice2=<>;
981: chomp($choice2);
982: $perlvar{'lonSupportEMail'}=$choice2;
983: }
984: elsif ($choice==7) {
985: print(<<END);
986: 7) Server Protocol (http or https):
987: ENTER NEW VALUE: (this should be either 'http' or 'https'
988: if in doubt set to 'http'):
989: END
990: my $choice2=<>;
991: chomp($choice2);
992: $protocol=$choice2;
993: }
994: elsif ($choice==8) {
995: print(<<END);
996: 8) Internet Domain Name of Institution
997: ENTER NEW VALUE:
998:
999: END
1000: my $choice2=<>;
1001: chomp($choice2);
1002: $intdom=$choice2;
1003: }
1004: elsif ($choice==9) {
1005: print(<<END);
1006: 9) Hostname of Server/VM
1007: ENTER NEW VALUE:
1008:
1009: END
1010: my $choice2=<>;
1011: chomp($choice2);
1012: $desiredhostname=$choice2;
1013: }
1014:
1015: elsif ($choice==10) {
1016: print(<<END);
1017: 10) Role: $perlvar{'lonRole'}
1018: ENTER NEW VALUE (this should be either 'access' or 'library'
1019: if in doubt select 'library'):
1020: END
1021: my $choice2=<>;
1022: chomp($choice2);
1023: $perlvar{'lonRole'}=$choice2;
1024: }
1025: elsif ($choice==11) {
1026: print(<<END);
1027: 11) Cache Expiration Time: $perlvar{'lonExpire'}
1028: ENTER NEW VALUE (in seconds, 86400 is a reasonable value):
1029: END
1030: my $choice2=<>;
1031: chomp($choice2);
1032: $perlvar{'lonExpire'}=$choice2;
1033: }
1034: elsif ($choice==12) {
1035: print(<<END);
1036: 12) Server Load: $perlvar{'lonLoadLim'}
1037: ENTER NEW VALUE:
1038: END
1039: my $choice2=<>;
1040: chomp($choice2);
1041: $perlvar{'lonLoadLim'}=$choice2;
1042: }
1043: elsif ($choice==13) {
1044: print(<<END);
1045: 13) User Load: $perlvar{'lonUserLoadLim'}
1046: Numer of users that can login before machine is 'overloaded'
1047: ENTER NEW VALUE (integer value, 0 means there is no limit):
1048: END
1049: my $choice2=<>;
1050: chomp($choice2);
1051: $perlvar{'lonUserLoadLim'}=$choice2;
1052: }
1053: elsif ($choice==14) {
1054: print(<<END);
1055: 14) Allow only secure connections: $securestatus
1056: The Lon-CAPA communication daemons lonc and lond can be configured to
1057: allow only secure connections by default.
1058:
1059: POSSIBLE CHOICES:
1060: 1) allow only secure connections and don't connect to machines that
1061: can not be connected to securely
1062: 2) allow only secure connections but allow this machine to connect to
1063: machines that don't support secure connections
1064: 3) allow insecure connections to this machine but only allow connections
1065: to machines that support secure connections
1066: 4) allow insecure connections
1067: ENTER NEW VALUE (currently $securenum):
1068: END
1069: my $choice2=<>;
1070: chomp($choice2);
1071: if ($choice2 eq '1') {
1072: $perlvar{'loncAllowInsecure'}=0;$perlvar{'londAllowInsecure'}=0;
1073: } elsif ($choice2 eq '2') {
1074: $perlvar{'loncAllowInsecure'}=0;$perlvar{'londAllowInsecure'}=1;
1075: } elsif ($choice2 eq '3') {
1076: $perlvar{'loncAllowInsecure'}=1;$perlvar{'londAllowInsecure'}=0;
1077: } elsif ($choice2 eq '4') {
1078: $perlvar{'loncAllowInsecure'}=1;$perlvar{'londAllowInsecure'}=1;
1079: }
1080: ($securestatus,$securenum)=&securesetting(%perlvar);
1081: }
1082: elsif (($choice==15) && (!@error)) {
1083: $flag=1;
1084: }
1085: else {
1086: print "Invalid input.\n";
1087: }
1088: }
1089:
1090: open(OUT,">$confdir$filename") or
1091: die("Cannot output to $confdir$filename\n");
1092: foreach my $key (keys %perlvar) {
1093: my $value=$perlvar{$key};
1094: my $line = "PerlSetVar $key $value";
1095: if ($value eq '') {
1096: $line = '#'.$line;
1097: }
1098: print(OUT <<END) unless $perlvarstatic{$key};
1099: $line
1100: END
1101: }
1102: close(OUT);
1103: </perlscript>
1104: </file>
1105: <file>
1106: <target dist='default'>loncom/hosts.tab</target>
1107: <perlscript mode='fg'>
1108: unless (-l "<TARGET />") {
1109: if ($desiredhostname eq '') {
1110: my $hostname=`hostname -f`;chomp($hostname);
1111: $desiredhostname = $hostname;
1112: }
1113: my $date=`date -I`; chomp($date);
1114: my $lonHostID=$perlvar{'lonHostID'};
1115: $lonHostID=~s/[^\w\-.]//g;
1116: my $lineexistflag=0;
1117: my $hostidexistflag=0;
1118: my $line2insert=<<END;
1119: $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$desiredhostname:$protocol:$intdom
1120: END
1121: if (!$domainTabExtras) {
1122: $domainTabExtras=':::::';
1123: }
1124: my $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n";
1125: if ($lonCluster eq 'standalone') {
1126: open(OUT,'>../'.$lonCluster.'_hosts.tab') or
1127: die('file generation error');
1128: print(OUT $line2insert);
1129: print OUT ("^$desiredhostname:$protocol\n");
1130: close(OUT);
1131: open(OUT,'>../'.$lonCluster.'_dns_hosts.tab') or
1132: die('file generation error');
1133: print(OUT $line2insert);
1134: close(OUT);
1135: open(OUT,'>../'.$lonCluster.'_domain.tab') or
1136: die('file generation error');
1137: print(OUT $domaininsert);
1138: close(OUT);
1139: open(OUT,'>../'.$lonCluster.'_dns_domain.tab') or
1140: die('file generation error');
1141: print(OUT $domaininsert);
1142: close(OUT);
1143: }
1144: if ($flag==1) {
1145: `rm -f ../hosts.tab`;
1146: `rm -f ../dns_hosts.tab`;
1147: `ln -s ${lonCluster}_dns_hosts.tab ../dns_hosts.tab`;
1148: open(IN,'<../'.$lonCluster.'_dns_hosts.tab');
1149: while(my $line = <IN>) {
1150: if ($line =~ /^\Q$line2insert\E$/) {
1151: $lineexistflag=1;
1152: }
1153: if ($line =~ /^\Q$lonHostID\E\:/) {
1154: $hostidexistflag=1;
1155: }
1156: }
1157: close(IN);
1158: if ($hostidexistflag and !$lineexistflag) {
1159: print <<END;
1160: WARNING: $lonHostID already exists inside
1161: loncapa/loncom/${lonCluster}_dns_hosts.tab. The entry inside
1162: ${lonCluster}_dns_hosts.tab does not match your settings.
1163: An entry inside ${lonCluster}_hosts.tab will be made
1164: with your new values.
1165: END
1166: `grep -v "$lonHostID:" ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`;
1167: open(OUT,'>>../new_'.$lonCluster.'_hosts.tab') or
1168: die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
1169: print(OUT $line2insert);
1170: close(OUT);
1171: `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
1172: # email appropriate message
1173: `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$protocol:$intdom:$date" installrecord\@mail.lon-capa.org`;
1174: }
1175: elsif ($hostidexistflag and $lineexistflag) {
1176: print <<END;
1177: Entry exists in ${lonCluster}_dns_hosts.tab. Making duplicate entry in ${lonCluster}_hosts.tab
1178: END
1179: `grep -v "$lonHostID:" ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`;
1180: open(OUT,'>>../new_'.$lonCluster.'_hosts.tab') or
1181: die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
1182: print(OUT $line2insert);
1183: close(OUT);
1184: `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
1185: # email appropriate message
1186: `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$protocol:$intdom:$date" installrecord\@mail.lon-capa.org`;
1187: }
1188: elsif (!$hostidexistflag and !$lineexistflag) {
1189: print <<END;
1190: New entry for $lonCluster.
1191: END
1192: `cat ../${lonCluster}_hosts.tab > ../new_${lonCluster}_hosts.tab`;
1193: open(OUT,'>>../new_'.$lonCluster.'_hosts.tab') or
1194: die("cannot open loncom/new_${lonCluster}_hosts.tab for output\n");
1195: print(OUT $line2insert);
1196: close(OUT);
1197: `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
1198: # email appropriate message
1199: `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$protocol:$intdom:$date" installrecord\@mail.lon-capa.org`;
1200: }
1201: }
1202: $lineexistflag=0;
1203: my $domainexistflag=0;
1204: if ($flag==1) {
1205: `rm -f ../domain.tab`;
1206: `rm -f ../dns_domain.tab`;
1207: `ln -s ${lonCluster}_dns_domain.tab ../dns_domain.tab`;
1208: open(IN,'<../'.$lonCluster.'_dns_domain.tab');
1209: while(my $line = <IN>) {
1210: if ($line =~/^\Q$domaininsert\E$/) {
1211: $lineexistflag=1;
1212: }
1213: if ($line =~/^\Q$perlvar{'lonDefDomain'}\E\:/) {
1214: $domainexistflag=1;
1215: }
1216: }
1217: close(IN);
1218: if ($domainexistflag and !$lineexistflag) {
1219: print <<END;
1220: WARNING: $perlvar{'lonDefDomain'} already exists inside
1221: loncapa/loncom/${lonCluster}_dns_domain.tab. The entry inside
1222: ${lonCluster}_dns_domain.tab does not match your settings.
1223: An entry will be made in inside ${lonCluster}_domain.tab
1224: with your new values.
1225: END
1226: `grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab > ../new_${lonCluster}_domain.tab`;
1227: open(OUT,'>>../new_'.$lonCluster.'_domain.tab') or
1228: die("cannot open loncom/${lonCluster}_domain.tab for output\n");
1229: print(OUT $domaininsert);
1230: close(OUT);
1231: `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
1232: # email appropriate message
1233: `echo "REPLACEdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "REPLACEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1234: }
1235: elsif ($domainexistflag and $lineexistflag) {
1236: `grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab > ../new_${lonCluster}_domain.tab`;
1237: open(OUT,'>>../new_'.$lonCluster.'_domain.tab') or
1238: die("cannot open loncom/${lonCluster}_domain.tab for output\n");
1239: print(OUT $domaininsert);
1240: close(OUT);
1241: print <<END;
1242: Entry exists in ${lonCluster}_dns_domain.tab. Making duplicate entry in ${lonCluster}_domain.tab
1243: END
1244: `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
1245: # email appropriate message
1246: `echo "STABLEUPDATEdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "STABLEUPDATEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1247: }
1248: elsif (!$domainexistflag and !$lineexistflag) {
1249: print <<END;
1250: New entry for $lonCluster.
1251: END
1252: `cat ../${lonCluster}_domain.tab > ../new_${lonCluster}_domain.tab`;
1253: open(OUT,'>>../new_'.$lonCluster.'_domain.tab') or
1254: die("cannot open loncom/new_${lonCluster}_domain.tab for output\n");
1255: print(OUT $domaininsert);
1256: close(OUT);
1257: `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
1258: # email appropriate message
1259: `echo "INSERTdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "INSERTdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
1260: }
1261: }
1262: }
1263: </perlscript>
1264: </file>
1265: </files>
1266: </piml>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>