User Tools

Site Tools


userspace:a_master_copy_for_inserting_scripts_-_eine_vorlage_um_einstellen_von_scripten

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
userspace:a_master_copy_for_inserting_scripts_-_eine_vorlage_um_einstellen_von_scripten [2013/08/05 15:43]
MrNiceguy [setup.ins]
userspace:a_master_copy_for_inserting_scripts_-_eine_vorlage_um_einstellen_von_scripten [2014/11/22 16:42]
GEI
Line 1: Line 1:
 \\ \\
-**This is a master copyClick on <edit this page> and copy the contents under "snipp". Then create the page for your own script, paste the content to the editor and modify it as you need it.**+====== getProductMap.opsiinc ======
  
-====== UltraVNC Viewer ====== 
  
 +Tested with opsi 4.0.4\\
 +requiredWinstVersion >= 4.11.2.\\
 +By //[[opsi@gei.de|GEI]] 2014/11/11 17:00//
  
-Tested with opsi 4.0.1\\ +placed in global library, such as %ScriptDrive$/lib ... 
-requiredWinstVersion >= 4.11.3.6\\ +call with 
-By //[[yonis@sport.med.tum.de|MrNiceguy]] 2013/08/05 16:58// +
- +
-Files can be downloaded at http://www.uvnc.com/downloads/ultravnc.html +
- +
-Tree:\\ +
- setup.ins\\ +
- uninstall.ins\\ +
- delsub.ins\\ +
- start.ins\\ +
- killtask.ins by [[tobias.friede@wki.frauenhofer.de|tobias]]\\ +
-  +
- +
-=== setup.ins ===+
 <code winst> <code winst>
