Skip to content

Commit

Permalink
Update chocolateyinstall.ps1 (#41)
Browse files Browse the repository at this point in the history
Co-authored-by: Christophe Dervieux <[email protected]>
  • Loading branch information
wirzu and cderv authored Nov 20, 2023
1 parent 6009fa2 commit c878928
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions choco/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if ($pp['AddToSystemPath'] -eq 'true') {
Write-Host "Running tlmgr AddToSystemPath"
# AddToSystemPath
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\windows\tlmgr.bat path --w32mode=admin add`""
}Else{
} else {
# AddToUserPath
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\windows\tlmgr.bat path add`""
}
Expand All @@ -32,26 +32,23 @@ Write-Host "Updating tlmgr"
$statementsToRun = "/C `"$toolsDir\TinyTeX\bin\windows\tlmgr.bat update --self`""
Start-ChocolateyProcessAsAdmin $statementsToRun "$env:WINDIR\system32\cmd.exe"


$files = get-childitem $toolsDir -include *.exe -recurse
$files = Get-ChildItem $toolsDir -Include *.exe -Recurse
foreach ($file in $files) {
#We are directly adding it to path so no need to generate shims
New-Item "$file.ignore" -type file -force | Out-Null
New-Item "$file.ignore" -ItemType file -Force | Out-Null
}


Write-Host "Installing Extra Packages"
$tinytex_tmp_file = "$toolsDir\tinytex-pkg-installed.txt"
if (Test-Path "$tinytex_tmp_file") {
$env:PATH = "$toolsDir\TinyTeX\bin\windows;$env:PATH"
$tinytex_pkg_installed = (tlmgr info --list --only-installed --data name)
$tinytex_reinstall = "$env:TMP\installed_old_packages.ps1"
((Get-Content $tinytex_tmp_file) | Where { $tinytex_pkg_installed -NotContains $_}) | % {"Invoke-Expression '$toolsDir\TinyTeX\bin\windows\tlmgr.bat install {0}'" -f $_} > $tinytex_reinstall
((Get-Content $tinytex_tmp_file) | Where-Object { $tinytex_pkg_installed -NotContains $_}) | ForEach-Object {"Invoke-Expression '$toolsDir\TinyTeX\bin\windows\tlmgr.bat install {0}'" -f $_} > $tinytex_reinstall
if ((Get-Content $tinytex_reinstall) -ne $null){
Write-Host "Installing previous user installed packages"
Invoke-Expression "$tinytex_reinstall"
}
Remove-Item -force $tinytex_reinstall
Remove-Item -force $tinytex_tmp_file
Remove-Item -Force $tinytex_reinstall
Remove-Item -Force $tinytex_tmp_file
}

0 comments on commit c878928

Please sign in to comment.