diff options
author | Norbert Preining <preining@logic.at> | 2016-03-31 00:37:47 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2016-03-31 00:37:47 +0000 |
commit | b169d22c9fe57a246495c848f6c5ca4deaaeae49 (patch) | |
tree | 2fcf99969eb3c78804f95ccfeab8a89100a7a5f1 | |
parent | a4c76beac4c5fc5bed6be794866b6ec6f83f554a (diff) |
implement tlmgr allowed action configuration - documentation missing
git-svn-id: svn://tug.org/texlive/trunk@40187 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index 3fb7db64ab3..ef3faaade7f 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -590,6 +590,14 @@ for the full story.\n"; # load it BEFORE starting downloads as we set persistent-downloads there! load_config_file(); + # verify that the selected action is allowed + if ($config{'allowed-actions'}) { + if (!TeXLive::TLUtils::member($action, @{$config{'allowed-actions'}})) { + tlwarn("$prg: action not allowed: $action\n"); + exit ($F_ERROR); + } + } + # set global variable if execute actions should be suppressed $::no_execute_actions = 1 if (defined($opts{'no-execute-actions'})); @@ -6007,15 +6015,27 @@ sub load_config_file { # by default we remove packages $config{"auto-remove"} = 1; + # loads system config file, this cannot be changes with tlmgr + chomp (my $TEXMFSYSCONFIG = `kpsewhich -var-value=TEXMFSYSCONFIG`); + my $fnsys = "$TEXMFSYSCONFIG/tlmgr/config"; + my $tlmgr_sys_config_file = TeXLive::TLConfFile->new($fnsys, "#", "="); + load_options_from_config($tlmgr_sys_config_file, 'sys') + if $tlmgr_sys_config_file; + chomp (my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`); my $fn = "$TEXMFCONFIG/tlmgr/config"; $tlmgr_config_file = TeXLive::TLConfFile->new($fn, "#", "="); + load_options_from_config($tlmgr_config_file) if $tlmgr_config_file; # switched names for this one after initial release. if ($tlmgr_config_file->key_present("gui_expertmode")) { $tlmgr_config_file->rename_key("gui_expertmode", "gui-expertmode"); } +} +sub load_options_from_config { + my ($tlmgr_config_file, $sysmode) = @_; + my $fn = $tlmgr_config_file->file; for my $key ($tlmgr_config_file->keys) { my $val = $tlmgr_config_file->value($key); if ($key eq "gui-expertmode") { @@ -6046,6 +6066,14 @@ sub load_config_file { tlwarn("$prg: $fn: Unknown value for auto-remove: $val\n"); } + } elsif ($sysmode) { + # keys here are only allowed in sys mode + if ($key eq "allowed-actions") { + my @acts = split(/,/, $val); + $config{'allowed-actions'} = \@acts; + } else { + tlwarn("$prg: $fn: Unknown tlmgr configuration variable: $key\n"); + } } else { tlwarn("$prg: $fn: Unknown tlmgr configuration variable: $key\n"); } |