summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl77
1 files changed, 73 insertions, 4 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 250d09bc6b1..72a0ad6acf9 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -103,6 +103,8 @@ if ($action =~ m/^generate$/i) {
merge_into(\%ret, action_install());
} elsif ($action =~ m/^update$/i) {
merge_into(\%ret, action_update());
+} elsif ($action =~ m/^backup$/i) {
+ merge_into(\%ret, action_backup());
} elsif ($action =~ m/^restore$/i) {
merge_into(\%ret, action_restore());
} elsif ($action =~ m/^search$/i) {
@@ -448,7 +450,7 @@ sub action_restore {
closedir (DIR) || warn "closedir($opt_backupdir) failed: $!";
for my $dirent (@dirents) {
next if (-d $dirent);
- next if ($dirent !~ m/^(.*)_r([0-9]+).tar.lzma$/);
+ next if ($dirent !~ m/^(.*)\.r([0-9]+)\.tar\.lzma$/);
$backups{$1}->{$2} = 1;
}
my $ret;
@@ -504,6 +506,41 @@ sub action_restore {
return $ret;
}
+sub action_backup {
+ init_local_db();
+ my $opt_dry = 0;
+ my $opt_all = 0;
+ my $opt_backupdir;
+ Getopt::Long::Configure(qw(no_pass_through));
+ GetOptions("all" => \$opt_all,
+ "backupdir=s" => \$opt_backupdir,
+ ) or pod2usage(2);
+ my %ret;
+ my @todo;
+ die ("tlmgr backup needs an obligatory argument --backupdir")
+ unless (defined($opt_backupdir));
+ if ($opt_all) {
+ @todo = $localtlpdb->list_packages;
+ } else {
+ @todo = @ARGV;
+ }
+ if (!@todo) {
+ printf "tlmgr backup takes either a list of packages or --all\n";
+ }
+ foreach my $pkg (@todo) {
+ $opt_backupdir = abs_path($opt_backupdir);
+ if (! -d $opt_backupdir) {
+ printf STDERR "backupdir argument must be an existing directory!\n";
+ } else {
+ my $tlp = $localtlpdb->get_package($pkg);
+ $tlp->make_container("lzma", $localtlpdb->root,
+ $opt_backupdir, "${pkg}.r" . $tlp->revision);
+ }
+ }
+ return(\%ret);
+}
+
+
sub action_update {
if ($opt_gui) {
action_gui("update");
@@ -513,10 +550,12 @@ sub action_update {
my $opt_nodepends = 0;
my $opt_dry = 0;
my $opt_all = 0;
+ my $opt_list = 0;
my $opt_backupdir;
Getopt::Long::Configure(qw(no_pass_through));
GetOptions("no-depends" => \$opt_nodepends,
"all" => \$opt_all,
+ "list" => \$opt_list,
"backupdir=s" => \$opt_backupdir,
"dry-run" => \$opt_dry) or pod2usage(2);
my %ret;
@@ -524,7 +563,7 @@ sub action_update {
die($loadmediasrcerror . $location) unless defined($tlmediasrc);
my $mediatlpdb = $tlmediasrc->tlpdb;
my @todo;
- if ($opt_all) {
+ if ($opt_all || $opt_list) {
@todo = $localtlpdb->list_packages;
} else {
@todo = @ARGV;
@@ -547,7 +586,9 @@ sub action_update {
}
my $mediarev = $mediatlp->revision;
if ($rev < $mediarev) {
- if ($opt_dry) {
+ if ($opt_list) {
+ print "$pkg: local: $rev, source: $mediarev\n";
+ } elsif ($opt_dry) {
print "Installing $pkg\n";
} else {
# first remove the package, then reinstall it
@@ -560,7 +601,7 @@ sub action_update {
} else {
my $tlp = $localtlpdb->get_package($pkg);
$tlp->make_container("lzma", $localtlpdb->root,
- $opt_backupdir, "${pkg}_r" . $tlp->revision);
+ $opt_backupdir, "${pkg}.r" . $tlp->revision);
}
}
merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1));
@@ -1129,6 +1170,10 @@ at the installation source. Options:
=over 8
+=item B<--list>
+
+List only which packages could be updated.
+
=item B<--all>
Update all package.
@@ -1147,6 +1192,30 @@ turned out as not working. See the action B<restore> for details.
=back
+=item B<backup --backupdir dir [--all] [pkg [pkg]]>
+
+Makes a backup of the given packages (or all packages with B<--all>) to
+the directory specified with B<--backupdir> (must exist and be a writable).
+
+Warning: Making a backup of I<all> packages will need quite some space and
+time.
+
+Options:
+
+=over 8
+
+=item B<--backupdir directory>
+
+This is an obligatory argument and has to specify a directory where
+backups are to be found.
+
+=item B<--all>
+
+Make a backup of all packages in the texlive.tlpdb
+
+=back
+
+
=item B<restore --backupdir dir [pkg [rev]]>
If no B<pkg> and B[rev] is given list all packages the available