-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add switch to allow SystemVar Path add #24
Conversation
Adds a switch option /SystemVar to add it to the SystemVar Path aswell.
choco/tools/chocolateyinstall.ps1
Outdated
# checks if choco switch var is in parameters | ||
if ($pp['SystemVar'] -eq 'true') { | ||
Write-Host "Running tlmgr SystemVar path add" | ||
# Adds to SystemVar Path | ||
[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";C:\Program Files\Scripts", [EnvironmentVariableTarget]::Machine) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand the code correctly it adds C:\Program Files\Scripts
to the system path. Is there any reason why C:\Program Files\Scripts
needs to be added to the system path(TinyTex is installed to C:\tools\TinyTeX
usually, where C:\tools
can be customised)?
By the way, the installation can be added to the system path using the command tlmgr path --w32mode=admin add
(I think this should be the default).
On the other hand, SystemVar
isn't clear can you rename it to something else like AddToSystemPath
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback, I accidentally copied the wrong code from my local files. Fixed it.
Does this mean that the installation should be touched again to add it to the system path?
A good point, I just renamed it to match your suggestion. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @andrihitz
It is not quite clear to me which issue we are trying to solve here.
tlmgr
should be added to PATH using its own mechanism tlmg path add
which we do
tinytex-releases/choco/tools/chocolateyinstall.ps1
Lines 16 to 18 in adc16f8
# Adds to Path | |
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path add`"" | |
Start-ChocolateyProcessAsAdmin $statementsToRun "cmd.exe" |
Is this not enough ? Is it not working ?
as @naveen521kk said, there is some configuration that can be done to this command. It is shown here
https://www.tug.org/texlive/doc/tlmgr.html#path
In some case, the flag is not even needed
If the user has admin rights, and the option --w32mode is not given, the setting w32_multi_user determines the location (i.e., if it is on then the system path, otherwise the user path is changed).
Does chocolatey is executed in Admin mode when you install ?
Anayway, If those configuration needs to be access we can make that happens.
Here we are adding a second way to add to PATH and I am not quite sure if this is a good solution as I don't fully comprehend the issue.
Can you explain what you are solving here ? Thank you.
changed to tlmgr command to add path var to the systemvars
Hi @cderv Thanks for your Feedback. Well, the issue I have, by default, the path var is just installed at the user's path and not in the system path, even if the command prompt was launched as admin. I misunderstood the note by @naveen521kk for installing the system path with the onboard command in tlmgr. For my understanding, I wasn't able to get any information about the w32_multi_user setting and what I had to change to automatically add the system path, Can you explain where I can find this setting? Thanks for your Support. |
choco/tools/chocolateyinstall.ps1
Outdated
# checks if choco switch AddToSystemPath var is in parameters | ||
if ($pp['AddToSystemPath'] -eq 'true') { | ||
Write-Host "Running tlmgr AddToSystemPath" | ||
# AddToSystemPath | ||
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path --w32mode=admin add`"" | ||
Start-ChocolateyProcessAsAdmin $statementsToRun "cmd.exe" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we were to do that, I think we just need to add the flag in the previous line when the option is passed to chocolatey.
Here we are putting tlmgr twice in the PATH. First user, then system. It does not seem right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combined the two lines, but I am not sure if this is the way to do it.
At least it works with the if operator.
I think it is a conf for tlmgr. Probably something you can set with This is probably what is controlling the default behavior of Do you want to try one of this configuration file to see if that change something ? Other we could add the flag, but in the first call of |
I guess adding a choco param as we did is the best, quickest solution otherwise, we need to modify or import the config, as I understand this right. |
The change looks good to me. Did you manage to build and test it yourself ? does it install as admin with this change ? |
Yes, I packed it on my local machine and installed it with and without the parameter, and it worked as intended. The path var will be removed while uninstalling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo, other than that sgtm
Co-authored-by: Naveen M K <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me too !
@yihui ok to merge ?
Should we trigger a patch release of the chocolatey bundle ? Otherwise it will be available next month.
Yes.
I don't have an opinion. It's up to @andrihitz (whether a release is needed right now). |
I have just merged. @andrihitz can you wait for next month automatic release ? Otherwise, I'll see what I can do for a path release for this version. |
Thanks for merging. We can wait for next month's automatic release. @cderv |
Adds a switch option /SystemVar to add it to the SystemVar Path aswell.