Annotation of loncom/build/install_web_site_cronjob, revision 1.4

1.1       harris41    1: #!/usr/bin/perl
                      2: 
                      3: =pod
                      4: 
                      5: =head1 NAME
                      6: 
                      7: install_web_site_cronjob - maintain install.lon-capa.org web-site every day
                      8: 
                      9: =head1 DESCRIPTION
                     10: 
                     11: This is a file that runs periodically on B<install.lon-capa.org>.
                     12: 
                     13: This file should be run by the 'loninst' user and be part of
                     14: the 'loninst' crontab entries (to view loninst crontab, login
                     15: as loninst and crontab C<-l>; to edit loninst crontab, login as
                     16: loninst and crontab C<-e>).
                     17: 
                     18: This file should be on the B<install.lon-capa.org> filesystem as
1.2       harris41   19: F</home/loninst/auto/install_web_site_cronjob>.
1.1       harris41   20: 
                     21: The current 'loninst' crontab entry is:
                     22: 
1.2       harris41   23: 13 16 * * *    /home/loninst/auto/install_web_site_cronjob
1.1       harris41   24: 
1.2       harris41   25: The main goal of B<install_web_site_cronjob> is to periodically produce the
1.3       albertel   26: unstable tarball needed for LON-CAPA installation.
1.1       harris41   27: 
1.2       harris41   28: A secondary yet important function of B<install_web_site_cronjob> is that it
1.1       harris41   29: also refreshes the documentation present on the install.lon-capa.org
                     30: web site.
                     31: 
1.3       albertel   32: It does depend on a file name LATEST-IS-something, where something is
                     33: the latest release of loncapa, that file should also contain a string
                     34: that will be used to date the release.
                     35: 
1.1       harris41   36: The coding of this script is a strange brew of shell commands
                     37: with perl.
                     38: 
                     39: =head1 AUTHOR
                     40: 
                     41: Scott Harrison 2002-07-19
                     42: 
                     43: =cut
                     44: 
                     45: # --------------------------------------------- Making the tarball distribution
1.3       albertel   46: #`cd /home/loninst/auto; export CVS_PASSFILE=/home/loninst/.cvspass; export CVSROOT=:pserver:scott\@localhost:/home/cvs; rm -Rf loncapa/[C][^V]*; rm -Rf loncapa/[^C]*; cvs -Q co loncapa; cd loncapa/loncom/build; make build 2>/dev/null; make tardist;`;
1.4     ! harris41   47: `cd /home/loninst/auto; export CVS_PASSFILE=/home/loninst/.cvspass; export CVSROOT=:pserver:scott\@localhost:/home/cvs; rm -Rf loncapa-unstable; rm -Rf loncapa; cvs -Q export -r HEAD loncapa;`;
        !            48: open(OUT,'>/home/loninst/auto/loncapa/README');
        !            49: print(OUT <<END);
        !            50: This is a CVS export of LON-CAPA generated on:
        !            51: END
        !            52: print(OUT `date`);
        !            53: print(OUT <<END);
        !            54: 
        !            55: To generate an installable tarball distribution from this file, you can
        !            56: execute the following commands:
        !            57: cd loncom/build
        !            58: make tardist
        !            59: 
        !            60: Note that the installable tarball distribution (the 'tardist' target)
        !            61: is what encapsulates the stable releases of the LON-CAPA software (as
        !            62: well as ensuring that LON-CAPA's distributability does not rely solely on
        !            63: CVS software).
        !            64: 
        !            65: END
        !            66: print(OUT <<END);
        !            67: An alternative Makefile command sequence is:
        !            68: cd loncom/build
        !            69: make build
        !            70: make install
        !            71: 
        !            72: For more information on Makefile targets, you can just enter the following
        !            73: commands:
        !            74: cd loncom/build
        !            75: make help
        !            76: 
        !            77: Finally, if you encounter any problems, be sure to enter them
        !            78: into the bug database http://bugs.lon-capa.org/ or, alternatively,
        !            79: discuss them on one of the mailing lists available at
        !            80: http://mail.lon-capa.org/.
        !            81: END
        !            82: close(OUT);
        !            83: `cd /home/loninst/auto; ln -s loncapa loncapa-unstable; tar cvvf loncapa-unstable.tar loncapa-unstable/* ;gzip -9 -f loncapa-unstable.tar`;
1.1       harris41   84: # ---------------------------------------- Dynamically generating documentation
                     85: `cd /home/loninst/auto/loncapa/loncom/build; make pdfdoc`;
                     86: `cd /home/loninst/auto/loncapa/loncom/build; make doc`;
                     87: `cd /home/loninst/auto/loncapa/loncom/build; cp docs.tar.gz /home/loninst/public_html/docs/.`;
                     88: `cd /home/loninst/public_html/docs; tar xzf docs.tar.gz`;
                     89: 
                     90: # ------------------------------------ Copying over the latest unstable tarball
1.3       albertel   91: #my $filename=`cd /home/loninst/auto; find loncapa -type f -name *.tar.gz -maxdepth 1`;
                     92: #chomp($filename);
                     93: #$filename=~/loncapa\/loncapa\-(.*?)\.tar\.gz/;
                     94: #my $version=$1;
                     95: `cd /home/loninst/auto; cp -f loncapa-unstable.tar.gz ../public_html/versions/loncapa-unstable.tar.gz`;
                     96: #`cd /home/loninst/public_html/versions; rm -f loncapa-unstable.tar.gz; ln -s loncapa-$version-unstable.tar.gz loncapa-unstable.tar.gz`;
                     97: 
                     98: #get latest version
                     99: my $filename=`cd /home/loninst/public_html/versions; find . -type f -name LATEST-IS-* -maxdepth 1`;
1.1       harris41  100: chomp($filename);
1.3       albertel  101: $filename=~/LATEST-IS-(.*)/;
1.1       harris41  102: my $version=$1;
1.3       albertel  103: open(IN,"</home/loninst/public_html/versions/$filename");
                    104: my $releasedate=<IN>;
                    105: close(IN);
1.1       harris41  106: # ------------------ Updating the download page with the date of the last build
                    107: open(IN,"</home/loninst/public_html/docs/downloads/index.html");
                    108: my @lines=<IN>;
                    109: close(IN);
                    110: my $date=`date -I`; chomp($date);
                    111: my $text=join('',@lines);
                    112: $text=~s/loncapa-unstable\.tar\.gz\<\/a\>.*?\./loncapa-unstable\.tar\.gz\<\/a\> (generated $date)\./;
1.3       albertel  113: $text=~s/LATESTVERSION/$version/g;
                    114: $text=~s/LATESTDATE/$releasedate/g;
1.1       harris41  115: open(OUT,">/home/loninst/public_html/docs/downloads/index.html");
                    116: print(OUT $text);
                    117: close(OUT);

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