diff --git a/sample/All/CLIENT_DATA/delsub32.ins b/sample/All/CLIENT_DATA/delsub32.opsiscript similarity index 82% rename from sample/All/CLIENT_DATA/delsub32.ins rename to sample/All/CLIENT_DATA/delsub32.opsiscript index 4857753..a6778f6 100644 --- a/sample/All/CLIENT_DATA/delsub32.ins +++ b/sample/All/CLIENT_DATA/delsub32.opsiscript @@ -3,7 +3,6 @@ ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/en/credits/ - Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini" @@ -11,11 +10,13 @@ if FileExists($IniFile$) Set $OLD_VERSION$ = GetValueFromInifile($IniFile$,"COMMON","VERSION","") Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile$,"COMMON","CREATOR_TAG","") Set $OLD_RELEASE$ = GetValueFromInifile($IniFile$,"COMMON","RELEASE","") + Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..." +else + Message "Uninstalling " + $ProductId$ + " ..." endif -Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..." if FileExists($IniFile$) - Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe") + Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe") Set $UninstallProgramOld$ = $InstallDir$ + $UninstallProg$ if FileExists($UninstallProgramOld$) comment "Uninstall program found, starting uninstall" @@ -30,12 +31,12 @@ if FileExists($UninstallProgram$) endif if FileExists($IniFile$) - Set $MsiIdOld$ = GetValueFromInifile($IniFile$,"X86","MsiId","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") - if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld$ + "] DisplayName") = "") - comment "Old MSI id " + $MsiIdOld$ + " found in registry, starting msiexec to uninstall old version" - Winbatch_uninstall_msi_old - sub_check_exitcode - endif + Set $MsiIdOld$ = GetValueFromInifile($IniFile$,"X86","MsiId","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld$ + "] DisplayName") = "") + comment "Old MSI id " + $MsiIdOld$ + " found in registry, starting msiexec to uninstall old version" + Winbatch_uninstall_msi_old + sub_check_exitcode + endif 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" @@ -56,31 +57,29 @@ LinkFolder_uninstall ; Choose one of the following examples as basis for program uninstall ; ; === Nullsoft Scriptable Install System ================================================================ -; maby better Call as -; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10 +; maybe better called as +; Winbatch_uninstall_old /WaitforProcessending "Au_.exe" /Timeoutseconds 10 ; "$UninstallProgramOld$" /S ; ; === Inno Setup ======================================================================================== ; "$UninstallProgramOld$" /silent /norestart /SUPPRESSMSGBOXES /nocancel - [Winbatch_uninstall] ; Choose one of the following examples as basis for program uninstall ; ; === Nullsoft Scriptable Install System ================================================================ -; maby better Call as +; maybe better called as ; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10 ; "$UninstallProgram$" /S ; ; === Inno Setup ======================================================================================== ; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES /nocancel - [Winbatch_uninstall_msi_old] -msiexec /x $MsiIdOld$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiIdOld$ /qb-! REBOOT=ReallySuppress [Winbatch_uninstall_msi] -msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress [Files_uninstall] ; Example for recursively deleting the installation directory: diff --git a/sample/All/CLIENT_DATA/delsub3264.ins b/sample/All/CLIENT_DATA/delsub3264.opsiscript similarity index 75% rename from sample/All/CLIENT_DATA/delsub3264.ins rename to sample/All/CLIENT_DATA/delsub3264.opsiscript index a581c36..7c16d3b 100644 --- a/sample/All/CLIENT_DATA/delsub3264.ins +++ b/sample/All/CLIENT_DATA/delsub3264.opsiscript @@ -12,13 +12,15 @@ Set $IniFile64$ = $InstallDir64$ + "\opsi-" + $ProductId$ + ".ini" if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") if FileExists($IniFile32$) - Set $OLD_VERSION$ = GetValueFromInifile($IniFile32$,"COMMON","VERSION","") - Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile32$,"COMMON","CREATOR_TAG","") - Set $OLD_RELEASE$ = GetValueFromInifile($IniFile32$,"COMMON","RELEASE","") - endif - Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 32 Bit..." + Set $OLD_VERSION$ = GetValueFromInifile($IniFile32$,"COMMON","VERSION","") + Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile32$,"COMMON","CREATOR_TAG","") + Set $OLD_RELEASE$ = GetValueFromInifile($IniFile32$,"COMMON","RELEASE","") + Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 32 Bit..." + else + Message "Uninstalling " + $ProductId$ + " 32 Bit..." + endif - if FileExists($IniFile32$) + if FileExists($IniFile32$) Set $UninstallProg32$ = GetValueFromInifile($IniFile$,"X86","UninstallProg32","XXXXXXXX.exe") Set $UninstallProgramOld32$ = $InstallDir32$ + "\" + $UninstallProg32$ if FileExists($UninstallProgramOld32$) @@ -26,22 +28,21 @@ if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specif Winbatch_uninstall_old_32 sub_check_exitcode endif - endif + endif if FileExists($UninstallProgram32$) comment "Uninstall program found, starting uninstall" Winbatch_uninstall_32 sub_check_exitcode endif - if FileExists($IniFile32$) - Set $MsiIdOld32$ = GetValueFromInifile($IniFile32$,"X86","MsiId32","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") - if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld32$ + "] DisplayName") = "") - comment "Old MSI id " + $MsiIdOld32$ + " found in registry, starting msiexec to uninstall old version" - Winbatch_uninstall_msi_old_32 - sub_check_exitcode - endif - endif - + if FileExists($IniFile32$) + Set $MsiIdOld32$ = GetValueFromInifile($IniFile32$,"X86","MsiId32","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld32$ + "] DisplayName") = "") + comment "Old MSI id " + $MsiIdOld32$ + " found in registry, starting msiexec to uninstall old version" + Winbatch_uninstall_msi_old_32 + sub_check_exitcode + endif + endif if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "") comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall" Winbatch_uninstall_msi_32 @@ -56,13 +57,15 @@ endif if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) if FileExists($IniFile64$) - Set $OLD_VERSION$ = GetValueFromInifile($IniFile64$,"COMMON","VERSION","") - Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile64$,"COMMON","CREATOR_TAG","") - Set $OLD_RELEASE$ = GetValueFromInifile($IniFile64$,"COMMON","RELEASE","") - endif - Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 64 Bit..." + Set $OLD_VERSION$ = GetValueFromInifile($IniFile64$,"COMMON","VERSION","") + Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile64$,"COMMON","CREATOR_TAG","") + Set $OLD_RELEASE$ = GetValueFromInifile($IniFile64$,"COMMON","RELEASE","") + Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 64 Bit..." + else + Message "Uninstalling " + $ProductId$ + " 64 Bit..." + endif - if FileExists($IniFile64$) + if FileExists($IniFile64$) Set $UninstallProg64$ = GetValueFromInifile($IniFile$,"X86_64","UninstallProg64","XXXXXXXX.exe") Set $UninstallProgramOld64$ = $InstallDir64$ + "\" + $UninstallProg64$ if FileExists($UninstallProgramOld64$) @@ -70,22 +73,21 @@ if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system spe Winbatch_uninstall_old_64 sub_check_exitcode endif - endif + endif if FileExists($UninstallProgram64$) comment "Uninstall program found, starting uninstall" Winbatch_uninstall_64 sub_check_exitcode endif - if FileExists($IniFile64$) - Set $MsiIdOld64$ = GetValueFromInifile($IniFile64$,"X86_64","MsiId64","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") - if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld64$ + "] DisplayName") = "") - comment "Old MSI id " + $MsiIdOld64$ + " found in registry, starting msiexec to uninstall old version" - Winbatch_uninstall_msi_old_64 - sub_check_exitcode - endif - endif - + if FileExists($IniFile64$) + Set $MsiIdOld64$ = GetValueFromInifile($IniFile64$,"X86_64","MsiId64","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld64$ + "] DisplayName") = "") + comment "Old MSI id " + $MsiIdOld64$ + " found in registry, starting msiexec to uninstall old version" + Winbatch_uninstall_msi_old_64 + sub_check_exitcode + endif + endif if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "") comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall" Winbatch_uninstall_msi_64 @@ -125,10 +127,10 @@ LinkFolder_uninstall [Winbatch_uninstall_msi_old_32] -msiexec /x $MsiIdOld32$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiIdOld32$ /qb-! REBOOT=ReallySuppress [Winbatch_uninstall_msi_32] -msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiId32$ /qb-! REBOOT=ReallySuppress [Files_uninstall_32] ; Example for recursively deleting the installation directory (don't forget the trailing backslash): @@ -158,10 +160,10 @@ msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress ; "$UninstallProgram64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel [Winbatch_uninstall_msi_old_64] -msiexec /x $MsiIdOld64$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiIdOld64$ /qb-! REBOOT=ReallySuppress [Winbatch_uninstall_msi_64] -msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiId64$ /qb-! REBOOT=ReallySuppress [Files_uninstall_64] ; Example for recursively deleting the installation directory: diff --git a/sample/All/CLIENT_DATA/delsub64.ins b/sample/All/CLIENT_DATA/delsub64.opsiscript similarity index 75% rename from sample/All/CLIENT_DATA/delsub64.ins rename to sample/All/CLIENT_DATA/delsub64.opsiscript index 2a521a5..fae9290 100644 --- a/sample/All/CLIENT_DATA/delsub64.ins +++ b/sample/All/CLIENT_DATA/delsub64.opsiscript @@ -8,20 +8,22 @@ Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini" if FileExists($IniFile$) - Set $OLD_VERSION$ = GetValueFromInifile($IniFile$,"COMMON","VERSION","") - Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile$,"COMMON","CREATOR_TAG","") - Set $OLD_RELEASE$ = GetValueFromInifile($IniFile$,"COMMON","RELEASE","") + Set $OLD_VERSION$ = GetValueFromInifile($IniFile$,"COMMON","VERSION","") + Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile$,"COMMON","CREATOR_TAG","") + Set $OLD_RELEASE$ = GetValueFromInifile($IniFile$,"COMMON","RELEASE","") + Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..." +else + Message "Uninstalling " + $ProductId$ + " ..." endif -Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..." if FileExists($IniFile$) - Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe") + Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe") Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallProg$ - if FileExists($UninstallProgramOld$) - comment "Uninstall program found, starting uninstall" - Winbatch_uninstall_old - sub_check_exitcode - endif + if FileExists($UninstallProgramOld$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall_old + sub_check_exitcode + endif endif if FileExists($UninstallProgram$) comment "Uninstall program found, starting uninstall" @@ -30,12 +32,12 @@ if FileExists($UninstallProgram$) endif if FileExists($IniFile$) - Set $MsiIdOld$ = GetValueFromInifile($IniFile$,"X86_64","MsiId","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") - if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld$ + "] DisplayName") = "") - comment "Old MSI id " + $MsiIdOld$ + " found in registry, starting msiexec to uninstall old version" - Winbatch_uninstall_msi_old - sub_check_exitcode - endif + Set $MsiIdOld$ = GetValueFromInifile($IniFile$,"X86_64","MsiId","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld$ + "] DisplayName") = "") + comment "Old MSI id " + $MsiIdOld$ + " found in registry, starting msiexec to uninstall old version" + Winbatch_uninstall_msi_old + sub_check_exitcode + endif endif if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" @@ -74,12 +76,11 @@ LinkFolder_uninstall ; === Inno Setup ======================================================================================== ; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES /nocancel - [Winbatch_uninstall_msi_old] -msiexec /x $MsiIdOld$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiIdOld$ /qb-! REBOOT=ReallySuppress [Winbatch_uninstall_msi] -msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress +msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress [Files_uninstall] ; Example for recursively deleting the installation directory: diff --git a/sample/All/CLIENT_DATA/login.ins b/sample/All/CLIENT_DATA/login.opsiscript similarity index 100% rename from sample/All/CLIENT_DATA/login.ins rename to sample/All/CLIENT_DATA/login.opsiscript diff --git a/sample/All/CLIENT_DATA/setup32.ins b/sample/All/CLIENT_DATA/setup32.opsiscript similarity index 94% rename from sample/All/CLIENT_DATA/setup32.ins rename to sample/All/CLIENT_DATA/setup32.opsiscript index a9afa4c..4ecca93 100644 --- a/sample/All/CLIENT_DATA/setup32.ins +++ b/sample/All/CLIENT_DATA/setup32.opsiscript @@ -4,10 +4,10 @@ ; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.11.2.6" +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off DefVar $MsiIdOld$ -DefVar $UninstallProgram$ DefVar $UninstallProgramOld$ DefVar $IniFile$ DefVar $IniCfgFile$ @@ -23,7 +23,7 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\tmp" +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -38,7 +38,7 @@ Set $LogDir$ = "%SystemDrive%\tmp" ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- -;$ProductId$ should be the name of the product in opsi +; $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 $MinimumSpace$ = "1 MB" @@ -58,9 +58,9 @@ else comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ - if FileExists("%ScriptPath%\delsub32.ins") + if FileExists("%ScriptPath%\delsub32.opsiscript") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub32.ins" + Sub "%ScriptPath%\delsub32.opsiscript" endif Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " ..." @@ -95,12 +95,12 @@ endif ; ; === MSI package ======================================================================================= ; You may use the parameter PIDKEY=$Licensekey$ -; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress ; ; === InstallShield + MSI===================================================================================== ; Attention: The path to the log file should not contain any whitespaces -; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=1 REBOOT=ReallySuppress" -; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" ; ; === InstallShield ===================================================================================== ; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" diff --git a/sample/All/CLIENT_DATA/setup3264.ins b/sample/All/CLIENT_DATA/setup3264.opsiscript similarity index 94% rename from sample/All/CLIENT_DATA/setup3264.ins rename to sample/All/CLIENT_DATA/setup3264.opsiscript index 0b41e43..32e8e87 100644 --- a/sample/All/CLIENT_DATA/setup3264.ins +++ b/sample/All/CLIENT_DATA/setup3264.opsiscript @@ -4,14 +4,13 @@ ; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.11.2.6" +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off DefVar $MsiIdOld32$ -DefVar $UninstallProgram32$ DefVar $UninstallProgramOld32$ DefVar $IniFile32$ DefVar $MsiIdOld64$ -DefVar $UninstallProgram64$ DefVar $UninstallProgramOld64$ DefVar $IniFile64$ DefVar $IniCfgFile$ @@ -33,7 +32,8 @@ DefVar $OLD_RELEASE$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") -Set $LogDir$ = "%SystemDrive%\tmp" + +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -48,7 +48,7 @@ Set $LogDir$ = "%SystemDrive%\tmp" ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- -;$ProductId$ should be the name of the product in opsi +; $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 $MinimumSpace$ = "1 MB" @@ -69,9 +69,9 @@ else comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ - if FileExists("%ScriptPath%\delsub3264.ins") + if FileExists("%ScriptPath%\delsub3264.opsiscript") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub3264.ins" + Sub "%ScriptPath%\delsub3264.opsiscript" endif if $LicenseRequired$ = "true" @@ -120,12 +120,12 @@ endif ; ; === MSI package ======================================================================================= ; You may use the parameter PIDKEY=$Licensekey$ -; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress ; ; === InstallShield + MSI===================================================================================== ; Attention: The path to the log file should not contain any whitespaces -; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=1 REBOOT=ReallySuppress" -; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" ; ; === InstallShield ===================================================================================== ; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" @@ -155,12 +155,12 @@ copy "$IniCfgFile$" "$InstallDir32$" ; ; === MSI package ======================================================================================= ; You may use the parameter PIDKEY=$Licensekey$ -; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress ; ; === InstallShield + MSI===================================================================================== ; Attention: The path to the log file should not contain any whitespaces -; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=1 REBOOT=ReallySuppress" -; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" ; ; === InstallShield ===================================================================================== ; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" diff --git a/sample/All/CLIENT_DATA/setup64.ins b/sample/All/CLIENT_DATA/setup64.opsiscript similarity index 94% rename from sample/All/CLIENT_DATA/setup64.ins rename to sample/All/CLIENT_DATA/setup64.opsiscript index e3172b4..a8cb4cf 100644 --- a/sample/All/CLIENT_DATA/setup64.ins +++ b/sample/All/CLIENT_DATA/setup64.opsiscript @@ -4,10 +4,10 @@ ; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.11.2.6" +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off DefVar $MsiIdOld$ -DefVar $UninstallProgram$ DefVar $UninstallProgramOld$ DefVar $IniFile$ DefVar $IniCfgFile$ @@ -23,7 +23,7 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\tmp" +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -58,12 +58,12 @@ else comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ - if FileExists("%ScriptPath%\delsub64.ins") + if FileExists("%ScriptPath%\delsub64.opsiscript") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub64.ins" + Sub "%ScriptPath%\delsub64.opsiscript" endif - Message "Installing " + $ProductId$ + " ..." + Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " ..." if $LicenseRequired$ = "true" comment "Licensing required, reserve license and get license key" @@ -95,12 +95,12 @@ endif ; ; === MSI package ======================================================================================= ; You may use the parameter PIDKEY=$Licensekey$ -; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress ; ; === InstallShield + MSI===================================================================================== ; Attention: The path to the log file should not contain any whitespaces -; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=1 REBOOT=ReallySuppress" -; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" ; ; === InstallShield ===================================================================================== ; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" diff --git a/sample/All/CLIENT_DATA/uninstall32.ins b/sample/All/CLIENT_DATA/uninstall32.opsiscript similarity index 92% rename from sample/All/CLIENT_DATA/uninstall32.ins rename to sample/All/CLIENT_DATA/uninstall32.opsiscript index c040138..60aebbb 100644 --- a/sample/All/CLIENT_DATA/uninstall32.ins +++ b/sample/All/CLIENT_DATA/uninstall32.opsiscript @@ -4,10 +4,10 @@ ; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.11.2.6" +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off DefVar $MsiIdOld$ -DefVar $UninstallProgram$ DefVar $UninstallProgramOld$ DefVar $IniFile$ DefVar $IniCfgFile$ @@ -21,7 +21,7 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\tmp" +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -48,9 +48,9 @@ ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ Message "Uninstalling " + $ProductId$ + " ..." -if FileExists("%ScriptPath%\delsub32.ins") +if FileExists("%ScriptPath%\delsub32.opsiscript") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub32.ins" + Sub "%ScriptPath%\delsub32.opsiscript" endif if $LicenseRequired$ = "true" diff --git a/sample/All/CLIENT_DATA/uninstall3264.ins b/sample/All/CLIENT_DATA/uninstall3264.opsiscript similarity index 92% rename from sample/All/CLIENT_DATA/uninstall3264.ins rename to sample/All/CLIENT_DATA/uninstall3264.opsiscript index b575698..b6871db 100644 --- a/sample/All/CLIENT_DATA/uninstall3264.ins +++ b/sample/All/CLIENT_DATA/uninstall3264.opsiscript @@ -4,14 +4,13 @@ ; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.11.2.6" +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off DefVar $MsiIdOld32$ -DefVar $UninstallProgram32$ DefVar $UninstallProgramOld32$ DefVar $IniFile32$ DefVar $MsiIdOld64$ -DefVar $UninstallProgram64$ DefVar $UninstallProgramOld64$ DefVar $IniFile64$ DefVar $IniCfgFile$ @@ -31,7 +30,8 @@ DefVar $OLD_RELEASE$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") -Set $LogDir$ = "%SystemDrive%\tmp" + +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -59,9 +59,9 @@ ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ Message "Uninstalling " + $ProductId$ + " ..." -if FileExists("%ScriptPath%\delsub3264.ins") +if FileExists("%ScriptPath%\delsub3264.opsiscript") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub3264.ins" + Sub "%ScriptPath%\delsub3264.opsiscript" endif if $LicenseRequired$ = "true" diff --git a/sample/All/CLIENT_DATA/uninstall64.ins b/sample/All/CLIENT_DATA/uninstall64.opsiscript similarity index 92% rename from sample/All/CLIENT_DATA/uninstall64.ins rename to sample/All/CLIENT_DATA/uninstall64.opsiscript index d81dd62..c140fc2 100644 --- a/sample/All/CLIENT_DATA/uninstall64.ins +++ b/sample/All/CLIENT_DATA/uninstall64.opsiscript @@ -4,10 +4,10 @@ ; credits: http://www.opsi.org/en/credits/ [Actions] -requiredWinstVersion >= "4.11.2.6" +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off DefVar $MsiIdOld$ -DefVar $UninstallProgram$ DefVar $UninstallProgramOld$ DefVar $IniFile$ DefVar $IniCfgFile$ @@ -21,7 +21,7 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\tmp" +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -48,9 +48,9 @@ ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ Message "Uninstalling " + $ProductId$ + " ..." -if FileExists("%ScriptPath%\delsub64.ins") +if FileExists("%ScriptPath%\delsub64.opsiscript") comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub64.ins" + Sub "%ScriptPath%\delsub64.opsiscript" endif if $LicenseRequired$ = "true" diff --git a/sample/All/OPSI/control b/sample/All/OPSI/control index d3f60e3..2b2b7d9 100644 --- a/sample/All/OPSI/control +++ b/sample/All/OPSI/control @@ -1,5 +1,5 @@ [Package] -version: 2 +version: 1 depends: incremental: False @@ -9,17 +9,17 @@ id: opsi-template name: opsi template product description: A template for opsi products advice: -version: 4.0.2 +version: 4.0.6 priority: 0 licenseRequired: False productClasses: -setupScript: setup3264.ins -uninstallScript: uninstall3264.ins +setupScript: setup32.opsiscript +uninstallScript: uninstall32.opsiscript updateScript: alwaysScript: onceScript: customScript: -userLoginScript: +userLoginScript: [ProductProperty] type: unicode @@ -36,4 +36,4 @@ requiredProduct: sereby.aio requiredStatus: installed requirementType: before - +[Changelog] diff --git a/sample/All/builder-product.cfg b/sample/All/builder-product.cfg index 293d1a4..f119795 100644 --- a/sample/All/builder-product.cfg +++ b/sample/All/builder-product.cfg @@ -126,6 +126,7 @@ WINST_VALUE[1]="My content" ######################### # if the packaga just supports X86 OR X86_64 (setupXX.ins delsubXX.ins uninstallXX.ins) then you have to just specify one MsiId +##### Msi ###### OPSI_INI_SECTION[0]="X86" OPSI_INI_OPTION[0]="MsiId" OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" @@ -136,8 +137,23 @@ OPSI_INI_SECTION[0]="X86_64" OPSI_INI_OPTION[0]="MsiId" OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" -# if the package supports X86 AND X86_64 (setup3264.ins delsub3264.ins uninstall3264.ins) then you have to specify 2 MsiId's +##### Installer ############## + +OPSI_INI_SECTION[0]="X86" +OPSI_INI_OPTION[0]="UninstallProg" +OPSI_INI_VALUE[0]="uninstall.exe" + +# OR + +OPSI_INI_SECTION[1]="X86_64" +OPSI_INI_OPTION[1]="UninstallProg" +OPSI_INI_VALUE[1]="uninstall.exe" + + +# if the package supports X86 AND X86_64 (setup3264.ins delsub3264.ins uninstall3264.ins) then you have to specify 2 MsiId's or UninstallProg's + +##### Msi ###### OPSI_INI_SECTION[0]="X86" OPSI_INI_OPTION[0]="MsiId32" OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" @@ -148,3 +164,14 @@ OPSI_INI_SECTION[1]="X86_64" OPSI_INI_OPTION[1]="MsiId64" OPSI_INI_VALUE[1]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" +##### Installer ############## +OPSI_INI_SECTION[0]="X86" +OPSI_INI_OPTION[0]="UninstallProg32" +OPSI_INI_VALUE[0]="uninstall.exe" + +# AND + +OPSI_INI_SECTION[1]="X86_64" +OPSI_INI_OPTION[1]="UninstallProg64" +OPSI_INI_VALUE[1]="uninstall.exe" + diff --git a/sample/builder-product.cfg b/sample/builder-product.cfg deleted file mode 100644 index d816336..0000000 --- a/sample/builder-product.cfg +++ /dev/null @@ -1,36 +0,0 @@ -############################ -# Setup product information -############################ -VENDOR="softmaker.de" -PN="pmviewer" -NAME="PlanMaker Viewer" -DESCRIPTION="PlanMaker Viewer 2010" -VERSION="2010.rev633" -RELEASE="10" -PRIORITY="0" -ADVICE="" - -TYPE="restricted" - -##################### -# File object array -##################### - -DL_FILE[0]="SoftMaker-Logo.png" -DL_SOURCE[0]="http://www.android-user.de/var/ezflow_site/storage/images/artikel/exklusiv-vorschau-auf-softmaker-office-fuer-android/softmaker-logo.png/25888-1-ger-DE/SoftMaker-Logo.png.png" - -DL_FILE[1]="PlanMakerViewer2010.msi" -DL_SOURCE[1]="http://internal.graz.disconnected-by-peer.at/Orig/SoftMaker/Viewer/HB/2010/PlanMakerViewer2010.msi" -DL_ARCH[1]="X86" -DL_WINST_NAME[1]="InstallMsi" - -# File array index for the image showing while installing the program -ICON_DL_INDEX=0 - -OPSI_INI_SECTION[0]="X86" -OPSI_INI_OPTION[0]="MsiId" -OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" - -OPSI_INI_SECTION[1]="Ignore" -OPSI_INI_OPTION[1]="OEMRegisterSkip" -OPSI_INI_VALUE[1]="-1" diff --git a/sample/control b/sample/control deleted file mode 100644 index 2e70418..0000000 --- a/sample/control +++ /dev/null @@ -1,23 +0,0 @@ -[Package] -version: RELEASE -depends: -incremental: False - -[Product] -type: localboot -id: pmviewer -name: PlanMaker Viewer -description: PlanMaker Viewer 2010 -advice: ADVICE -version: VERSION -priority: PRIORITY -licenseRequired: False -productClasses: -setupScript: setup32.ins -uninstallScript: uninstall32.ins -updateScript: -alwaysScript: -onceScript: -customScript: -userLoginScript: - diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/Thumbs.db b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/Thumbs.db new file mode 100644 index 0000000..513ee4e Binary files /dev/null and b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/Thumbs.db differ diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/delsub.opsiscript b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/delsub.opsiscript new file mode 100644 index 0000000..734d400 --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/delsub.opsiscript @@ -0,0 +1,94 @@ +; Copyright (c) uib 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/ + +DefVar $MsiId$ +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists($InstallDir$ + "\uninstall.exe") + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall + sub_check_exitcode +endif +if not (GetRegistryStringValue("[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 "Delete files" +Files_uninstall + +comment "Cleanup registry" +Registry_uninstall + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[Winbatch_uninstall] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; "$InstallDir$\uninstall.exe" /S +; +; === Inno Setup ======================================================================================== +; "$InstallDir$\uninstall.exe" /silent /norestart + + +[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 + diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/opsi-template.png b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/opsi-template.png new file mode 100644 index 0000000..0692522 Binary files /dev/null and b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/opsi-template.png differ diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/setup32.opsiscript b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/setup32.opsiscript new file mode 100644 index 0000000..d32cd5c --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/setup32.opsiscript @@ -0,0 +1,209 @@ +; Copyright (c) uib gmbh (www.uib.de) +; 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.11.4.12 +setLogLevel=7 +ScriptErrorMessages=off +ExitWindows /Reboot +DefVar $LogDir$ +Set $LogDir$ = "%opsiLogDir%" +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $NewExe$ +DefVar $InstallDir$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +Set $InstallDir$ = "%ProgramFilesDir%\" + $ProductId$ +Set $NewExe$ = $InstallDir$ + "\" + $ProductId$ + ".exe" +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$ + ExitWindows /Reboot + isFatalError + ; Stop process and set installation status to failed +else + comment " this is for testing only ...remove on real scripts" + if "true" = GetProductProperty("test-set-fatal","true") + isFatalError + endif + + comment "Show product picture" + ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + + if FileExists("%ScriptPath%\delsub.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub.opsiscript" + endif + + Message "Installing " + $ProductId$ + " ..." + + if not ($LicenseRequired$ = "false") + 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 + + comment "Patch Registry" + Registry_install + + comment "Create shortcuts" + LinkFolder_install +endif + + +[Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; "%ScriptPath%\setup.exe" /sp- /silent /norestart + +[Files_install] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[LinkFolder_install] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of creating an shortcut to the installed exe in AllUsers startmenu: +; +; set_basefolder common_programs +; set_subfolder $ProductId$ +; +; set_link +; name: $ProductId$ +; target: $NewExe$ +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: +; end_link +; +; Example of creating an shortcut to the installed exe on AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; +; set_link +; name: $ProductId$ +; target: $NewExe$ +; parameters: /some_param +; working_dir: $InstallDir$ +; icon_file: $NewExe$ +; icon_index: 2 +; 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 + ExitWindows /Reboot + isFatalError + else + if $ServiceErrorClass$ = "LicenseMissingError" + LogError "Fatal: required license is not supplied" + ExitWindows /Reboot + isFatalError + endif + endif + endif +else + LogError "Fatal: license required, but license management not enabled" + ExitWindows /Reboot + 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$ + ExitWindows /Reboot + isFatalError + endif + endif + endif +endif + diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/uninstall.opsiscript b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/uninstall.opsiscript new file mode 100644 index 0000000..ce41b48 --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/localsetup/uninstall.opsiscript @@ -0,0 +1,66 @@ +; Copyright (c) uib 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/ + + +[Actions] +requiredWinstVersion >= 4.11.4.12 +setLogLevel=7 +ScriptErrorMessages=off +DefVar $TEMP$ +Set $TEMP$ = "%opsiTmpDir%" +DefVar $LogDir$ +Set $LogDir$ = "%opsiLogDir%" +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir$ = "%ProgramFilesDir%\" + $ProductId$ +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub.opsiscript" +endif + +if not ($LicenseRequired$ = "false") + comment "Licensing required, free license used" + Sub_free_license +endif + +[Sub_free_license] +if opsiLicenseManagementEnabled + 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$) +else + LogError "Error: licensing required, but license management not enabled" + isFatalError +endif + + + diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/opsi-template-with-admin.png b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/opsi-template-with-admin.png new file mode 100644 index 0000000..0692522 Binary files /dev/null and b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/opsi-template-with-admin.png differ diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/opsi.bmp b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/opsi.bmp new file mode 100644 index 0000000..dfe6204 Binary files /dev/null and b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/opsi.bmp differ diff --git a/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/setup.opsiscript b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/setup.opsiscript new file mode 100644 index 0000000..5ee8e96 --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/CLIENT_DATA/setup.opsiscript @@ -0,0 +1,354 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib +; and published under the Terms of the General Public License. + +; TEMPLATE for +; Skript fuer Installationen im Kontext eines temporaeren lokalen Administrators +; installations as temporary local admin +; see winst_manual.pdf / winst_handbuch.pdf + +; +; !!! Das lokale Installations-Skript, das durch den temporaeren lokalen Admin ausgefuehrt wird +; !!! (sein Name steht in $LocalSetupScript$), muss mit dem Befehl +; !!! exitWindows /Reboot +; !!! enden +; + +; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +; Vorarbeiten/Voraussetzungen/Doku pruefen wie in Winsthandbuch +; Skript fuer Installationen im Kontext eines lokalen Administrators +; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + +[Actions] +requiredWinstVersion >= 4.12.0.16 +setLogLevel=7 +ScriptErrorMessages=off +DefVar $ProductName$ +DefVar $ProductSizeMB$ +DefVar $LocalSetupScript$ +DefVar $LockKeyboard$ +DefVar $OpsiAdminPass$ +DefVar $RebootFlag$ +DefVar $WinstRegKey$ +DefVar $AutoName$ +DefVar $AutoPass$ +DefVar $AutoDom$ +DefVar $AutoLogon$ +DefVar $AutoBackupKey$ +DefVar $LocalFilesPath$ +DefVar $LocalWinst$ +DefVar $DefaultLoglevel$ +DefVar $PasswdLogLevel$ +DefVar $AdminGroup$ +DefVar $SearchResult$ +DefVar $LocalDomain$ +DefVar $debug$ +DefVar $isFatal$ +DefVar $BackupConsentPromptBehaviorAdmin$ +DefVar $BackupEnableInstallerDetection$ +DefVar $BackupEnableLUA$ +DefVar $BackupEnableVirtualization$ +DefVar $BackupPromptOnSecureDesktop$ +;DefVar $BackupFilterAdministratorToken$ +DefVar $UAC_off$ + +; ---------------------------------------------------------------- +; - Please edit the following values +; ---------------------------------------------------------------- +;Set $ProductName$ = "opsi-template-with-admin" +Set $ProductName$ = "%installingProdName%" +Set $ProductSizeMB$ = "1" +Set $LocalSetupScript$ = "setup32.opsiscript" +set $UAC_off$ = "false" +; ---------------------------------------------------------------- + +comment "get and set initial values..." +set $debug$ = GetProductProperty("debug","false") +set $isFatal$ = "false" +set $DefaultLoglevel$ = "7" +SetLogLevel=$DefaultLoglevel$ +Set $LocalDomain$ = "%PCNAME%" + + +comment "check if we productive or debugging..." +if $debug$ = "true" + comment "we are in debug mode" + Set $LockKeyboard$="false" + Set $PasswdLogLevel$="7" +else + comment "we are in productive mode" + comment "set $LockKeyboard$ to true to prevent user hacks while admin is logged in" + Set $LockKeyboard$="true" + comment " set $PasswdLogLevel$ to 0 for production" + Set $PasswdLogLevel$="0" +endif + +comment "handle Rebootflag" +Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst\"+$ProductName$ +Set $RebootFlag$ = GetRegistryValue($WinstRegKey$, "RebootFlag", "32bit") + +comment "some paths required" +Set $AutoBackupKey$ = $WinstRegKey$+"\AutoLogonBackup" +Set $LocalFilesPath$ = "C:\opsi.org\tmp\opsi_local_inst" +Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\opsi-client-agent\opsi-winst\winst32.exe" +if not( FileExists($LocalWinst$) ) + LogError "No opsi-winst found. Abborting." + isFatalError +endif + +comment "show product picture" +ShowBitmap "%scriptpath%\localsetup\"+$ProductName$+".png" $ProductName$ + +if not (($RebootFlag$ = "1") or ($RebootFlag$ = "2") or ($RebootFlag$ = "3")) + comment "Part before first Reboot" + comment "just reboot - this must be done if this is the first product after OS installation" + comment "handle Rebootflag" + Set $RebootFlag$ = "1" + Registry_SaveRebootFlag /32bit + ;ExitWindows /ImmediateReboot +endif ; Rebootflag = not (1 or 2 or 3) + +if $RebootFlag$ = "1" + comment "Part before second Reboot" + setActionProgress "Preparing" + + if not(HasMinimumSpace ("%SYSTEMDRIVE%", ""+$ProductSizeMB$+" MB")) + LogError "Not enough space on drive C: . "+$ProductSizeMB$+" MB on C: required for "+$ProductName$ + isFatalError + endif + + comment "Lets work..." + Message "Preparing "+$ProductName$+" install step 1..." + sub_Prepare_AutoLogon + + comment "we need to reboot now to be sure that the autologon work" + comment "handle Rebootflag" + Set $RebootFlag$ = "2" + Registry_SaveRebootFlag /32bit + ExitWindows /ImmediateReboot +endif ; Rebootflag = not (1 or 2) + +if ($RebootFlag$ = "2") + comment "Part after first Reboot" + + comment "handle Rebootflag" + Set $RebootFlag$ = "3" + Registry_SaveRebootFlag /32bit + + comment "Lets work..." + Message "Preparing "+$ProductName$+" install step 2..." + Registry_enable_keyboard /sysnative + + comment "now let the autologon work" + comment "it will stop with a reboot" + setActionProgress "Run Installation" + + ExitWindows /ImmediateLogout +endif ; Rebootflag = 2 + +if ($RebootFlag$ = "3") + comment "Part after second Reboot" + ExitWindows /Reboot + setActionProgress "Cleanup" + comment "handle Rebootflag" + Set $RebootFlag$ = "0" + Registry_SaveRebootFlag /32bit + + comment "Lets work..." + Message "Cleanup "+$ProductName$+" install (step 3)..." + sub_Restore_AutoLogon + set $SearchResult$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "opsi_autologon_setup") + if $SearchResult$ = $LocalWinst$+" "+$LocalFilesPath$+"\"+$LocalSetupScript$+" /batch /productid %installingProdName%" + LogError "Localscript did not run. We remove the RunOnce entry and abort" + Registry_del_runonce /sysnative + set $isFatal$ = "true" + endif + if "true" = GetRegistryValue("HKLM\Software\opsi.org\winst" , "with-admin-fatal", "32bit") + LogError "set to fatal because the local script stored this result" + set $isFatal$ = "true" + endif + comment "cleanup the registry key which stores a fatal result of the local script" + Registry_clean_fatal_flag /32bit + if $isFatal$ = "true" + isFatalError + endif + comment "This is the clean end of the installation" +endif ; Rebootflag = 3 + + +[sub_Prepare_AutoLogon] +comment "copy the setup script and files" +Files_copy_Setup_files_local +comment "read actual Autologon values for backup" +set $AutoName$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName") +comment "if AutoLogonName is our setup admin user, something bad happend" +comment "then let us cleanup" +if ($AutoName$="opsiSetupAdmin") + set $AutoName$="" + set $AutoPass$="" + set $AutoDom$="" + set $AutoLogon$="0" +else + set $AutoPass$ = asConfidential(GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword")) + set $AutoDom$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName") + set $AutoLogon$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon") +endif +if $UAC_off$ = "true" + set $BackupConsentPromptBehaviorAdmin$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin") + set $BackupEnableInstallerDetection$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection") + set $BackupEnableLUA$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA") + set $BackupEnableVirtualization$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization") + set $BackupPromptOnSecureDesktop$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop") + ;set $BackupFilterAdministratorToken$ = GetRegistryValue("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken") + Registry_backup_uac /32bit + Registry_UAC_off /sysnative +endif + +comment "backup AutoLogon values" +Registry_save_autologon /32bit + +comment "prepare the admin AutoLogon" +set $OpsiAdminPass$= asConfidential(randomstr) +Registry_autologon /sysnative + +comment "get the name of the admin group" +set $AdminGroup$ = SidToName("S-1-5-32-544") +comment "create our setup admin user" +DosInAnIcon_makeadmin + +comment "store our setup script as run once" +Registry_runOnce /sysnative + +comment "disable keyboard and mouse while the autologin admin works" +if ($LockKeyboard$="true") + Registry_disable_keyboard /Sysnative +endif + +comment "cleanup the registry key which stores a fatal result of the local script" +Registry_clean_fatal_flag /32bit + +[sub_Restore_AutoLogon] +comment "read AutoLogon values from backup" +set $AutoName$ = GetRegistryValue($AutoBackupKey$, "DefaultUserName", "32bit") +set $AutoPass$ = asConfidential(GetRegistryValue($AutoBackupKey$, "DefaultPassword", "32bit")) +set $AutoDom$ = GetRegistryValue($AutoBackupKey$, "DefaultDomainName", "32bit") +set $AutoLogon$ = GetRegistryValue($AutoBackupKey$, "AutoAdminLogon", "32bit") + +comment "restore the values" +Registry_restore_autologon /Sysnative +comment "delete our setup admin user" +DosInAnIcon_deleteadmin +comment "cleanup setup script, files and profiledir" +Files_delete_Setup_files_local +comment "delete profiledir" +DosInAnIcon_deleteprofile + +if $UAC_off$ = "true" + set $BackupConsentPromptBehaviorAdmin$ = GetRegistryValue($AutoBackupKey$, "ConsentPromptBehaviorAdmin", "32bit") + set $BackupEnableInstallerDetection$ = GetRegistryValue($AutoBackupKey$, "EnableInstallerDetection", "32bit") + set $BackupEnableLUA$ = GetRegistryValue($AutoBackupKey$, "EnableLUA", "32bit") + set $BackupEnableVirtualization$ = GetRegistryValue($AutoBackupKey$, "EnableVirtualization", "32bit") + set $BackupPromptOnSecureDesktop$ = GetRegistryValue($AutoBackupKey$, "PromptOnSecureDesktop", "32bit") + ;set $BackupFilterAdministratorToken$ = GetRegistryValue($AutoBackupKey$, "FilterAdministratorToken") + Registry_UAC_restore /sysnative +endif + + +[Registry_save_autologon] +openkey [$AutoBackupKey$] +set "DefaultUserName"="$AutoName$" +set "DefaultPassword"="$AutoPass$" +set "DefaultDomainName"="$AutoDom$" +set "AutoAdminLogon"="$AutoLogon$" + +[Registry_restore_autologon] +openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] +set "DefaultUserName"="$AutoName$" +set "DefaultPassword"="$AutoPass$" +set "DefaultDomainName"="$AutoDom$" +set "AutoAdminLogon"="$AutoLogon$" + +[Registry_backup_uac] +openkey [$AutoBackupKey$] +Set "ConsentPromptBehaviorAdmin" = REG_DWORD:$BackupConsentPromptBehaviorAdmin$ +Set "EnableInstallerDetection" = REG_DWORD:$BackupEnableInstallerDetection$ +Set "EnableLUA" = REG_DWORD:$BackupEnableLUA$ +Set "EnableVirtualization" = REG_DWORD:$BackupEnableVirtualization$ +Set "PromptOnSecureDesktop" = REG_DWORD:$BackupPromptOnSecureDesktop$ +;Set "FilterAdministratorToken" = REG_DWORD:$BackupFilterAdministratorToken$ + + +[DosInAnIcon_deleteadmin] +NET USER opsiSetupAdmin /DELETE + +[Registry_SaveRebootFlag] +openKey [$WinstRegKey$] +set "RebootFlag" = "$RebootFlag$" + +[Files_copy_Setup_files_local] +copy -s "%ScriptPath%\localsetup\*.*" "$LocalFilesPath$" + +[Files_delete_Setup_files_local] +del -sf $LocalFilesPath$\ +; the following command does not wor completely and is therefor commented +; the command is replaced by the section "DosInAnIcon_deleteprofile" (P.Ohler) +;delete -sf "%ProfileDir%\opsiSetupAdmin" + +[DosInAnIcon_deleteprofile] +rmdir /S /Q "%ProfileDir%\opsiSetupAdmin" + +[DosInAnIcon_makeadmin] +NET USER opsiSetupAdmin $OpsiAdminPass$ /ADD +NET LOCALGROUP $AdminGroup$ /ADD opsiSetupAdmin + +[Registry_autologon] +openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] +set "DefaultUserName"="opsiSetupAdmin" +set "DefaultPassword"="$OpsiAdminPass$" +set "DefaultDomainName"="$LocalDomain$" +set "AutoAdminLogon"="1" + +[Registry_runonce] +openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] +set "opsi_autologon_setup"='"$LocalWinst$" "$LocalFilesPath$\$LocalSetupScript$" /batch /productid %installingProdName%' + +[Registry_del_runonce] +openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] +DeleteVar "opsi_autologon_setup" + +[Registry_disable_keyboard] +openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass] +set "Start"=REG_DWORD:0x4 +openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass] +set "Start"=REG_DWORD:0x4 + +[Registry_enable_keyboard] +openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass] +set "Start"=REG_DWORD:0x1 +openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass] +set "Start"=REG_DWORD:0x1 + +[Registry_clean_fatal_flag] +openkey [$WinstRegKey$] +DeleteVar "with-admin-fatal" + +[Registry_UAC_off] +OpenKey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] +Set "ConsentPromptBehaviorAdmin" = REG_DWORD:00000000 +Set "EnableInstallerDetection" = REG_DWORD:00000001 +Set "EnableLUA" = REG_DWORD:00000000 +Set "EnableVirtualization" = REG_DWORD:00000001 +Set "PromptOnSecureDesktop" = REG_DWORD:00000000 +;Set "FilterAdministratorToken" = REG_DWORD:00000000 + + +[Registry_UAC_restore] +OpenKey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] +Set "ConsentPromptBehaviorAdmin" = REG_DWORD:$BackupConsentPromptBehaviorAdmin$ +Set "EnableInstallerDetection" = REG_DWORD:$BackupEnableInstallerDetection$ +Set "EnableLUA" = REG_DWORD:$BackupEnableLUA$ +Set "EnableVirtualization" = REG_DWORD:$BackupEnableVirtualization$ +Set "PromptOnSecureDesktop" = REG_DWORD:$BackupPromptOnSecureDesktop$ +;Set "FilterAdministratorToken" = REG_DWORD:$BackupFilterAdministratorToken$ + diff --git a/sample/source/4.0.6/opsi-template-with-admin/OPSI/changelog.txt b/sample/source/4.0.6/opsi-template-with-admin/OPSI/changelog.txt new file mode 100644 index 0000000..60d4709 --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/OPSI/changelog.txt @@ -0,0 +1,114 @@ +[Changelog] +opsi-template-with-admin (4.1.0.0-2) stable; urgency=low + + * fixed shell shebang in preinst and postisnt + * changelog now in changelog.txt + +-- detlef oertel Tue, 30 Apr 2019 15:00:00 +0000 + +opsi-template-with-admin (4.1.0.0-1) stable; urgency=low + + * allows to temporary disable UAC + * use: asconfidential + * use: GetRegistryValue + * requires opsi-script 4.12.0.16 + +-- detlef oertel Thu, 03 Jan 2019 15:00:00 +0000 + +opsi-template-with-admin (4.0.6-1) stable; urgency=low + + * extended rebootflag ; fixes #1652 + * changed *.ins to *.opsiscript + * ScriptErrorMessages=off + +-- detlef oertel Wed, 02 Sep 2015 15:00:00 +0200 + +opsi-template-with-admin (4.0.5-1) stable; urgency=low + + * + + -- detlef oertel Fri, 24 Oct 2014 15:01:53 +0200 + +opsi-template-with-admin (4.0.3-1) stable; urgency=low + + * removing psgetsid from postinst and preinst + + -- detlef oertel Fri, 12 Apr 2012 15:01:53 +0200 + +opsi-template-with-admin (4.0.2-2) stable; urgency=low + + * requires opsi-winst >= 4.11.3.3 + * uses /productid switch at opsi-winst call + * code cleanup (use of synative instead of 64bit) + * property debug: switches loglevel and lock keyboard + * code cleanup + + -- detlef oertel Thu, 19 Sep 2012 15:01:53 +0200 + +opsi-template-with-admin (4.0.2-1) stable; urgency=low + + * requires opsi-winst >= 4.11.3 + * using SidToName instead of psgetsid.exe + * priority set to -20 + * first reboot is commented (;ExitWindows /ImmediateReboot). Uncomment it if you have problems with the autologon + + -- detlef oertel Wed, 04 Jul 2012 15:01:53 +0200 + +opsi-template-with-admin (1.0-8) stable; urgency=low + + * localdomain = "%PCNAME%" + + -- Jan Schneider Wed, 4 May 2011 14:09:00 +0100 + +opsi-template-with-admin (1.0-7) stable; urgency=low + + * localdomain = "." for nt6 + + -- Jan Schneider Tue, 29 Mar 2011 17:56:00 +0100 + +opsi-template-with-admin (1.0-6) stable; urgency=low + + * postinst fix: /bin/bash + * preinst fix: no more case sensitiv for pcgetsid.exe + + -- detlef oertel Tue, 30 Dec 2010 15:01:53 +0200 + +opsi-template-with-admin (1.0-5) testing; urgency=low + + * added support for opsi 4.0 opsi-client-agent + * scripts renamed to setup.ins, local_setup.ins and uninstall.ins + + -- detlef oertel Tue, 13 Jun 2010 15:01:53 +0200 + +opsi-template-with-admin (1.0-4) testing; urgency=low + + * new (64 bit) functions of winst 4.10.3 used + + -- detlef oertel Fri, 16 Apr 2010 15:01:53 +0200 + +opsi-template-with-admin (1.0-3) testing; urgency=low + + * in [sub_fetch_SearchResult] changed ("$s$") to ('$s$') + + -- detlef oertel Tue, 26 Jan 2010 15:01:53 +0200 + +opsi-template-with-admin (1.0-2) stable; urgency=low + + * added support for 64 Bit + * code cleanup + * added psgetsid for international support + + -- detlef oertel Mon, 14 Dec 2009 15:01:53 +0200 + +opsi-template-with-admin (1.0-1) stable; urgency=low + + * initial package based on http://www.opsi.org/opsi_wiki/TemplateForInstallationsAsTemporaryLocalAdmin + + -- detlef oertel Mon, 13 Nov 2009 15:01:53 +0200 + + + + + + + diff --git a/sample/source/4.0.6/opsi-template-with-admin/OPSI/control b/sample/source/4.0.6/opsi-template-with-admin/OPSI/control new file mode 100644 index 0000000..b54c019 --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/OPSI/control @@ -0,0 +1,34 @@ +[Package] +version: 2 +depends: + +[Product] +type: localboot +id: opsi-template-with-admin +name: opsi template for installs with logged in admin +description: A opsi demo package +advice: +version: 4.1.0.0 +priority: -20 +licenseRequired: False +productClasses: +setupScript: setup.opsiscript +uninstallScript: localsetup\uninstall.opsiscript +updateScript: +alwaysScript: +onceScript: +customScript: +userLoginScript: + +[ProductProperty] +type: bool +name: debug +description: should be false for production: switch off keyboard lock and increase loglevel +default: False + +[ProductProperty] +type: bool +name: test-set-fatal +description: test only: if true script result is set to fatal +default: False + diff --git a/sample/source/4.0.6/opsi-template-with-admin/OPSI/postinst b/sample/source/4.0.6/opsi-template-with-admin/OPSI/postinst new file mode 100644 index 0000000..5c97506 --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/OPSI/postinst @@ -0,0 +1,9 @@ +#!/bin/bash +# +# This script executes after unpacking files from that archive and registering the product at the server. +# +# The following environment variables can be used to obtain information about the current installation: +# PRODUCT_ID: id of the current product +# CLIENT_DATA_DIR: directory which contains the installed client data +# + diff --git a/sample/source/4.0.6/opsi-template-with-admin/OPSI/preinst b/sample/source/4.0.6/opsi-template-with-admin/OPSI/preinst new file mode 100644 index 0000000..b1a0d99 --- /dev/null +++ b/sample/source/4.0.6/opsi-template-with-admin/OPSI/preinst @@ -0,0 +1,10 @@ +#!/bin/bash +# +# preinst script for softprod +# This script executes before that package will be unpacked from its archive file. +# +# The following environment variables can be used to obtain information about the current installation: +# PRODUCT_ID: id of the current product +# CLIENT_DATA_DIR: directory where client data will be installed +# + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/delsub3264.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/delsub3264.opsiscript new file mode 100644 index 0000000..e2eb816 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/delsub3264.opsiscript @@ -0,0 +1,143 @@ +; Copyright (c) uib 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/en/credits/ + + +Set $MsiId32$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe" + +Set $MsiId64$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe" + +if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") + Message "Uninstalling " + $ProductId$ + " 32 Bit..." + + if FileExists($UninstallProgram32$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall_32 + sub_check_exitcode + endif + + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "") + comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall" + Winbatch_uninstall_msi_32 + sub_check_exitcode + endif + + comment "Delete files" + Files_uninstall_32 /32Bit + comment "Cleanup registry" + Registry_uninstall /32Bit +endif + +if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) + Message "Uninstalling " + $ProductId$ + " 64 Bit..." + + if FileExists($UninstallProgram64$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall_64 + sub_check_exitcode + endif + + if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "") + comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall" + Winbatch_uninstall_msi_64 + sub_check_exitcode + endif + + comment "Delete files" + Files_uninstall_64 /64Bit + comment "Cleanup registry" + Registry_uninstall /64Bit +endif + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[Winbatch_uninstall_32] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; maby better Call as +; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10 +; "$UninstallProgram32$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram32$" /silent /norestart /SUPPRESSMSGBOXES /nocancel + + +[Winbatch_uninstall_msi_32] +msiexec /x $MsiId32$ /qb-! REBOOT=ReallySuppress + +[Files_uninstall_32] +; Example for recursively deleting the installation directory (don't forget the trailing backslash): +; +; delete -sf "$InstallDir32$\" + +[Winbatch_uninstall_64] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; maby better Call as +; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10 +; "$UninstallProgram64$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel + + +[Winbatch_uninstall_msi_64] +msiexec /x $MsiId64$ /qb-! REBOOT=ReallySuppress + +[Files_uninstall_64] +; Example for recursively deleting the installation directory: +; +; del -sf "$InstallDir64$\" + +[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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/setup3264.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/setup3264.opsiscript new file mode 100644 index 0000000..87ded1e --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/setup3264.opsiscript @@ -0,0 +1,275 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/en/credits/ + +; add the folowing product property to your control file + +;[ProductProperty] +;type: unicode +;name: install_architecture +;multivalue: False +;editable: False +;description: which architecture (32/64 bit) has to be installed +;values: ["32 only", "64 only", "both", "system specific"] +;default: ["system specific"] + + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId32$ +DefVar $UninstallProgram32$ +DefVar $MsiId64$ +DefVar $UninstallProgram64$ +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $InstallDir32$ +DefVar $InstallDir64$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ +DefVar $INST_SystemType$ +DefVar $INST_architecture$ + +Set $INST_SystemType$ = GetSystemType +set $INST_architecture$ = GetProductProperty("install_architecture","system specific") + + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir32$ = "%ProgramFiles32Dir%\" +Set $InstallDir64$ = "%ProgramFiles64Dir%\" +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("%ScriptPath%\delsub3264.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub3264.opsiscript" + endif + + if $LicenseRequired$ = "true" + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + endif + + comment "installing" + + if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") + Message "Installing " + $ProductId$ + " 32 Bit..." + comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" + Winbatch_install_32 + Sub_check_exitcode + comment "Copy files" + Files_install_32 /32Bit + comment "Patch Registry" + Registry_install /32Bit + comment "Create shortcuts" + LinkFolder_install + endif + + if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) + Message "Installing " + $ProductId$ + " 64 Bit..." + comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" + Winbatch_install_64 + Sub_check_exitcode + comment "Copy files" + Files_install_64 /64Bit + comment "Patch Registry" + Registry_install /64Bit + comment "Create shortcuts" + LinkFolder_install + endif + +endif + +[Winbatch_install_32] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; You may use an answer file by the parameter /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES + +[Files_install_32] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$" + +[Winbatch_install_64] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; You may use an answer file by the parameter /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES + +[Files_install_64] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[LinkFolder_install] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of creating an shortcut to the installed exe in AllUsers startmenu: +; +; set_basefolder common_programs +; set_subfolder $ProductId$ +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: +; end_link +; +; Example of creating an shortcut to the installed exe on AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; end_link + +[Sub_get_licensekey] +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 + +[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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/uninstall3264.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/uninstall3264.opsiscript new file mode 100644 index 0000000..d853741 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/3264/uninstall3264.opsiscript @@ -0,0 +1,70 @@ +; Copyright (c) uib 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/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId32$ +DefVar $UninstallProgram32$ +DefVar $MsiId64$ +DefVar $UninstallProgram64$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir32$ +DefVar $InstallDir64$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ +DefVar $INST_SystemType$ +DefVar $INST_architecture$ + +Set $INST_SystemType$ = GetSystemType +set $INST_architecture$ = GetProductProperty("install_architecture","system specific") + + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir32$ = "%ProgramFiles32Dir%\" +Set $InstallDir64$ = "%ProgramFiles64Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub3264.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub3264.opsiscript" +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$) + + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/delsub32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/delsub32.opsiscript new file mode 100644 index 0000000..89d3044 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/delsub32.opsiscript @@ -0,0 +1,105 @@ +; Copyright (c) uib 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/en/credits/ + + +Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists($UninstallProgram$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall + sub_check_exitcode +endif + +set $msilist$ = addtolist($msilist$, '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}') +set $msilist$ = addtolist($msilist$, '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}') +for %aktmsi% in $msilist$ do sub_uninstallmsi + +comment "Delete files" +Files_uninstall /32Bit + +comment "Cleanup registry" +Registry_uninstall /32Bit + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[sub_uninstallmsi] +Set $MsiId$ = "%aktmsi%" +Set $displayName32$ = GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") +Set $displayName64$ = GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") +if not ($displayName32$ = "") or not ($displayName64$ = "") + comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" + Winbatch_uninstall_msi + ;Winbatch_uninstall + sub_check_exitcode +endif + +[Winbatch_uninstall] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; maybe better called as +; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10 +; "$UninstallProgram$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES /nocancel + +[Winbatch_uninstall_msi] +msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress + +[Files_uninstall] +; Example for recursively deleting the installation directory: +; +; del -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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/setup32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/setup32.opsiscript new file mode 100644 index 0000000..88d5fe8 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/setup32.opsiscript @@ -0,0 +1,217 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $InstallDir$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ +DefVar $displayName32$ +DefVar $displayName64$ + +DefStringlist $msilist$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir$ = "%ProgramFiles32Dir%\" +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 "No Space" + ; Stop process and set installation status to failed +else + comment "Show product picture" + ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + + if FileExists("%ScriptPath%\delsub32.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub32.opsiscript" + endif + + Message "Installing " + $ProductId$ + " ..." + + if $LicenseRequired$ = "true" + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + endif + + comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" + Winbatch_install + Sub_check_exitcode + + comment "Copy files" + Files_install /32Bit + + comment "Patch Registry" + Registry_install /32Bit + + comment "Create shortcuts" + LinkFolder_install + +endif + +[Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; You may use an answer file by the parameter /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES + +[Files_install] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[LinkFolder_install] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of creating an shortcut to the installed exe in AllUsers startmenu: +; +; set_basefolder common_programs +; set_subfolder $ProductId$ +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: +; end_link +; +; Example of creating an shortcut to the installed exe on AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; 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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/uninstall32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/uninstall32.opsiscript new file mode 100644 index 0000000..435b036 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/32advanced/uninstall32.opsiscript @@ -0,0 +1,63 @@ +; Copyright (c) uib 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/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ +DefVar $displayName32$ +DefVar $displayName64$ + +DefStringlist $msilist$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir$ = "%ProgramFiles32Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub32.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub32.opsiscript" +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$) + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/delsub64.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/delsub64.opsiscript new file mode 100644 index 0000000..96fe68c --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/delsub64.opsiscript @@ -0,0 +1,97 @@ +; Copyright (c) uib 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/en/credits/ + + +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists($UninstallProgram$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall + sub_check_exitcode +endif +if not (GetRegistryStringValue64("[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 "Delete files" +Files_uninstall /64Bit + +comment "Cleanup registry" +Registry_uninstall /64Bit + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[Winbatch_uninstall] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; maby better Call as +; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10 +; "$UninstallProgram$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES /nocancel + + +[Winbatch_uninstall_msi] +msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress + +[Files_uninstall] +; Example for recursively deleting the installation directory: +; +; del -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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/setup64.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/setup64.opsiscript new file mode 100644 index 0000000..aed1f20 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/setup64.opsiscript @@ -0,0 +1,213 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $InstallDir$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir$ = "%ProgramFiles64Dir%\" +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("%ScriptPath%\delsub64.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub64.opsiscript" + endif + + Message "Installing " + $ProductId$ + " ..." + + if $LicenseRequired$ = "true" + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + endif + + comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" + Winbatch_install + Sub_check_exitcode + + comment "Copy files" + Files_install /64Bit + + comment "Patch Registry" + Registry_install /64Bit + + comment "Create shortcuts" + LinkFolder_install + +endif + +[Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; You may use an answer file by the parameter /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES + +[Files_install] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[LinkFolder_install] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of creating an shortcut to the installed exe in AllUsers startmenu: +; +; set_basefolder common_programs +; set_subfolder $ProductId$ +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: +; end_link +; +; Example of creating an shortcut to the installed exe on AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; 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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/uninstall64.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/uninstall64.opsiscript new file mode 100644 index 0000000..f5eab36 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/64/uninstall64.opsiscript @@ -0,0 +1,60 @@ +; Copyright (c) uib 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/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir$ = "%ProgramFiles64Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub64.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub64.opsiscript" +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$) + + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/delsub32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/delsub32.opsiscript new file mode 100644 index 0000000..570f87d --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/delsub32.opsiscript @@ -0,0 +1,95 @@ +; Copyright (c) uib 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/en/credits/ + +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists($UninstallProgram$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall + 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 "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 ================================================================ +; maybe better called as +; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10 +; "$UninstallProgram$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES /nocancel + +[Winbatch_uninstall_msi] +msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress + +[Files_uninstall] +; Example for recursively deleting the installation directory: +; +; del -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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/login.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/login.opsiscript new file mode 100644 index 0000000..60419d9 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/login.opsiscript @@ -0,0 +1,24 @@ +; Copyright (c) uib 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/en/credits/ + +[Actions] +Message "Profile Patch for VLC ...." + +comment "Did we run this script before ? - and set version stamp in profile" +if getValue("installationstate", getProductMap) = "installed" + comment "Product is installed" + if not (scriptWasExecutedBefore) + comment "loginscript was not run yet " + Files_profile_copy + Registry_currentuser_set + endif +endif + +[Files_profile_copy] +copy "%Scriptpath%\profiles\*.*" "%CurrentAppdataDir%\ACME" + +[Registry_currentuser_set] +openkey [HKCU\Software\ACME] +set "show_greeting_window" = "no" diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/opsi-template.png b/sample/source/4.0.6/opsi-template/CLIENT_DATA/opsi-template.png new file mode 100644 index 0000000..e4b974e Binary files /dev/null and b/sample/source/4.0.6/opsi-template/CLIENT_DATA/opsi-template.png differ diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/setup32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/setup32.opsiscript new file mode 100644 index 0000000..53474cd --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/setup32.opsiscript @@ -0,0 +1,226 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $InstallDir$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ +DefVar $myProperty$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir$ = "%ProgramFiles32Dir%\" +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 "No Space" + ; Stop process and set installation status to failed +else + comment "Show product picture" + ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + + comment "get property value ....." + set $myProperty$ = getProductProperty("dummy_prop", "yes") + if $myProperty$ = "yes" + comment "myproperty value is yes" + else + if $myProperty$ = "no" + comment "myproperty value is no" + else + comment "myproperty value must be may_be" + endif + endif + + if FileExists("%ScriptPath%\delsub32.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub32.opsiscript" + endif + + Message "Installing " + $ProductId$ + " ..." + + if $LicenseRequired$ = "true" + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + endif + + comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" + Winbatch_install + Sub_check_exitcode + + comment "Copy files" + Files_install /32Bit + + comment "Patch Registry" + Registry_install /32Bit + + comment "Create shortcuts" + LinkFolder_install + +endif + +[Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; You may use an answer file by the parameter /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES + +[Files_install] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[LinkFolder_install] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of creating an shortcut to the installed exe in AllUsers startmenu: +; +; set_basefolder common_programs +; set_subfolder $ProductId$ +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: +; end_link +; +; Example of creating an shortcut to the installed exe on AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; 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 + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/uninstall32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/uninstall32.opsiscript new file mode 100644 index 0000000..dce5d02 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/uninstall32.opsiscript @@ -0,0 +1,59 @@ +; Copyright (c) uib 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/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir$ = "%ProgramFiles32Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub32.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub32.opsiscript" +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$) + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/delsub_short32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/delsub_short32.opsiscript new file mode 100644 index 0000000..b4798c8 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/delsub_short32.opsiscript @@ -0,0 +1,67 @@ +; Copyright (c) uib 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/en/credits/ + +include_append "section_sub_check_exitcode.opsiinc" + +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists($UninstallProgram$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall + 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 "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 +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES /nocancel + + +[Winbatch_uninstall_msi] +msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress + +[Files_uninstall] +; Example for recursively deleting the installation directory: +; +; del -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$ + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/setup_short32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/setup_short32.opsiscript new file mode 100644 index 0000000..27f6983 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/setup_short32.opsiscript @@ -0,0 +1,149 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +include_append "section_sub_check_exitcode.opsiinc" +include_append "section_sub_get_licensekey.opsiinc" + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $InstallDir$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir$ = "%ProgramFiles32Dir%\" +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("%ScriptPath%\delsub_short32.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub_short32.opsiscript" + endif + + Message "Installing " + $ProductId$ + " ..." + + if $LicenseRequired$ = "true" + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + endif + + comment "Start setup program" + ChangeDirectory "%SCRIPTPATH%" + Winbatch_install + Sub_check_exitcode + + comment "Copy files" + Files_install /32Bit + + comment "Patch Registry" + Registry_install /32Bit + + comment "Create shortcuts" + LinkFolder_install + +endif + +[Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb-! ALLUSERS=1 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES + +[Files_install] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[LinkFolder_install] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of creating an shortcut to the installed exe in AllUsers startmenu: +; +; set_basefolder common_programs +; set_subfolder $ProductId$ +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: +; end_link +; +; Example of creating an shortcut to the installed exe on AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; +; set_link +; name: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; end_link + + diff --git a/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/uninstall_short32.opsiscript b/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/uninstall_short32.opsiscript new file mode 100644 index 0000000..84b0519 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/CLIENT_DATA/use_include/uninstall_short32.opsiscript @@ -0,0 +1,59 @@ +; Copyright (c) uib 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/en/credits/ + +[Actions] +requiredWinstVersion >= "4.11.4.6" +ScriptErrorMessages=off + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ + +Set $LogDir$ = "%opsiLogDir%" + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir$ = "%ProgramFiles32Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub_short32.opsiscript") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub_short32.opsiscript" +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$) + diff --git a/sample/source/4.0.6/opsi-template/OPSI/control b/sample/source/4.0.6/opsi-template/OPSI/control new file mode 100644 index 0000000..b793c86 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/OPSI/control @@ -0,0 +1,248 @@ +[Package] +version: 1 +depends: +incremental: False + +[Product] +type: localboot +id: opsi-template +name: opsi template product +description: A template for opsi products +advice: +version: 4.0.6 +priority: 0 +licenseRequired: False +productClasses: +setupScript: setup32.opsiscript +uninstallScript: uninstall32.opsiscript +updateScript: +alwaysScript: +onceScript: +customScript: +userLoginScript: login.opsiscript + +[ProductProperty] +type: unicode +name: dummy_prop +multivalue: False +editable: False +description: This is a dummy property ? +values: ["may_be", "no", "yes"] +default: ["yes"] + +[Changelog] +opsi-template (4.0.6-1) stable; urgency=low + + * setup*.*: fix: msi: /qb-! (instead of /qb!) + * requiredWinstVersion >= "4.11.4.6" + * ScriptErrorMessages=off + + -- detlef oertel Wed, 15 jul 2015 15:00:00 +0200 + +opsi-template (4.0.5-1) stable; urgency=low + + * setup*.*: fix: ALLUSERS=1 + * require opsi-winst 4.11.4 + * Set $LogDir$ = "%opsiLogDir%" + * all renamed from *.ins to *.opsiscript + * moved 64bit, 3264bit, short (with include) and delsub for multi msi to subfolders + * new property dummy_prop + + -- detlef oertel Mon, 03 Nov 2014 16:01:53 +0200 + +opsi-template (4.0.4-1) stable; urgency=low + + * delsub32.ins: use $msilist$ to delete multible possible msiids + + -- detlef oertel Thu, 27 Mar 2014 16:01:53 +0200 + +opsi-template (4.0.3-2) stable; urgency=low + + * added: ScriptErrorMessages=off + * requires: opsi-winst 4.11.3.6 + + -- detlef oertel Tue, 9 Jul 2013 16:01:53 +0200 + +opsi-template (4.0.3-1) stable; urgency=low + + * default is now without property and 32 Bit + + -- detlef oertel Thu, 27 Sep 2012 16:01:53 +0200 + + +opsi-template (4.0.2-2) stable; urgency=low + + * requiredWinstVersion >= "4.11.3.2" + * Set $LogDir$ = "%SystemDrive%\opsi.org\tmp" + * new: *_short32.opsiscript scripts with includes + * winbatch_install: changed inno-setup example: default without answer file + * winbatch_uninstall: changed NSIS example: /WaitForProcessEnding "Au_.exe" + + -- detlef oertel Fri, 03 Aug 2012 16:01:53 +0200 + +opsi-template (4.0.2-1) stable; urgency=low + + * requiredWinstVersion >= "4.11.2.6" + * added ChangeDirectory "%SCRIPTPATH%" + * changed delete to del (in delsub) + * changed at msi to ALLUSERS=1 + + -- detlef oertel Mon, 02 Jun 2012 16:01:53 +0200 + +opsi-template (4.0.1-5) stable; urgency=low + + * added /nocancel at Inno example + * added login.ins for 'user profile management' + * moved changelog to control file + + -- detlef oertel Mon, 02 Jan 2012 16:01:53 +0200 + + +opsi-template (4.0.1-4) stable; urgency=low + + * removed uncommented test for installation success via registry entries + + -- detlef oertel Thu, 30 Nov 2011 16:01:53 +0200 + + +opsi-template (4.0.1-3) stable; urgency=low + + * changed setup.ins to setup3264.ins (and so on ..) + * added /SUPPRESSMSGBOXES at Inno example + + -- detlef oertel Thu, 06 Oct 2011 16:01:53 +0200 + + +opsi-template (4.0.1-2) stable; urgency=low + + * bugfix: removed '\\' by '\' in showBitMap calls + + -- detlef oertel Tue, 02 Aug 2011 16:01:53 +0200 + + +opsi-template (4.0.1-1) stable; urgency=low + + * bugfix: delsub.ins: Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe" + + -- detlef oertel Wed, 18 Jan 2011 16:01:53 +0200 + + +opsi-template (4.0-1) stable; urgency=low + + * requires opsi.winst 4.10.8 + * default: 32Bit Version + * additional: 64Bit Version + * additional: 32/64Bit Version + + -- detlef oertel Wed, 18 Jan 2011 16:01:53 +0200 + + +opsi-template (1.0-20) stable; urgency=low + + * removed EnvVar("temp") + * all variable definitions at top + * new loglevel + * removed $NewExe$ + * more infos for inno setup + * removed number at showBitmap + * Initial section removed + * example for $installDir$ changed + + -- detlef oertel Wed, 14 Apr 2010 16:01:53 +0200 + + +opsi-template (1.0-19) stable; urgency=low + + * adding 'Installshield + MSI' to the Winbatch_install section + * changing to 'if $LicenseRequired$ = "true"' from 'if not ($LicenseRequired$ = "false")' + * changed from .ins to 'setup.ins' + + -- detlef oertel Tue, 26 Jan 2010 16:01:53 +0200 + + +opsi-template (1.0-18) stable; urgency=low + * bug fix in the successful request (comment out) + +opsi-template (1.0-17) stable; urgency=low + + * bug fix in delsub.ins : deleting a shortcut from AllUsers desktop + + -- detlef oertel Mon, 28 Sep 2009 16:01:53 +0200 + +opsi-template (1.0-16) stable; urgency=low + + * Added some examples for other installers + * Some cleanups + * More examples in other sections + + -- Jan Schneider Fri, 18 Sep 2009 13:01:53 +0200 + +opsi-template (1.0-15) stable; urgency=low + + * bugfix for delopsi-template + + -- Rupert Roeder Mon, 06 Jun 2009 11:15:00 +0100 + +opsi-template (1.0-14) stable; urgency=low + + * bugfix for delopsi-template + + -- Rupert Roeder Tue, 26 May 2009 11:15:00 +0100 + +opsi-template (1.0-13) stable; urgency=low + + * some corrections + + -- Rupert Roeder Tue, 26 May 2009 11:15:00 +0100 + +opsi-template (1.0-12) stable; urgency=low + + * code for license management added + + -- Rupert Roeder Tue, 19 May 2009 11:15:00 +0100 + +opsi-template (1.0-11) stable; urgency=low + + * sub_check_exitcode modified + * sub_check_exitcode 1641 added + * sub_check_exitcode integrated in delsub.ins + + -- Detlef Oertel Mon, 18 May 2009 14:15:00 +0100 + +opsi-template (1.0-10) stable; urgency=low + + * modified test on exit code added 3010 success restart required + -- bardo wolf + +opsi-template (1.0-9) stable; urgency=low + + * renamed from softprod to opsi-template + * added test on exit code + + -- Detlef Oertel Fri, 13 Mar 2009 12:35:32 +0100 + +opsi-template (1.0-8) stable; urgency=low + + * comment Anweisungen + * delsub: + Section: Files_uninstall + ;something like (don't forget the trailing backslash) + ;delete -sf "$InstallDir$\" + + -- Detlef Oertel Wed, 5 Nov 2008 17:00:00 +0100 + + + + + + + + + + + + + + + + diff --git a/sample/source/4.0.6/opsi-template/OPSI/postinst b/sample/source/4.0.6/opsi-template/OPSI/postinst new file mode 100644 index 0000000..a8e33fc --- /dev/null +++ b/sample/source/4.0.6/opsi-template/OPSI/postinst @@ -0,0 +1,9 @@ +#! /bin/sh +# +# postinst script for softprod +# This script executes after unpacking files from that archive and registering the product at the server. +# +# The following environment variables can be used to obtain information about the current installation: +# PRODUCT_ID: id of the current product +# CLIENT_DATA_DIR: directory which contains the installed client data +# diff --git a/sample/source/4.0.6/opsi-template/OPSI/preinst b/sample/source/4.0.6/opsi-template/OPSI/preinst new file mode 100644 index 0000000..15a5320 --- /dev/null +++ b/sample/source/4.0.6/opsi-template/OPSI/preinst @@ -0,0 +1,9 @@ +#! /bin/sh +# +# preinst script for softprod +# This script executes before that package will be unpacked from its archive file. +# +# The following environment variables can be used to obtain information about the current installation: +# PRODUCT_ID: id of the current product +# CLIENT_DATA_DIR: directory where client data will be installed +#