summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-nsis
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/bin/tl-update-nsis')
-rwxr-xr-xMaster/tlpkg/bin/tl-update-nsis56
1 files changed, 34 insertions, 22 deletions
diff --git a/Master/tlpkg/bin/tl-update-nsis b/Master/tlpkg/bin/tl-update-nsis
index 5f05ad7de97..7b41c32d9be 100755
--- a/Master/tlpkg/bin/tl-update-nsis
+++ b/Master/tlpkg/bin/tl-update-nsis
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
# $Id$
-# Copyright 2008, 2009, 2010 Norbert Preining
+# Copyright 2008-2019 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
@@ -34,44 +34,52 @@ pod2usage(-exitstatus => 0, -verbose => 2) if $opt_help;
exit (&main ());
-sub main
-{
- # get the db.
- chomp (my $Master = `cd $mydir/../.. && pwd`);
- my $tlpdb = TeXLive::TLPDB->new ("root" => $Master);
+sub main {
+ chomp(my $Master = `cd $mydir/../.. && pwd`);
+ my $tlpdb = TeXLive::TLPDB->new("root" => $Master);
die("Cannot find tlpdb in $Master\n") unless defined($tlpdb);
+
my $texliveinfra = $tlpdb->get_package("texlive.infra");
my $texliveinfraw32 = $tlpdb->get_package("texlive.infra.win32");
+ #
my @allfiles = ();
- push @allfiles, $texliveinfra->all_files;
- push @allfiles, $texliveinfraw32->all_files if defined $texliveinfraw32;
+ push(@allfiles, $texliveinfra->all_files);
+ push(@allfiles, $texliveinfraw32->all_files) if defined $texliveinfraw32;
- # create the tlpobj files
+ # create the tlpobj files, but if we have to create the tlpobj/ dir,
+ # don't leave it around after.
my $tlpobjdir = "$InfraLocation/tlpobj";
- my $removetlpobjdir = 0;
- if (! -d "$Master/$tlpobjdir") {
- &TeXLive::TLUtils::mkdirhier("$Master/$tlpobjdir");
- $removetlpobjdir = 1;
+ my $abs_tlpobjdir = "$Master/$tlpobjdir";
+ my $rm_abs_tlpobjdir = 0;
+ if (! -d $abs_tlpobjdir) {
+ &TeXLive::TLUtils::mkdirhier($abs_tlpobjdir);
+ $rm_abs_tlpobjdir = 1;
}
- my $rev = 0; # we want the highest rev all these packages.
+ my $rev = 0; # get the highest rev of all our packages
for my $p ($texliveinfra, $texliveinfraw32) {
if (defined $p) {
if ($p->revision > $rev) {
$rev = $p->revision;
}
- open(TMP,">$Master/$tlpobjdir/$p->{'name'}.tlpobj") or die "Cannot create $Master/$tlpobjdir/$p->{'name'}.tlpobj";
+ open(TMP,">$abs_tlpobjdir/$p->{'name'}.tlpobj")
+ || die "open($abs_tlpobjdir/$p->{'name'}.tlpobj) failed: $!";
$p->writeout(\*TMP);
close(TMP);
- push @allfiles, "$tlpobjdir/$p->{'name'}.tlpobj";
+ push(@allfiles, "$tlpobjdir/$p->{'name'}.tlpobj");
}
}
+ # remove the tlpobj/ dir if we created it.
+ if ($rm_abs_tlpobjdir) {
+ TeXLive::TLUtils::rmtree($abs_tlpobjdir);
+ }
+
my %dirtofiles;
for my $f (@allfiles) {
if ($f !~ m!/!) {
$f = "./$f";
}
- my ($dn, $fn) = TeXLive::TLUtils::dirname_and_basename($f);
+ my ($dn,$fn) = TeXLive::TLUtils::dirname_and_basename($f);
if (!defined($dirtofiles{$dn})) {
@{$dirtofiles{$dn}} = ();
}
@@ -163,11 +171,15 @@ function in L<TeXLive::TLUtils> for details.
=head1 DESCRIPTION
-Creates a C<.nsi> file that can be used with NSIS to create an update
-executable for Windows, to work around Windows' inability to overwrite
-open files, and for disaster recovery. It contains the tlmgr-related
-infrastructure files. L<http://tug.org/texlive/tlmgr.html> explains
-more.
+Writes, to standard output, a C<.nsi> file that can be used with NSIS to
+create an update executable for Windows, to work around Windows'
+inability to overwrite open files, and for disaster recovery. It
+contains the tlmgr-related infrastructure files.
+L<http://tug.org/texlive/tlmgr.html> explains more.
+
+This is invoked by the C<tl-update-tlcritical> script, along with the
+sibling C<tl-makeself-from-tlnet> which creates a similar disaster
+recovery executable for Unix.
=head1 AUTHORS AND COPYRIGHT