Annotation of loncom/build/postinstall.pl, revision 1.3

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: 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: 
1.1       harris41   29: # allow entry of new access.conf parameters
1.2       harris41   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: }
1.1       harris41  101: # unshadow passwords
1.2       harris41  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) {
1.1       harris41  160: # create mime.types link
1.2       harris41  161: `ln -s /etc/mime.types /etc/httpd/conf/mime.types`;
                    162: 
1.1       harris41  163: # restart network and inet services
1.2       harris41  164: system('/etc/rc.d/init.d/network','reload');
                    165: system('/etc/rc.d/init.d/inet','restart');
1.1       harris41  166: # restart httpd
1.2       harris41  167: system('/etc/rc.d/init.d/httpd','restart');
                    168: 
                    169: # fix the setup of init.d processes
                    170: # nfs
1.3     ! harris41  171: # bash$ diff nfs nfs~
        !           172: # 6c6
        !           173: # < # chkconfig: 345 60 20
        !           174: # ---
        !           175: # > # chkconfig: - 60 20
        !           176: # then chkconfig
        !           177: 
        !           178: # ntp
        !           179: # chkconfig 345
        !           180: # then chkconfig
        !           181: 
1.2       harris41  182: 
                    183: # make atalk specific modifications
1.3     ! harris41  184: # /etc/atalk/config
        !           185: open OUT, ">/etc/atalk/config";
        !           186: print OUT <<END;
        !           187: # Appletalk configuration
        !           188: # Change this to increase the maximum number of clients that can connect:
        !           189: AFPD_MAX_CLIENTS=5
        !           190: # Change this to set the machine's atalk name:
        !           191: # ATALK_NAME=`echo \${HOSTNAME}|cut -d. -f1`
        !           192: ATALK_NAME=`grep '^PerlSetVar.*lonHostID' /etc/httpd/conf/access.conf | perl -e '\$_=<>; split(/\s+/); print "LONCAPA_\$_[2]";
        !           193: '`
        !           194: # Set which daemons to run:
        !           195: PAPD_RUN=no
        !           196: AFPD_RUN=yes
        !           197: # Control whether the daemons are started in the background
        !           198: ATALK_BGROUND=no
        !           199: END
        !           200: close OUT;
        !           201: # /etc/conf.modules should have this line
        !           202: #      alias net-pf-5 appletalk
        !           203: # depmod -a
        !           204: $template=`/bin/cat /etc/conf.modules`;
        !           205: $template.="alias net-pf-5 appletalk\n";
        !           206: open OUT, ">/etc/conf.modules";
        !           207: print OUT $template;
        !           208: close OUT;
        !           209: system('depmod -a');
1.2       harris41  210: 
                    211: # restart nfs, smb, and atalk services
                    212: system('/etc/rc.d/init.d/smb','restart');
                    213: system('/etc/rc.d/init.d/atalk','restart');
1.3     ! harris41  214: system('/etc/rc.d/init.d portmap','stop');
        !           215: system('/etc/rc.d/init.d nfs','stop');
        !           216: system('/etc/rc.d/init.d portmap','start');
        !           217: system('/etc/rc.d/init.d nfs','start');
        !           218: system('/etc/rc.d/init.d/smb','restart');
        !           219: system('/etc/rc.d/init.d/inet','restart');
1.2       harris41  220: 
1.1       harris41  221: # restart loncontrol
1.2       harris41  222: print "Please be patient while loncontrol services are restarted (approximately 10 minutes).\n";
                    223: system('/etc/rc.d/init.d/loncontrol','restart');
                    224: 
1.1       harris41  225: # warn about /etc/hosts.allow
1.2       harris41  226: print <<END;
                    227: Final note:  Currently your machine is set-up
                    228: to disable many different kinds of network
                    229: connectivity.  To enable network connectivity
                    230: different than that needed for LON-CAPA, you
                    231: must make appropriate adjustment to the
                    232: /etc/hosts.allow file.
                    233: END
                    234: }

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