Putty

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

This is a silent installer and uninstaller for Putty.
Putty is an SSH (and other secure protocol) client which allows you to open a terminal to your Unix server from Windows.

Installer (32bit package works on 32bit and 64bit systems)[edit]

<package
	id="putty"
	name="PuTTY"
	revision="%version%"
	priority="0"
	reboot="false">

	<variable name="version" value="0.63" />

	<!-- Adds x86 for 64 bit systems -->
	<variable name="PKG_DESTINATION"      value="%PROGRAMFILES%\PuTTY" />
	<variable name="PKG_DESTINATION"      value="%PROGRAMFILES(x86)%\PuTTY" architecture="x64"/>

	<!-- Checks uninstall exists (version is in title) -->
	<check type="uninstall" condition="exists" path="PuTTY version %version%" />

	<!-- Silent install -->
	<install cmd='%SOFTWARE%\putty\putty-%version%-installer.exe /sp- /verysilent' />

	<!-- Same as install so used include -->
	<upgrade include="install" />

	<!-- Overwrites putty with small file -->
	<!-- Prevents 'putty -cleanup-during-uninstall' calling dialogue box -->
	<remove cmd='copy "%SYSTEMROOT%\system32\print.exe" "%PKG_DESTINATION%\putty.exe"' />
	<remove cmd='"%PKG_DESTINATION%\unins000.exe" /sp- /verysilent /norestart'>
		<exit code="1" />
	</remove>
	<!-- Removes putty folder in case it holds on some how -->
	<remove cmd='rmdir /s /q "%PKG_DESTINATION%"'>
		<exit code='any' />
	</remove>
	
</package>

PuTTY 0.58+ uninstallers call 'putty -cleanup-during-uninstall' during uninstall. This causes a pop-up to appear which breaks the silent uninstall. As shown above, a fix for this is to copy simple program that always returns over putty.exe. The entire program folder is also removed so that any leftover unins000.exe files from failed uninstalls are removed.

Standalone[edit]

Here's a package.xml for distributing the putty.exe without the installer. It installs to the System32 folder in %SYSTEMROOT% (often c:\windows\system32) for quick Start/Run access.

<?xml version="1.0" encoding="UTF-8"?>

<packages>
  <package
    id="putty"
    name="Putty"
    revision="0"
    reboot="false"
    priority="0">

    <check type="file" condition="exists" path="%SYSTEMROOT%\system32\putty.exe"/>

    <install cmd='cmd.exe /C copy /y %SOFTWARE%\putty\putty.exe %SYSTEMROOT%\system32\'/>

    <remove cmd='cmd.exe /C del %SYSTEMROOT%\system32\putty.exe'/>

    <upgrade cmd='cmd.exe /C copy /y %SOFTWARE%\putty\putty.exe %SYSTEMROOT%\system32\'/>

  </package>
</packages>