Skip to content

Commit

Permalink
[AU totalcommander:10.0] updated installer
Browse files Browse the repository at this point in the history
  • Loading branch information
majkinetor committed Sep 3, 2021
1 parent 5c0b777 commit 0a7332f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 45 deletions.
4 changes: 1 addition & 3 deletions automatic/totalcommander/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ But Total Commander uses a different approach: it has two fixed windows, which m

The following package parameters can be set:

* `/LocalUser` - Install only for local user. By default it will be installed for all users.
* `/DesktopIcon` - Add an icon for Total Commander to the Desktop. By default no icon is added.
* `/InstallPath` - Use custom install path. By default Total Commander is installed to the `%ProgramFiles%\totalcmd` directory.
* `/DefaultFM` - Use TC as default file manager instead of Explorer. Use `/DefaultFM:explorer` to return to Explorer.
* `/ShellExtension` - Add Total Commander in shell context menu for directories.

These parameters can be passed to the installer with the use of `--params`. For example: `--params '/LocalUser /DesktopIcon'`.
These parameters can be passed to the installer with the use of `--params`. For example: `--params '/DesktopIcon'`.

## Notes

- This package sets system environment variable `COMMANDER_PATH` which points to the Total Commander install directory.
- This package contain combined Total Commander installer which contains both x32 and x64 bit versions.
- Total Commander is a Shareware program. This means that you can test it for a period of 30 days. After testing the program, you must either [order the full version](http://www.ghisler.com/order.htm), or delete the program from your harddisk.

16 changes: 5 additions & 11 deletions automatic/totalcommander/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,20 @@
$toolsPath = Split-Path $MyInvocation.MyCommand.Definition
. $toolsPath\helpers.ps1

$is64 = (Get-OSArchitectureWidth 64) -and $env:chocolateyForceX86 -ne 'true'

$tcExeName = if ($is64) { 'totalcmd64.exe' } else { 'totalcmd.exe' }
$pp = Get-PackageParameters

$tcmdWork = Get-PackageCacheLocation
Extract-TCFiles
Set-TCParameters

$env:chocolateyInstallArguments = Get-TCInstallArgs
$env:chocolateyInstallOverride = 1
$packageArgs = @{
PackageName = 'totalcommander'
FileType = 'exe'
File = "$tcmdWork\INSTALL.exe"
File64 = "$tcmdWork\INSTALL.exe"
SilentArgs = ''
File = Get-Item $toolsPath\tc*.exe
SilentArgs = ""
ValidExitCodes = @(0)
SoftwareName = 'Total Commander*'
}
Install-ChocolateyInstallPackage @packageArgs
Remove-Item $toolsPath\*.exe, $toolsPath\*.zip -ea 0
Remove-Item $toolsPath\*.exe -ea 0

$packageName = $packageArgs.packageName
$installLocation = Get-TCInstallLocation
Expand Down
37 changes: 6 additions & 31 deletions automatic/totalcommander/tools/helpers.ps1
Original file line number Diff line number Diff line change
@@ -1,34 +1,9 @@
function Set-TCParameters() {
$localUser = 'UserName=' + $(if ($pp.LocalUser) { '' } else { '*' })
$desktopIcon = 'mkdesktop=' + $(if ($pp.DesktopIcon) { '1' } else { '0' })
$installPath = 'Dir=' + $(if ($pp.InstallPath) { $pp.InstallPath } else { '%ProgramFiles%\totalcmd' })

$installInf = Join-Path $tcmdWork "INSTALL.INF"
(Get-Content $installInf) -Replace 'UserName=', $localUser `
-Replace 'auto=0', 'auto=1' `
-Replace 'hidden=0', 'hidden=1' `
-Replace 'mkdesktop=1', $desktopIcon `
-Replace 'Dir=c:\\totalcmd', $installPath | Set-Content $installInf
}

function Extract-TCFiles() {
Write-Verbose "Extract EXE to change install options"
$parameters = @{
packageName = "$($env:chocolateyInstall) setup"
fileFullPath = Get-Item $toolsPath\*.exe
destination = $tcmdWork
}
Get-ChocolateyUnzip @parameters

Write-Verbose "Extract installer"
$parameters["packageName"] = "$($env:chocolateyPackageName) installer"
$parameters["fileFullPath"] = Get-Item $toolsPath\*.zip
Get-ChocolateyUnzip @parameters

if ($is64) {
Move-Item $tcmdWork\INSTALL64.exe $tcmdWork\INSTALL.exe -Force
Move-Item $tcmdWork\INSTALL64.inf $tcmdWork\INSTALL.inf -Force
}
function Get-TCInstallArgs() {
$s = '/AHUG'
$s += if ($pp.DesktopIcon) { 'D' } else { '' }
$s += " "
$s += if ($pp.InstallPath) { $pp.InstallPath } else { '%ProgramFiles%\totalcmd' }
$s
}

function Set-TCShellExtension() {
Expand Down

0 comments on commit 0a7332f

Please sign in to comment.