-; Copyright (c) uib gmbh (www.uib.de) +include_insert %ScriptDrive%/lib/getproductmap.opsiinc
-; This sourcecode is owned by uib +
-; and published under the Terms of the General Public License. +
-; credits: http://www.opsi.org/credits/ +
-  +
-[Actions] +
-requiredWinstVersion >= "4.10.8.6" +
-  +
-DefVar $MsiId$ +
-DefVar $UninstallProgram$ +
-DefVar $LogDir$ +
-DefVar $ProductId$   +
-DefVar $MinimumSpace$ +
-DefVar $InstallDir$ +
-DefVar $ExitCode$ +
-DefVar $LicenseRequired$ +
-DefVar $LicenseKey$ +
-DefVar $LicensePool$ +
-  +
-Set $LogDir$ = "%SystemDrive%\tmp" +
-  +
-; ---------------------------------------------------------------- +
-; - Please edit the following values                             - +
-; ---------------------------------------------------------------- +
-;$ProductId$ should be the name of the product in opsi +
-; therefore please: only lower letters, no umlauts,  +
-; no white space use '-' as a seperator +
-Set $ProductId$       = "UltraVNC" +
-Set $MinimumSpace$    = "5 MB" +
-; the path were we find the product after the installation +
-Set $InstallDir$      = "%ProgramFiles32Dir%\uvnc bvba\UltraVNC" +
-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 +
- ; Stop process and set installation status to failed +
-else +
- comment "Show product picture" +
- ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ +
-  +
- if FileExists($InstallDir$ + "\winvnc.exe"+
- comment "Start uninstall sub section" +
- Sub "%ScriptPath%\killtask.ins"  +
- Sub "%ScriptPath%\delsub32.ins" +
- endif +
-  +
- Message "Installing " + $ProductId$ + " ..." +
-  +
- if $LicenseRequired$ = "true" +
- comment "Licensing required, reserve license and get license key" +
- Sub_get_licensekey +
- endif +
-  +
- comment "Start setup program" +
- Winbatch_install +
- Sub_check_exitcode +
-  +
- comment "Copy files" +
- Files_install /32Bit +
- +
- comment "Start application" +
- Sub "%ScriptPath%\start.ins"  +
-endif +
-  +
-[Winbatch_install] +
- "%ScriptPath%\Setup.exe" /verysilent /LOADINF="%ScriptPath%\ultravncInstall.inf" /log /norestart +
-  +
-[Files_install] +
- copy -s "%ScriptPath%\ultravnc.ini" $InstallDir$ +
-  +
-[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> </code>
  
-===uninstall.ins===+===  ===
 <code winst> <code winst>
-; Copyright (c) uib gmbh (www.uib.de) +    ; This sourcecode is partly owned by uib.de 
-; This sourcecode is owned by uib gmbh +    ; and published under the Terms of the General Public License. 
-; and published under the Terms of the General Public License. +    ; credits: http://www.opsi.org/en/credits/ 
-; credits: http://www.opsi.org/credits/ +    
-  +    written by GEI (Detlef Krummel  opsi@gei.de) 
-[Actions] +    FILE "%ScriptDrive%\lib\getproductmap.opsiinc"
-requiredWinstVersion >= "4.10.8.6" +
-  +
-DefVar $MsiId$ +
-DefVar $UninstallProgram$ +
-DefVar $LogDir$ +
-DefVar $ExitCode$ +
-DefVar $ProductId$ +
-DefVar $InstallDir$ +
-DefVar $LicenseRequired$ +
-DefVar $LicensePool$ +
-  +
-Set $LogDir$ = "%SystemDrive%\tmp" +
-  +
----------------------------------------------------------------- +
-- Please edit the following values                             - +
----------------------------------------------------------------- +
-Set $ProductId$       = "opsi-template" +
-Set $InstallDir$      = "%ProgramFiles32Dir%\uvnc bvba\UltraVNC" +
-Set $LicenseRequired$ = "false" +
-Set $LicensePool$     = "p_" + $ProductId$ +
-; ---------------------------------------------------------------- +
-  +
-  +
-comment "Show product picture" +
-ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ +
-  +
-Message "Uninstalling " + $ProductId$ + " ..."+
  
-if FileExists("%ScriptPath%\killtask.ins"+    requiredWinstVersion >="4.11.2
- comment "Sart task kill sub section" +    ; for debugging  setLogLevel = 7 
- Sub "%ScriptPath%\killtask.ins+    DefStringList   $ProductMap_List
-endif +    Set             $ProductMap_List$ = getProductMap 
-  +    setLogLevel 6 
-if FileExists("%ScriptPath%\delsub32.ins"+    --------------------------------- sample values --------------------------------------------------- 
- comment "Start uninstall sub section" +    0)id=owncloud                         1)name=ownCloud                 2)description=Win-Cloudclient 
- Sub "%ScriptPath%\delsub32.ins" +    3)advice=(aktualisiert am 4.9.2014  4)productversion=1.6.3.3721     5)packageversion=17 
-endif +    6)priority=0                          7)installationstate=unknown     8)lastactionrequest=setup 
-  +    9)lastactionresult=successful         10)installedversion=1.6.2     11)installedpackage=16 
-if $LicenseRequired$ = "true" +    ;12)installedmodificationtime         13)actionrequest=setup
- 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> +
- +
-===delsub.ins=== +
-<code winst> +
-Copyright (cuib gmbh (www.uib.de) +
-; This sourcecode is owned by uib gmbh +
-; and published under the Terms of the General Public License. +
-; credits: http://www.opsi.org/credits/ +
-  +
-  +
-Set $MsiId$ '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +
-Set $UninstallProgram$ = $InstallDir$ + "\unins000.exe" +
-  +
-Message "Uninstalling " + $ProductId$ + " ..." +
-  +
-if FileExists($UninstallProgram$+
-; comment "Uninstall program found, starting uninstall" +
- Winbatch_uninstall +
-; uninstall_exe +
- sub_check_exitcode +
-endif +
-;if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") +
-; comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" +
-; Winbatch_uninstall_msi +
-; sub_check_exitcode +
-;endif +
- +
-;comment "Uninstall Exe" +
-;Uninstall_exe /32Bit +
- +
-;comment "Uninstall" +
-winbatch_uninstall +
-  +
-comment "Delete files" +
-Files_uninstall /32Bit +
-  +
-comment "Cleanup registry" +
-Registry_uninstall /32Bit +
-  +
-comment "Delete program shortcuts" +
-LinkFolder_uninstall +
-  +
-[Winbatch_uninstall] +
-; Choose one of the following examples as basis for program uninstall +
-+
-; === Nullsoft Scriptable Install System ================================================================ +
-"$UninstallProgram$" /S +
-  ;net stop uvnc_service +
-  ;sc delete uvnc_service +
-  ;Sub "%ScriptPath%\killtask.ins" +
-  "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES +
-+
-=== Inno Setup ======================================================================================== +
-  +
-;[uninstall_exe] +
-; net stop uvnc_service +
-; sc delete uvnc_service +
-; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES +
-  +
-;[Winbatch_uninstall_msi] +
-;msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress +
-  +
-[Files_uninstall] +
-; Example for recursively deleting the installation directory (don't forget the trailing backslash)+
-+
- delete -sf "$InstallDir$\" +
-  +
-[Registry_uninstall] +
-; Example of deleting a registry key: +
-+
-; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +
-  +
-[LinkFolder_uninstall] +
-; Example of deleting a folder from AllUsers startmenu: +
-+
-; set_basefolder common_programs +
-; delete_subfolder $ProductId$ +
-+
-; Example of deleting a shortcut from AllUsers desktop: +
-+
-; set_basefolder common_desktopdirectory +
-; set_subfolder "" +
-; delete_element $ProductId$ +
-  +
-[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+
  
 +    DefVar          $ProductMap_Id$
 +    Set             $ProductMap_Id$                         = getValue("id",                        $ProductMap_List$)
 +    DefVar          $ProductMap_Name$
 +    Set             $ProductMap_Name$                       = getValue("name",                      $ProductMap_List$)
 +    DefVar          $ProductMap_Description$
 +    Set             $ProductMap_Description$                = getValue("description",               $ProductMap_List$)
 +    DefVar          $ProductMap_Advice$
 +    Set             $ProductMap_Advice$                     = getValue("advice",                    $ProductMap_List$)
 +    DefVar          $ProductMap_ProductVersion$
 +    Set             $ProductMap_ProductVersion$             = getValue("productversion",            $ProductMap_List$)
 +    DefVar          $ProductMap_PackageVersion$
 +    Set             $ProductMap_PackageVersion$             = getValue("packageversion",            $ProductMap_List$)
 +    DefVar          $ProductMap_Priority$
 +    Set             $ProductMap_Priority$                   = getValue("priority",                  $ProductMap_List$)
 +    DefVar          $ProductMap_InstallationState$
 +    Set             $ProductMap_InstallationState$          = getValue("installationstate",         $ProductMap_List$)
 +    DefVar          $ProductMap_LastActionRequest$
 +    Set             $ProductMap_LastActionRequest$          = getValue("lastactionrequest",         $ProductMap_List$)
 +    DefVar          $ProductMap_LastActionResult$
 +    Set             $ProductMap_LastActionResult$           = getValue("lastactionresult",          $ProductMap_List$)
 +    DefVar          $ProductMap_InstalledVersion$
 +    Set             $ProductMap_InstalledVersion$           = getValue("installedversion",          $ProductMap_List$)
 +    DefVar          $ProductMap_InstalledPackage$
 +    Set             $ProductMap_InstalledPackage$           = getValue("installedpackage",          $ProductMap_List$)
 +    DefVar          $ProductMap_InstalledModificationTime$
 +    Set             $ProductMap_InstalledModificationTime$  = getValue("installedmodificationtime", $ProductMap_List$)
 +    DefVar          $ProductMap_ActionRequest$
 +    Set             $ProductMap_ActionRequest$              = getValue("actionrequest",             $ProductMap_List$)
 </code> </code>
  
-===killtask.ins=== +==== sample ====
-<code winst> +
-[Actions] +
-setloglevel +
-requiredWinstVersion >"4.11.2.9" +
-  +
-DefVar $process2$ +
-DefVar $subvar$ +
-DefVar $killtask$ +
-  +
-DefStringList $processlist$ +
-DefStringList $process$ +
-DefStringList $SearchProcess$ +
-  +
-;----------Definiere hier welche Programme gesucht und geschlossen werden sollen-------------------------------- +
-set $searchProcess$ = createStringList ('winvnc.exe'+
-;sollen die Programme automatisch geschlossen werden? ACHTUNG: Datenverlust möglich! +
-set $killtask$ = "true" +
-;---------------------------------------------------------------------------------------------------------------- +
-  +
-for %s% in $SearchProcess$ do sub_checkfunktion +
-  +
-[sub_checkfunktion] +
-set $subvar$ = "%s%" +
-set $processlist$ = getOutStreamFromSection('DosInAnIcon_checkprocess'+
-set $process$ = splitString(takeString(1,$processlist$), ","+
-set $process2$ = unquote(takeString(1,$processlist$), '"'+
-  +
-DosBatch_1+
  
-if ($process2$ = $subvar$) +  (include before)
-Message = "Prozess gefunden" +
- if ($killtask$ = "true"+
- killtask $subvar$  +
- else +
- message "killtask is set false" +
- endif +
-else +
-message = "Prozess nicht gefunden" +
-endif +
-  +
-  +
-  +
-[DosInAnIcon_checkprocess] +
-@echo off +
-TASKLIST /FI "IMAGENAME eq $subvar$" /fo CSV +
- +
-[DosBatch_1] +
- net stop uvnc_service +
- sc delete uvnc_service +
-</code> +
-==== Steps ==== +
-  - here you enter special steps, if needed. Explain it well, so an opsi-beginner can do it. +
-  - step two +
-  - step three +
-  - ... +
- +
-[[nix|Change the following headlines to the names of your scripts]] +
- +
- +
-==== uninstall.ins ====+
 <code winst> <code winst>
-click on "edit this pageto see the complete source.+  set $Setupfile$ = "onwcloud-+ $ProductMap_ProductVersion$ + "-setup.exe"
 </code> </code>
- 
-==== delsub.ins ==== 
-<code winst> 
-click on "edit this page" to see the complete source. 
-</code> 
- 
-==== myvbs.vbs ==== 
-<code vb> 
-;this is my vbs-script... 
-echo click on "edit this page" to see the complete source. 
-</code> 
- 
  
userspace/a_master_copy_for_inserting_scripts_-_eine_vorlage_um_einstellen_von_scripten.txt · Last modified: 2021/08/23 08:37 (external edit)