File:  [LON-CAPA] / loncom / build / Attic / postinstall.pl
Revision 1.2: download - view: text, annotated - select for diffs
Mon Nov 20 22:52:05 2000 UTC (23 years, 7 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
nearing completion.. I still need to refigure out some details.. -Scott

    1: #!/usr/bin/perl
    2: 
    3: # A post-installation script
    4: # to finalize a LON-CAPA
    5: # installation.
    6: 
    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: if (1==0) {
   13: # get wget and install
   14: 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');
   15: system('rpm','-Uvh','--force','wget-1.5.3-6.i386.rpm');
   16: 
   17: # download SupplementalRPMS and install
   18: system('wget','-r','http://install.lon-capa.org/3.1/SupplementalRPMS');
   19: system('rpm','-Uvh','--force','install.lon-capa.org/3.1/SupplementalRPMS');
   20: 
   21: # download remove_extra.sh and run
   22: system('wget','http://install.lon-capa.org/3.1/scripts/remove_extra.sh');
   23: system('sh','./remove_extra.sh');
   24: 
   25: # download FinalRPMS and install
   26: system('wget','-r','http://install.lon-capa.org/3.1/FinalRPMS');
   27: system('rpm','-Uvh','--force','install.lon-capa.org/3.1/FinalRPMS');
   28: 
   29: # allow entry of new access.conf parameters
   30: my @perlsetvars=("lonHostID","lonRole","lonAdmEMail","lonDefDomain","lonLoadLim","lonExpire");
   31: my %psvinfo=(
   32: 	     "lonHostID" => <<END
   33: LON Host ID is an internal ID within the LON-CAPA
   34: network used to specify the uniqueness of a particular
   35: LON-CAPA server.  Current examples include "msul1", "msua3",
   36: "103l1", "fsul1", and "107a1".
   37: END
   38: ,	     "lonRole" => <<END
   39: LON Role specifies the role this machine plays within
   40: the LON-CAPA network.  There are two valid values for
   41: this:
   42:  * library
   43:  * access
   44: END
   45: ,	     "lonAdmEMail" => <<END
   46: LON System Administrator E-Mail specifies the e-mail
   47: address of an institutional member responsible for
   48: direct upkeep of this server.
   49: END
   50: ,	     "lonDefDomain" => <<END
   51: LON Domain is a unique internal identifier within the LON-CAPA network
   52: specific to the home institution.  Current examples include
   53: "msu", "fsu", "103", and "107".
   54: END
   55: ,	     "lonLoadLim" => <<END
   56: LON Load Limit specifies a threshold of activity within The Learning
   57: Online Network that this machine should provide.  We strongly recommend
   58: a value of 2.00.  Depending on processor architecture (dual processor),
   59: this value may be increased, but there is no readily available measure
   60: in this regard.
   61: END
   62: ,	     "lonExpire" => <<END
   63: LON Expiration Time indicates, in seconds, how long distributed resources
   64: should be held in the server's cache when not being accessed by students,
   65: instructors, or any other class of user.  We recommend a value of 86400.
   66: END
   67: 	     );
   68: my $template=`/bin/cat /etc/httpd/conf/access.conf`;
   69: my $okay=0;
   70: while ($okay==0) {
   71:     foreach my $psv (@perlsetvars) {
   72:         print "\n";
   73:         print $psvinfo{$psv};
   74:         print "\nEnter in value for $psv: "; my $input=<>; chop $input;
   75:         my $pval=$input;
   76:         $template=~s/(\nPerlSetVar\s+$psv\s+)\S+/$1$pval/;
   77:         $pvar{$psv}=$pval;
   78:     }
   79:     print "\n\nThese are the current values:\n";
   80:     foreach my $psv (@perlsetvars) {
   81:         print "$psv\t\t$pvar{$psv}\n";
   82:     }
   83:     print "Are these correct? (y/n)";
   84:     my $input=<>;
   85:     if ($input=~/^y/i) {
   86:         $okay=1;
   87:     }
   88: }
   89: open OUT,">/etc/httpd/conf/access.conf";
   90: print OUT $template;
   91: close OUT;
   92: 
   93: $template=`/bin/cat /etc/smb.conf`;
   94: foreach my $psv (@perlsetvars) {
   95:     $template=~s/\{\{\{\{\[(.*?)\]\}\}\}\}/$pvar{$1}/ge;
   96: }
   97: open OUT,">/etc/smb.conf";
   98: print OUT $template;
   99: close OUT;
  100: }
  101: # unshadow passwords
  102: # change this line in /etc/pam.d/login
  103: # password   required     /lib/security/pam_pwdb.so nullok use_authtok md5 shadow
  104: $template=`/bin/cat /etc/pam.d/login`;
  105: $template=~s|password   required     /lib/security/pam_pwdb\.so nullok use_authtok md5 shadow|password   required     /lib/security/pam_pwdb.so nullok use_authtok|;
  106: open OUT, ">/etc/pam.d/login";
  107: print OUT $template;
  108: close OUT;
  109: # change this line in /etc/pam.d/passwd
  110: # password   required     /lib/security/pam_pwdb.so use_authtok nullok md5 shadow 
  111: $template=`/bin/cat /etc/pam.d/passwd`;
  112: $template=~s|password   required     /lib/security/pam_pwdb\.so nullok use_authtok md5 shadow|password   required     /lib/security/pam_pwdb.so nullok use_authtok|;
  113: open OUT, ">/etc/pam.d/passwd";
  114: print OUT $template;
  115: close OUT;
  116: `/usr/sbin/pwunconv`;
  117: `/usr/sbin/grpunconv`;
  118: # set new passwords
  119: print "Now we need to have passwords entered in order to unshadow this machine.\n";
  120: system('stty -echo');
  121: $okay=0;
  122: my $input1;
  123: my $input2;
  124: while ($okay==0) {
  125:     print "Enter in password for root: ";
  126:     $input1=<>; chop $input1;
  127:     print "\nEnter in password again for root: ";
  128:     $input2=<>; chop $input2;
  129:     if ($input1 ne $input2) {
  130:         print "\nPasswords do not match, try again.\n";
  131:     }
  132:     else {
  133:         $okay=1;
  134:     }
  135: }
  136: open OUT, "|/usr/sbin/chpasswd";
  137: print OUT "root:$input1\n";
  138: close OUT;
  139: 
  140: $okay=0;
  141: while ($okay==0) {
  142:     print "\nEnter in password for www: ";
  143:     $input1=<>; chop $input1;
  144:     print "\nEnter in password again for www: ";
  145:     $input2=<>; chop $input2;
  146:     if ($input1 ne $input2) {
  147:         print "\nPasswords do not match, try again.\n";
  148:     }
  149:     else {
  150:         $okay=1;
  151:     }
  152: }
  153: open OUT, "|/usr/sbin/chpasswd";
  154: print OUT "www:$input1\n";
  155: close OUT;
  156: system('stty echo');
  157: 
  158: 
  159: if (1==0) {
  160: # create mime.types link
  161: `ln -s /etc/mime.types /etc/httpd/conf/mime.types`;
  162: 
  163: # restart network and inet services
  164: system('/etc/rc.d/init.d/network','reload');
  165: system('/etc/rc.d/init.d/inet','restart');
  166: # restart httpd
  167: system('/etc/rc.d/init.d/httpd','restart');
  168: 
  169: # fix the setup of init.d processes
  170: # nfs
  171: # atalk
  172: 
  173: # make atalk specific modifications
  174: # /etc/services
  175: # /etc/atalk/conf
  176: 
  177: # restart nfs, smb, and atalk services
  178: system('/etc/rc.d/init.d/smb','restart');
  179: system('/etc/rc.d/init.d/atalk','restart');
  180: 
  181: 
  182: # restart loncontrol
  183: print "Please be patient while loncontrol services are restarted (approximately 10 minutes).\n";
  184: system('/etc/rc.d/init.d/loncontrol','restart');
  185: 
  186: # warn about /etc/hosts.allow
  187: print <<END;
  188: Final note:  Currently your machine is set-up
  189: to disable many different kinds of network
  190: connectivity.  To enable network connectivity
  191: different than that needed for LON-CAPA, you
  192: must make appropriate adjustment to the
  193: /etc/hosts.allow file.
  194: END
  195: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>