User Tools

Site Tools


userspace:putty062

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
userspace:putty062 [2013/02/14 12:04]
bobzbobz created
userspace:putty062 [2021/08/23 08:37] (current)
Line 1: Line 1:
 ====== PuTTY 0.62 ====== ====== PuTTY 0.62 ======
 //Scripts and Guide by Soren Birk// //Scripts and Guide by Soren Birk//
 +
 +This guide is for PuTTY 0.62.
 +
 +PuTTY normally saves its sessions to the Registry, but there are too many registry keys to create them directly in the script.
 +
 +I have therefore downloaded PuTTY Portable from http://www.portableapps.com so i can create some pre-configured sessions.
 +
 +You need to add some product properties to the control-file, before you can select the configs in opsi-configed.
  
 **Tested with:** **Tested with:**
Line 6: Line 14:
   * Winst 4.11.3.3   * Winst 4.11.3.3
   * Windows 7, 32 and 64Bit   * Windows 7, 32 and 64Bit
 +
 +**Instructions:**
 +  * First download putty.exe from this [[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html|homepage]], and then copy it to a folder called "PuTTY_noconf" under CLIENT_DATA.
 +  * Sessions are stored in the Registry, but has a ton of keys, so instead we use PuTTY-portable for the configured versions ([[http://portableapps.com/apps/internet/putty_portable|download here]]).
 +  * Extract to a folder on the desktop - then browse to the subfolder \App\AppInfo\Launcher and delete the "splash.jpg".
 +  * Copy, Paste the folder for as many configs as you want (PuTTY_conf1, _conf2 and so on). Open the PuTTY for the respective folder, and create your saved sessions.
 +  * Afterwards copy all the PuTTY_confx folders to CLIENT_DATA.
  
 **Tree:** **Tree:**
Line 14: Line 29:
   ├ delsub32.ins   ├ delsub32.ins
   ├ puttylogo.png   ├ puttylogo.png
-  ├ PuTTYnoconf+  ├ PuTTY_noconf
   │ └ putty.exe   │ └ putty.exe
-  ├ PuTTYconf1+  ├ PuTTY_conf1
   │ ├ App   │ ├ App
   │ ├ Data   │ ├ Data
   │ ├ Other   │ ├ Other
   │ └ PuTTYPortable.exe   │ └ PuTTYPortable.exe
-  └ PuTTYconf2 +  └ PuTTY_conf2 
-    └ <same structure as conf1>+    └ <same folder-structure as PuTTY_conf1> 
 +</code> 
 + 
 +//You should rename the "conf1, conf2" to something that makes sense to you. For example "Net1 Servers", "Net2 Servers" and so on.// 
 + 
 +==== Control file ==== 
 +<code> 
 +[Package] 
 +version: 1 
 +depends:  
 +incremental: False 
 + 
 +[Product] 
 +type: localboot 
 +id: putty 
 +name: PuTTY 
 +description: Terminal emulator 
 +advice:  
 +version: 0.62 
 +priority: 0 
 +licenseRequired: False 
 +productClasses:  
 +setupScript: setup32.ins 
 +uninstallScript: uninstall32.ins 
 +updateScript:  
 +alwaysScript:  
 +onceScript:  
 +customScript:  
 +userLoginScript:  
 + 
 +[ProductProperty] 
 +type: unicode 
 +name: configuration 
 +multivalue: False 
 +editable: True 
 +description: Choose your configuration 
 +values: ["none", "conf1", "conf2"
 +default: ["none"
 +</code> 
 +==== Setup32.ins ==== 
 +<code winst> 
 +; Author Soren Birk 
 + 
 +[Actions] 
 +requiredWinstVersion >= "4.11.2.6" 
 + 
 +DefVar $LogDir$ 
 +DefVar $ProductId$   
 +DefVar $MinimumSpace$ 
 +DefVar $InstallDir$ 
 +DefVar $ExitCode$ 
 +DefVar $LicenseRequired$ 
 +DefVar $LicenseKey$ 
 +DefVar $LicensePool$ 
 +DefVar $Konfiguration$ 
 + 
 +Set $LogDir$ = "%SystemDrive%\tmp" 
 +Set $Konfiguration$ = GetProductProperty("configuration", "none"
 + 
 +; ---------------------------------------------------------------- 
 +; - Please edit the following values                             - 
 +; ---------------------------------------------------------------- 
 +Set $ProductId$       = "putty" 
 +Set $MinimumSpace$    = "5 MB" 
 +Set $InstallDir$      = "%ProgramFiles32Dir%\PuTTY" 
 +Set $LicenseRequired$ = "false" 
 +Set $LicensePool$     = "p_" + $ProductId$ 
 +; ---------------------------------------------------------------- 
 + 
 +if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) 
 + LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ 
 + isFatalError "Not enough space" 
 +else 
 + comment "Display product logo" 
 + ShowBitmap "%ScriptPath%\puttylogo.png" $ProductId$ 
 +  
 + if FileExists("%ScriptPath%\delsub32.ins"
 + comment "Start uninstall sub section" 
 + Sub "%ScriptPath%\delsub32.ins" 
 + endif 
 +  
 + Message "Installing " + $ProductId$ + " ..." 
 +  
 + if $LicenseRequired$ = "true" 
 + comment "Licensing required, reserve license and get license key" 
 + Sub_get_licensekey 
 + endif 
 +  
 + if ($Konfiguration$ = "conf1"
 + comment "Copying Files" 
 + Files_install_unv 
 +  
 + comment "Creating Shortcuts" 
 + LinkFolder_install_konf 
 + endif 
 +  
 + if ($Konfiguration$ = "conf2"
 + comment "Copying Files" 
 + Files_install_adm 
 +  
 + comment "Creating Shortcuts" 
 + LinkFolder_install_konf 
 + endif 
 +  
 + if ($Konfiguration$ = "none"
 + comment "Copying Files" 
 + Files_install /32Bit 
 +  
 + comment "Creating Shortcuts" 
 + LinkFolder_install 
 + endif  
 +endif 
 + 
 +[Files_install] 
 +copy -s "%ScriptPath%\PuTTYnone\*.*" "$InstallDir$" 
 + 
 + 
 +[Files_install_unv] 
 +copy -s "%ScriptPath%\PUTTYconf1\*.*" "$InstallDir$" 
 + 
 + 
 +[Files_install_adm] 
 +copy -s "%ScriptPath%\PUTTYconf2\*.*" "$InstallDir$" 
 + 
 + 
 +[LinkFolder_install] 
 +set_basefolder common_programs 
 +set_subfolder "PuTTY" 
 + 
 +set_link 
 + name: "PuTTY" 
 + target: "$InstallDir$\putty.exe" 
 + parameters: 
 + working_dir: $InstallDir$ 
 + icon_file: "$InstallDir$\putty.exe" 
 + icon_index: 
 +end_link 
 + 
 +set_basefolder common_desktopdirectory 
 +set_subfolder "" 
 + 
 +set_link 
 + name: "PuTTY" 
 + target: "$InstallDir$\putty.exe" 
 + parameters: 
 + working_dir: $InstallDir$ 
 + icon_file: "$InstallDir$\putty.exe" 
 + icon_index: 
 +end_link 
 + 
 + 
 +[LinkFolder_install_konf] 
 +set_basefolder common_programs 
 +set_subfolder "PuTTY" 
 + 
 +set_link 
 + name: "PuTTY" 
 + target: "$InstallDir$\PuTTYPortable.exe" 
 + parameters: 
 + working_dir: $InstallDir$ 
 + icon_file: "$InstallDir$\App\putty\putty.exe" 
 + icon_index: 
 +end_link 
 + 
 +set_basefolder common_desktopdirectory 
 +set_subfolder "" 
 + 
 +set_link 
 + name: "PuTTY" 
 + target: "$InstallDir$\PuTTYPortable.exe" 
 + parameters: 
 + working_dir: $InstallDir$ 
 + icon_file: "$InstallDir$\App\putty\putty.exe" 
 + icon_index: 
 +end_link 
 + 
 + 
 +[Sub_get_licensekey] 
 +if opsiLicenseManagementEnabled 
 + comment "License management is enabled and will be used" 
 +  
 + comment "Trying to get a license key" 
 + Set $LicenseKey$ = demandLicenseKey ($LicensePool$) 
 + ; If there is an assignment of exactly one licensepool to the product the following call is possible: 
 + ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$) 
 +
 + ; If there is an assignment of a license pool to a windows software id, it is possible to use: 
 + ; DefVar $WindowsSoftwareId$ 
 + ; $WindowsSoftwareId$ = "..." 
 + ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$) 
 +  
 + DefVar $ServiceErrorClass$ 
 + set $ServiceErrorClass$ = getLastServiceErrorClass 
 + comment "Error class: " + $ServiceErrorClass$ 
 +  
 + if $ServiceErrorClass$ = "None" 
 + comment "Everything fine, we got the license key '" + $LicenseKey$ + "'" 
 + else 
 + if $ServiceErrorClass$ = "LicenseConfigurationError" 
 + LogError "Fatal: license configuration must be corrected" 
 + LogError getLastServiceErrorMessage 
 + isFatalError 
 + else  
 + if $ServiceErrorClass$ = "LicenseMissingError" 
 + LogError "Fatal: required license is not supplied" 
 + isFatalError 
 + endif 
 + endif 
 + endif 
 +else 
 + LogError "Fatal: license required, but license management not enabled" 
 + isFatalError 
 +endif 
 + 
 + 
 +[Sub_check_exitcode] 
 +comment "Test for installation success via exit code" 
 +set $ExitCode$ = getLastExitCode 
 +; informations to exit codes see 
 +; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx 
 +; http://msdn.microsoft.com/en-us/library/aa368542.aspx 
 +if ($ExitCode$ = "0"
 + comment "Looks good: setup program gives exitcode zero" 
 +else 
 + comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ 
 + if ($ExitCode$ = "1605"
 + comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed." 
 + comment "Uninstall of a not installed product failed - no problem" 
 + else 
 + if ($ExitCode$ = "1641"
 + comment "looks good: setup program gives exitcode 1641" 
 + comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." 
 + else 
 + if ($ExitCode$ = "3010"
 + comment "looks good: setup program gives exitcode 3010" 
 + comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." 
 + else 
 + logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ 
 + isFatalError 
 + endif 
 + endif 
 + endif 
 +endif 
 +</code> 
 +==== Uninstall32.ins ==== 
 +<code winst> 
 +; Author Soren Birk 
 + 
 +[Actions] 
 +requiredWinstVersion >= "4.11.2.6" 
 + 
 +DefVar $LogDir$ 
 +DefVar $ExitCode$ 
 +DefVar $ProductId$ 
 +DefVar $InstallDir$ 
 +DefVar $LicenseRequired$ 
 +DefVar $LicensePool$ 
 + 
 +Set $LogDir$ = "%SystemDrive%\tmp" 
 + 
 +; ---------------------------------------------------------------- 
 +; - Please edit the following values                             - 
 +; ---------------------------------------------------------------- 
 +Set $ProductId$       = "putty" 
 +Set $InstallDir$      = "%ProgramFiles32Dir%\PuTTY" 
 +Set $LicenseRequired$ = "false" 
 +Set $LicensePool$     = "p_" + $ProductId$ 
 +; ---------------------------------------------------------------- 
 + 
 + 
 +comment "Display product logo" 
 +ShowBitmap "%ScriptPath%\puttylogo.png" $ProductId$ 
 + 
 +Message "Uninstalling " + $ProductId$ + " ..." 
 + 
 +if FileExists("%ScriptPath%\delsub32.ins"
 + comment "Start uninstall sub section" 
 + Sub "%ScriptPath%\delsub32.ins" 
 +endif 
 + 
 +if $LicenseRequired$ = "true" 
 + comment "Licensing required, free license used" 
 + Sub_free_license 
 +endif 
 +  
 +[Sub_free_license] 
 +comment "License management is enabled and will be used" 
 +  
 +comment "Trying to free license used for the product" 
 +DefVar $result$ 
 +Set $result$ = FreeLicense($LicensePool$) 
 +; If there is an assignment of a license pool to the product, it is possible to use 
 +; Set $result$ = FreeLicense("", $ProductId$) 
 +
 +; If there is an assignment of a license pool to a windows software id, it is possible to use 
 +; DefVar $WindowsSoftwareId$ 
 +; $WindowsSoftwareId$ = "..." 
 +; set $result$ = FreeLicense("", "", $WindowsSoftwareId$) 
 +</code> 
 +==== delsub32.ins ==== 
 +<code winst> 
 +; Author Soren Birk 
 + 
 +Message "Uninstalling " + $ProductId$ + " ..." 
 + 
 +if FileExists("%ProgramFiles32Dir%\PuTTY"
 + comment "Uninstall program found, starting uninstall" 
 +  
 + comment "Deleting shortcuts" 
 + LinkFolder_uninstall 
 +  
 + comment "Deleting files" 
 + Files_uninstall /32Bit 
 +  
 + comment "Cleaning the Registry" 
 + Registry_uninstall 
 +endif 
 + 
 + 
 +[LinkFolder_uninstall] 
 +set_basefolder common_programs 
 +delete_subfolder "PuTTY" 
 + 
 +set_basefolder common_desktopdirectory 
 +set_subfolder "" 
 +delete_element "PuTTY" 
 + 
 + 
 +[Files_uninstall] 
 +del -sf "$InstallDir$\" 
 + 
 + 
 +[Registry_uninstall] 
 +deletekey [HKCU\Software\SimonTatham] 
 + 
 + 
 +[Sub_check_exitcode] 
 +comment "Test for installation success via exit code" 
 +set $ExitCode$ = getLastExitCode 
 +; informations to exit codes see 
 +; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx 
 +; http://msdn.microsoft.com/en-us/library/aa368542.aspx 
 +if ($ExitCode$ = "0"
 + comment "Looks good: setup program gives exitcode zero" 
 +else 
 + comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ 
 + if ($ExitCode$ = "1605"
 + comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed." 
 + comment "Uninstall of a not installed product failed - no problem" 
 + else 
 + if ($ExitCode$ = "1641"
 + comment "looks good: setup program gives exitcode 1641" 
 + comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." 
 + else 
 + if ($ExitCode$ = "3010"
 + comment "looks good: setup program gives exitcode 3010" 
 + comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." 
 + else 
 + logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ 
 + isFatalError 
 + endif 
 + endif 
 + endif 
 +endif
 </code> </code>
userspace/putty062.1360843473.txt.gz · Last modified: 2021/08/23 08:37 (external edit)