summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2014-05-10 05:37:16 +0000
committerNorbert Preining <preining@logic.at>2014-05-10 05:37:16 +0000
commitd50365e4e06ac960d45ee2a0b7faf7c3a56349dc (patch)
tree6f8a640c8b569361b8242daf5c51c22ce873d354 /Master/texmf-dist/scripts
parentbf3e08b1db4ca75dc88b2fc5c8b274404d40c1b7 (diff)
implement tlmgr conf extensions: --delete, --conffile, updmap
This patch implements the following extensions to tlmgr conf action: * --delete removes a key from the config file, note that this is an actual removal, and not commenting! * --conffile <file> allows overriding of which conffig file is used * updmap in addition to texmf and tlmgr, we now support editing updmap.cfg files. The Map and MixedMap directives are *ignored* (treated as comments), only the settings are taken into account. git-svn-id: svn://tug.org/texlive/trunk@33955 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl76
1 files changed, 52 insertions, 24 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 518ec7fe277..d66eccfa3ea 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -147,7 +147,8 @@ sub main {
my %actionoptions = (
"get-mirror" => { },
"option" => { },
- "conf" => { },
+ "conf" => { "conffile" => "=s",
+ "delete" => 1 },
"version" => { },
"repository" => { },
"candidate" => { },
@@ -5312,15 +5313,23 @@ sub action_conf {
texconfig_conf_mimic();
return;
}
- if ($arg eq "tlmgr" || $arg eq "texmf") {
+ if ($arg eq "tlmgr" || $arg eq "texmf" || $arg eq "updmap") {
my ($fn,$cf);
+ if ($opts{'conffile'}) {
+ $fn = $opts{'conffile'} ;
+ }
if ($arg eq "tlmgr") {
chomp (my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`);
- $fn = "$TEXMFCONFIG/tlmgr/config";
+ $fn || ( $fn = "$TEXMFCONFIG/tlmgr/config" ) ;
$cf = TeXLive::TLConfFile->new($fn, "#", "=");
- } else {
- $fn = "$Master/texmf.cnf";
+ } elsif ($arg eq "texmf") {
+ $fn || ( $fn = "$Master/texmf.cnf" ) ;
$cf = TeXLive::TLConfFile->new($fn, "[%#]", "=");
+ } elsif ($arg eq "updmap") {
+ $fn || ( chomp ($fn = `kpsewhich updmap.cfg`) ) ;
+ $cf = TeXLive::TLConfFile->new($fn, '(#|(Mixed)?Map)', ' ');
+ } else {
+ # that cannot happen!
}
my ($key,$val) = @ARGV;
if (!defined($key)) {
@@ -5335,31 +5344,44 @@ sub action_conf {
}
} else {
if (!defined($val)) {
- if (defined($cf->value($key))) {
- info("$arg $key value: " . $cf->value($key) . " ($fn)\n");
+ if (defined($opts{'delete'})) {
+ if (defined($cf->value($key))) {
+ info("removing setting $arg $key value: " . $cf->value($key) . "from $fn\n");
+ $cf->delete_key($key);
+ } else {
+ info("$arg $key not defined, cannot remove ($fn)\n");
+ }
} else {
- info("$key not defined in $arg config file ($fn)\n");
- if ($arg eq "texmf") {
- # not in user-specific file, show anything kpsewhich gives us.
- chomp (my $defval = `kpsewhich -var-value $key`);
- if ($? != 0) {
- info("$arg $key default value is unknown");
- } else {
- info("$arg $key default value: $defval");
+ if (defined($cf->value($key))) {
+ info("$arg $key value: " . $cf->value($key) . " ($fn)\n");
+ } else {
+ info("$key not defined in $arg config file ($fn)\n");
+ if ($arg eq "texmf") {
+ # not in user-specific file, show anything kpsewhich gives us.
+ chomp (my $defval = `kpsewhich -var-value $key`);
+ if ($? != 0) {
+ info("$arg $key default value is unknown");
+ } else {
+ info("$arg $key default value: $defval");
+ }
+ info(" (kpsewhich -var-value)\n");
}
- info(" (kpsewhich -var-value)\n");
}
}
} else {
- info("setting $arg $key to $val (in $fn)\n");
- $cf->value($key, $val);
+ if (defined($opts{'delete'})) {
+ warning("$arg --delete and value for key $key given, don't know what to do!\n");
+ } else {
+ info("setting $arg $key to $val (in $fn)\n");
+ $cf->value($key, $val);
+ }
}
}
if ($cf->is_changed) {
$cf->save;
}
} else {
- warn "$prg: unknown conf arg: $arg (try tlmgr or texmf)\n";
+ warn "$prg: unknown conf arg: $arg (try tlmgr or texmf or updmap)\n";
}
}
@@ -6326,22 +6348,28 @@ checking the TL development repository.
=back
-=head2 conf [texmf|tlmgr [I<key> [I<value>]]]
+=head2 conf [texmf|tlmgr|updmap [--conffile I<file>] [--delete] [I<key> [I<value>]]]
With only C<conf>, show general configuration information for TeX Live,
including active configuration files, path settings, and more. This is
like the C<texconfig conf> call, but works on all supported platforms.
-With either C<conf texmf> or C<conf tlmgr> given in addition, shows all
-key/value pairs (i.e., all settings) as saved in C<ROOT/texmf.cnf> or
-the tlmgr configuration file (see below), respectively.
+With either C<conf texmf>, C<conf tlmgr>, or C<conf updmap> given in
+addition, shows all key/value pairs (i.e., all settings) as saved in
+C<ROOT/texmf.cnf>, the tlmgr configuration file (see below), or the first
+found C<updmap.cfg> file (via kpsewhich), respectively.
If I<key> is given in addition, shows the value of only that given
-I<key> in the respective file.
+I<key> in the respective file. In case the option I<--delete> is given,
+the respective setting (key value pair) will be removed from the
+configuration file (note, it is removed, not commented!).
If I<value> is given in addition, I<key> is set to I<value> in the
respective file. I<No error checking is done!>
+In all cases the used config file can be selected via the option
+C<--conffile I<file>>, in case one wants to edit a different file.
+
Practical application: if the execution of (some or all) system commands
via C<\write18> was left enabled during installation, you can disable
it afterwards: