Difference between revisions of "Putty"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(64-bit installer)
 
Line 20: Line 20:
 
     <variable name="PKG_VERSION"        value="0.81" />
 
     <variable name="PKG_VERSION"        value="0.81" />
 
     <variable name="PKG_NAME"          value="putty" />
 
     <variable name="PKG_NAME"          value="putty" />
    <variable name="PKG_SOURCE"        value="%SOFTWARE%\%PKG_NAME%\putty-64bit-%PKG_VERSION%-installer.msi" />
 
    <variable name="PKG_DESTINATION"    value="%ProgramFiles%\PuTTY\" />
 
 
     <variable name="PKG_INSTALL_SWITCH" value="ALLUSERS=1"/>
 
     <variable name="PKG_INSTALL_SWITCH" value="ALLUSERS=1"/>
 
     <variable name="PKG_REMOVE_SWITCH"  value="ALLUSERS=1"/>
 
     <variable name="PKG_REMOVE_SWITCH"  value="ALLUSERS=1"/>
Line 27: Line 25:
 
         <check type="uninstall" condition="versiongreaterorequal" path="PuTTY release %PKG_VERSION% (64-bit)" value="%PKG_VERSION%" />
 
         <check type="uninstall" condition="versiongreaterorequal" path="PuTTY release %PKG_VERSION% (64-bit)" value="%PKG_VERSION%" />
  
         <install cmd='MsiExec.exe /norestart /i "%PKG_SOURCE%" %PKG_INSTALL_SWITCH% /qn' />
+
         <install cmd='MsiExec.exe /norestart /i "%SOFTWARE%\%PKG_NAME%\putty-64bit-%PKG_VERSION%-installer.msi" %PKG_INSTALL_SWITCH% /qn' />
  
 
         <upgrade include="install" />
 
         <upgrade include="install" />
  
         <remove cmd='MsiExec.exe /norestart /x "%PKG_SOURCE%" /qn %PKG_REMOVE_SWITCH%' />
+
         <remove cmd='MsiExec.exe /norestart /x "%SOFTWARE%\%PKG_NAME%\putty-64bit-%PKG_VERSION%-installer.msi" /qn %PKG_REMOVE_SWITCH%' />
  
 
   </package>
 
   </package>
  
 
</packages:packages>
 
</packages:packages>
 +
  
 
</source>
 
</source>

Latest revision as of 21:34, 10 June 2024

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.

64-bit installer

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

<packages:packages
    xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >

  <package id="putty"
           name="PuTTY"
           revision="%PKG_VERSION%"
           priority="5"
           reboot="false">

    <variable name="PKG_VERSION"        value="0.81" />
    <variable name="PKG_NAME"           value="putty" />
    <variable name="PKG_INSTALL_SWITCH" value="ALLUSERS=1"/>
    <variable name="PKG_REMOVE_SWITCH"  value="ALLUSERS=1"/>

        <check type="uninstall" condition="versiongreaterorequal" path="PuTTY release %PKG_VERSION% (64-bit)" value="%PKG_VERSION%" />

        <install cmd='MsiExec.exe /norestart /i "%SOFTWARE%\%PKG_NAME%\putty-64bit-%PKG_VERSION%-installer.msi"  %PKG_INSTALL_SWITCH% /qn' />

        <upgrade include="install" />

        <remove cmd='MsiExec.exe /norestart /x "%SOFTWARE%\%PKG_NAME%\putty-64bit-%PKG_VERSION%-installer.msi" /qn %PKG_REMOVE_SWITCH%' />

  </package>

</packages:packages>

Installer (32bit package works on 32bit and 64bit systems)

<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

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>