summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl21
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui.pl4
-rw-r--r--Master/tlpkg/TeXLive/TLConfFile.pm23
3 files changed, 37 insertions, 11 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 953fa2af3b2..95be200f597 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -4633,28 +4633,31 @@ sub finish
# key=value
#
# allowed keys at the moment
-# gui_expertmode = 0|1
+# gui-expertmode = 0|1
#
sub load_config_file
{
#
# first set default values
- # the default for gui_expertmode is 1 since that is what we
+ # the default for gui-expertmode is 1 since that is what we
# have shipped till now
- $config{"gui_expertmode"} = 1;
+ $config{"gui-expertmode"} = 1;
chomp (my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`);
my $fn = "$TEXMFCONFIG/tlmgr/config";
$tlmgr_config_file = TeXLive::TLConfFile->new($fn, "#", "=");
+ if ($tlmgr_config_file->key_present("gui_expertmode")) {
+ $tlmgr_config_file->rename_key("gui_expertmode", "gui-expertmode");
+ }
for my $key ($tlmgr_config_file->keys) {
my $val = $tlmgr_config_file->value($key);
- if ($key eq "gui_expertmode") {
+ if ($key eq "gui-expertmode") {
if ($val eq "0") {
- $config{"gui_expertmode"} = 0;
+ $config{"gui-expertmode"} = 0;
} elsif ($val eq "1") {
- $config{"gui_expertmode"} = 1;
+ $config{"gui-expertmode"} = 1;
} else {
- tlwarn("Unknown value >$val< for gui_expertmode in $fn\n");
+ tlwarn("Unknown value >$val< for gui-expertmode in $fn\n");
}
} elsif ($key eq "persistent-downloads") {
if (($val eq "0") || ($val eq "1")) {
@@ -5904,10 +5907,10 @@ other lines must look like
key = value
-where the allowed keys are C<gui_expertmode> and
+where the allowed keys are C<gui-expertmode> and
C<persistent-downloads>. The values can only be 0 or 1 for those
settings. C<persistent-downloads> corresponds to the respective command
-line options of C<tlmgr>. C<gui_expertmode> switches between the full
+line options of C<tlmgr>. C<gui-expertmode> switches between the full
GUI and a simplified with only the important and mostly used settings.
diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl
index 4a0ea709515..0046c0b6c51 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui.pl
@@ -48,7 +48,7 @@ use TeXLive::TLConfig;
# GUI mode
#
our %config;
-my $mode_expert = $config{"gui_expertmode"};
+my $mode_expert = $config{"gui-expertmode"};
#
# stuff defined in tlmgr.pl that needs to be our-ed
@@ -1263,7 +1263,7 @@ sub do_and_warn_gui_mode_settings {
-default_button => 'Ok',
-buttons => [__("Ok"), __("Cancel")])->Show;
if ($ans eq __("Ok")) {
- $config{"gui_expertmode"} = $mode_expert;
+ $config{"gui-expertmode"} = $mode_expert;
write_config_file();
}
}
diff --git a/Master/tlpkg/TeXLive/TLConfFile.pm b/Master/tlpkg/TeXLive/TLConfFile.pm
index 2049b4c85bc..33ca89e55bf 100644
--- a/Master/tlpkg/TeXLive/TLConfFile.pm
+++ b/Master/tlpkg/TeXLive/TLConfFile.pm
@@ -125,6 +125,24 @@ sub value
return;
}
+sub rename_key
+{
+ my ($self, $oldkey, $newkey) = @_;
+ %config = %{$self{'confdata'}};
+ for my $i (0..$config{'lines'}) {
+ if (($config{$i}{'type'} eq 'data') &&
+ ($config{$i}{'key'} eq $oldkey)) {
+ $config{$i}{'key'} = $newkey;
+ }
+ }
+ if (defined($self{'keyvalue'}{$oldkey})) {
+ $self{'keyvalue'}{$newkey} = $self{'keyvalue'}{$oldkey};
+ delete $self{'keyvalue'}{$oldkey};
+ $self{'keyvalue'}{$newkey}{'status'} = 'changed';
+
+ }
+}
+
sub is_changed
{
my $self = shift;
@@ -479,6 +497,11 @@ if the key is not set.
With two arguments changes (or adds) the key/value pair to the config
file and returns the I<new> value.
+=item B<< $conffile->rename_key($oldkey, $newkey) >>
+
+Renames a key from C<$oldkey> to C<$newkey>. It does not automatically
+save the new config file.
+
=item B<< $conffile->is_changed >>
Returns true (1) if some real change has happened in the configuration file,