diff options
author | Norbert Preining <preining@logic.at> | 2009-08-06 11:28:40 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-08-06 11:28:40 +0000 |
commit | 523a3a5a8496779171b512dc7787aa75d8864e71 (patch) | |
tree | 7e0f447126cb1a2894649e4781ed9755a5a22c0d /Master/texmf/scripts | |
parent | a17189dff3df69634e4dbc6879013be92fe57d04 (diff) |
tlmgr action_path:
make it aware of --w32mode and try to do the right thing, including warnings
tlmgr action_postaction:
setenv TEXMFSYSVAR to $TEXMFVAR if we are running on w32, and --w32mode user
git-svn-id: svn://tug.org/texlive/trunk@14551 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/scripts')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 91 |
1 files changed, 77 insertions, 14 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index a983bb649d5..407860f3e13 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -939,11 +939,69 @@ sub action_path { return; } init_local_db(); + my $winadminmode = 0; + if (win32()) { + # + # for w32 we do system wide vs user setting detection as follows: + # - if --w32mode is NOT given, + # - if admin + # --> honor opt_w32_multi_user setting in tlpdb + # - if not admin + # - if opt_w32_multi_user == NO + # --> do user path adjustment + # - if opt_w32_multi_user == YES + # --> do nothing, warn that the setting is on, suggest --w32mode user + # - if --w32mode admin + # - if admin + # --> ignore opt_w32_multi_user and do system path adjustment + # - if non-admin + # --> do nothing but warn that user does not have privileges + # - if --w32mode user + # - if admin + # --> ignore opt_w32_multi_user and do user path adjustment + # - if non-admin + # --> ignore opt_w32_multi_user and do user path adjustment + if (!$opts{"w32mode"}) { + $winadminmode = $localtlmedia->tlpdb->option("w32_multi_user"); + if (!TeXLive::TLWinGoo::admin()) { + if ($winadminmode) { + tlwarn("The TLPDB specifies system wide path adjustments\nbut you don't have admin privileges.\nFor user path adjustment please use\n\t--w32mode user\n"); + # and do nothing + return; + } + } + } else { + # we are in the block where a --w32mode argument is given + # we reverse the tests: + if (TeXLive::TLWinGoo::admin()) { + # in admin mode we simply use what is given on the cmd line + if ($opts{"w32mode"} eq "user") { + $winadminmode = 0; + } elsif ($opts{"w32mode"} eq "admin") { + $winadminmode = 1; + } else { + tlwarn("Unknown --w32admin mode: $opts{w32mode}, should be 'admin' or 'user'\n"); + return; + } + } else { + # we are non-admin + if ($opts{"w32mode"} eq "user") { + $winadminmode = 0; + } elsif ($opts{"w32mode"} eq "admin") { + tlwarn("You don't have the privileges to work in --w32mode admin\n"); + return; + } else { + tlwarn("Unknown --w32admin mode: $opts{w32mode}, should be 'admin' or 'user'\n"); + return; + } + } + } + } if ($what =~ m/^add$/i) { if (win32()) { TeXLive::TLUtils::w32_add_to_path( $localtlmedia->location . "/bin/win32", - $localtlmedia->tlpdb->option("w32_multi_user")); + $winadminmode); TeXLive::TLWinGoo::broadcast_env(); } else { TeXLive::TLUtils::add_symlinks($localtlmedia->tlpdb->root, @@ -956,7 +1014,7 @@ sub action_path { if (win32()) { TeXLive::TLUtils::w32_remove_from_path( $localtlmedia->location . "/bin/win32", - $localtlmedia->tlpdb->option("w32_multi_user")); + $winadminmode); TeXLive::TLWinGoo::broadcast_env(); } else { # remove symlinks @@ -3050,20 +3108,25 @@ sub action_postaction { tlwarn("action postaction needs as second argument one from 'shortcut', 'fileassoc', 'script'\n"); return; } - if ($opts{"w32mode"}) { - if ($opts{"w32mode"} eq "user") { - if (win32() && TeXLive::TLWinGoo::admin()) { - debug("Switching to user mode on user request\n"); - TeXLive::TLWinGoo::non_admin(); - } - } elsif ($opts{"w32mode"} eq "admin") { - if (win32() && !TeXLive::TLWinGoo::admin()) { - tlwarn("You don't have the permissions for --w32mode=admin\n"); + if (win32()) { + if ($opts{"w32mode"}) { + if ($opts{"w32mode"} eq "user") { + if (TeXLive::TLWinGoo::admin()) { + debug("Switching to user mode on user request\n"); + TeXLive::TLWinGoo::non_admin(); + } + # in user mode we also switch TEXMFSYSVAR to TEXMFVAR since + # xetex.pl, but maybe others are writing to TEXMFSYSVAR + chomp($ENV{"TEXMFSYSVAR"} = `kpsewhich -var-value TEXMFVAR`); + } elsif ($opts{"w32mode"} eq "admin") { + if (!TeXLive::TLWinGoo::admin()) { + tlwarn("You don't have the permissions for --w32mode=admin\n"); + return; + } + } else { + tlwarn("action postaction --w32mode can only be 'admin' or 'user'\n"); return; } - } else { - tlwarn("action postaction --w32mode can only be 'admin' or 'user'\n"); - return; } } my @todo; |