Skip to content
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

Merged
merged 10 commits into from
Sep 8, 2022
Merged
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ choco install tinytex
```

This will install TinyTeX and make the TeX Live package manager, `tlmgr`
available on PATH.
available on user PATH.

``` powershell
choco install tinytex -params "/AddToSystemPath"
```
This will install TinyTeX and make the TeX Live package manager, `tlmgr`
available on System PATH.

To uninstall TinyTeX, use the command:

Expand Down
14 changes: 11 additions & 3 deletions choco/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@ $packageArgs = @{
checksumType = 'md5'
}

Install-ChocolateyZipPackage @packageArgs
# get Package Parameters
$pp = Get-PackageParameters

Install-ChocolateyZipPackage @packageArgs

Write-Host "Running tlmgr path add"
# Adds to Path
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path add`""
if ($pp['AddToSystemPath'] -eq 'true') {
Write-Host "Running tlmgr AddToSystemPath"
# AddToSystemPath
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path --w32mode=admin add`""
}Else{
# AddToUserPath
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path add`""
}
Start-ChocolateyProcessAsAdmin $statementsToRun "cmd.exe"


Write-Host "Updating tlmgr"
#updates tlmgr
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat update --self`""
Expand Down
8 changes: 6 additions & 2 deletions choco/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
$toolsDir = Get-ToolsLocation

$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path remove`""
Start-ChocolateyProcessAsAdmin $statementsToRun "cmd.exe"
If ([Environment]::GetEnvironmentVariables("User").Path -split ";" | ?{$_ -like "*TinyTeX\*"}){
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path remove`""
} Else{
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\win32\tlmgr.bat path --w32mode=admin remove`""
}

Start-ChocolateyProcessAsAdmin $statementsToRun "cmd.exe"