diff options
author | Karl Berry <karl@freefriends.org> | 2008-11-28 19:41:43 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-11-28 19:41:43 +0000 |
commit | cd4b5fe45badc6ba0da1fa2be8dc346a6b286799 (patch) | |
tree | e449515ebcbc2550b860739d0e099102c19aa462 | |
parent | 37b115bf1acae80db5c25272a50debcca5fe1211 (diff) |
(xchdir, xsystem): new fns.
(install_files): unpack necessary files for the
installer to run, instead of just the whole
archive in the install-tl subdir.
git-svn-id: svn://tug.org/texlive/trunk@11461 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/tlpkg/bin/tl-update-install-pkg | 96 |
1 files changed, 67 insertions, 29 deletions
diff --git a/Master/tlpkg/bin/tl-update-install-pkg b/Master/tlpkg/bin/tl-update-install-pkg index fec99833c4e..d699c6d380b 100755 --- a/Master/tlpkg/bin/tl-update-install-pkg +++ b/Master/tlpkg/bin/tl-update-install-pkg @@ -6,7 +6,7 @@ # or any later version. # This script creates the zip (everything) and tgz (omits windows) -# archives to do a network install. Runs from cron. +# archives to do a network install. Invoked from tl-update-tlnet. BEGIN { $^W = 1; @@ -40,15 +40,15 @@ sub usage print <<'EOF'; Usage: tl-make-install-pkg [-h|--help] [-v|--verbose] -o|--outputdir=DIR -tl-make-install-pkg generates a .tar.gz file for Unix and a .zip file -for all systems containing all the files needed to install TeX Live -from the network. +Generate a .tar.gz file for Unix and a .zip file for all systems +containing all the files needed to install TeX Live from the network. +An existing directory must be specified as the output location. Options: - -h|--help Print this message and exit. - -t|--texlivedocs Include the pdf and html versions of the texlive guide - -o|--outputdir Target directory. Must exist and be writable. - -v|--verbose Extra messages. + -h, --help Print this message and exit. + -t, --texlivedocs Include the pdf and html versions of the texlive guide + -o, --outputdir Target directory. Must exist and be writable. + -v, --verbose Extra messages. EOF ; exit 0; @@ -58,9 +58,9 @@ usage if (@ARGV<1); TeXLive::TLUtils::process_logging_options(); GetOptions( - "verbose|v", - "texlivedocs|t", "outputdir|o=s", + "texlivedocs|t", + "verbose|v", "help|h") or usage; usage if $opt_help; @@ -75,9 +75,7 @@ die "$0: the output directory must be specified; try --help if you need it.\n" if ! $opt_outputdir; my $outputdir = $opt_outputdir; -# cleanup. - -my @signals=qw(HUP INT ILL FPE SEGV TERM ABRT QUIT BUS PIPE); +my @signals = qw(HUP INT ILL FPE SEGV TERM ABRT QUIT BUS PIPE); sub cleanup { if (-d "$tmpdir") { @@ -105,20 +103,21 @@ if ($opt_verbose) { info("outputdir: \"$outputdir\"\n"); } -die "$0: Output directory does not exist: $outputdir.\n" unless -d $outputdir; +die "$0: Output directory does not exist: $outputdir.\n" unless -e $outputdir; +die "$0: $outputdir not a directory.\n" unless -d $outputdir; die "$0: Output directory not writable: $outputdir.\n" unless -w $outputdir; # read TLPDB and extract files my $tlpdb = TeXLive::TLPDB->new ("root" => $installerdir); -die "Cannot find tlpdb in $installerdir!\n" unless defined $tlpdb; +die "$0: Cannot find tlpdb in $installerdir.\n" unless defined $tlpdb; my $tlp = $tlpdb->get_package("00texlive.installer"); -die "No 00texlive.installer in ${installerdir}'s texlive.tlpdb" +die "$0: no 00texlive.installer in ${installerdir}'s texlive.tlpdb" unless defined $tlp; my $tlpinfra = $tlpdb->get_package("texlive.infra"); -die("Cannot find package texlive.infra in ${installerdir}'s texlive.tlpdb\n") unless defined($tlp); - +die "$0: no texlive.infra in ${installerdir}'s texlive.tlpdb" + unless defined $tlpinfra; my @unix = (); push @unix, $tlp->runfiles; @@ -128,10 +127,11 @@ push @unix, $tlp->docfiles; # add the texlive-XX docs in pdf and html format if the option is given. # if ($opt_texlivedocs) { - foreach my $p (qw/texlive-en texlive-de texlive-fr texlive-cz texlive-pl texlive-ru texlive-zh-cn/) { + foreach my $p (qw(texlive-en texlive-de texlive-fr texlive-cz + texlive-pl texlive-ru texlive-zh-cn)) { my $tlpdocs = $tlpdb->get_package($p); if (!defined $tlpdocs) { - warn ("Cannot find package $p in tlpdb!"); + warn "Cannot find package $p in tlpdb"; next; } push (@unix, $tlpdocs->docfiles); @@ -148,7 +148,20 @@ if (defined $tlpbin{"win32"}) { push (@win32, @{$tlpbin{"win32"}}); } + +# main. +copy_files (@unix); +make_zip ('tgz'); + +copy_files (@win32); +make_zip ('zip'); + +install_files (); + +cleanup (); + + # copy files from the repository to tmpdir. # sub copy_files { @@ -164,6 +177,7 @@ sub copy_files { } } + # create the .tar.gz and the .zip files. # sub make_zip @@ -180,6 +194,7 @@ sub make_zip chdir ($installerdir) || die "chdir($installerdir) failed: $!"; } + # copy generated files to outputdir, # sub install_files @@ -190,22 +205,45 @@ sub install_files system ('ls', '-l', "$outputdir/install-tl-unx.tar.gz"); copy ("$tmpdir/install-tl.zip", $outputdir); system ('ls', '-l', "$outputdir/install-tl.zip"); - # leave uncompressed copy as files for sake of people mirroring. - system ("cd $outputdir && unzip -q -o install-tl.zip"); + + # create unpacked installer that can run in that directory, + # for the sake of people mirroring. + # We'd like to specify exactly what we want to unpack, + # but unzip doesn't allow for unpacking a directory, + # and it's too painful to specify all the (many dozens of) files. + # So remove the unnecessary doc files after unpacking everything. + xchdir ($outputdir); + xsystem ("unzip -q -o install-tl.zip"); + xsystem ("mv install-tl junkdir"); + xsystem ("mv junkdir/install-tl* ."); + xsystem ("mv junkdir/tlpkg/* tlpkg/"); + xsystem ("rm -rf junkdir"); } -# main. +# chdir or die. # -copy_files (@unix); -make_zip ('tgz'); +sub xchdir +{ + my ($dir) = @_; + chdir ($dir) || die "chdir($dir) failed: $!"; + #chomp (my $pwd = `pwd`); + #print "\t CHDIR $dir (now $pwd)\n"; +} -copy_files (@win32); -make_zip ('zip'); -install_files (); +# system or die. +# +sub xsystem +{ + my (@args) = @_; + my $retval = system (@args); + if ($retval != 0) { + $retval /= 256; + die "system(@args) failed, status $retval"; + } +} -cleanup (); ### Local Variables: ### perl-indent-level: 2 |