Add new 32bit templates

This commit is contained in:
Mario Fetka 2019-10-30 14:43:12 +01:00
parent 766a1e5c3f
commit 1e74dc498d
144 changed files with 12142 additions and 304 deletions

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,53 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Setup was successfully run to completion."
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Setup failed to initialize."
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel in the wizard before the actual installation started, or chose "No" on the opening "This will install..." message box."
isFatalError
endif
if ($ExitCode$ = "3")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred while preparing to move to the next installation phase (for example, from displaying the pre-installation wizard pages to the actual installation process). This should never happen except under the most unusual of circumstances, such as running out of memory or Windows resources."
isFatalError
endif
if ($ExitCode$ = "4")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred during the actual installation process."
isFatalError
endif
if ($ExitCode$ = "5")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel during the actual installation process, or chose Abort at an Abort-Retry-Ignore box."
isFatalError
endif
if ($ExitCode$ = "6")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The Setup process was forcefully terminated by the debugger (Run | Terminate was used in the IDE)."
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,92 @@
;Request Exitcode of last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Success"
setLogLevel = 4
endif
if ($ExitCode$ = "-1")
logError "ExitCode = "+$ExitCode$+" General error"
isFatalError
endif
if ($ExitCode$ = "-2")
logError "ExitCode = "+$ExitCode$+" Invalid mode"
isFatalError
endif
if ($ExitCode$ = "-3")
logError "ExitCode = "+$ExitCode$+" Required data not found in the Setup.iss file"
isFatalError
endif
if ($ExitCode$ = "-4")
logError "ExitCode = "+$ExitCode$+" Not enough memory available"
isFatalError
endif
if ($ExitCode$ = "-5")
logError "ExitCode = "+$ExitCode$+" File does not exist"
isFatalError
endif
if ($ExitCode$ = "-6")
logError "ExitCode = "+$ExitCode$+" Cannot write to the response file"
isFatalError
endif
if ($ExitCode$ = "-7")
logError "ExitCode = "+$ExitCode$+" Unable to write to the log file"
isFatalError
endif
if ($ExitCode$ = "-8")
logError "ExitCode = "+$ExitCode$+" Invalid path to the InstallShield Silent response file"
isFatalError
endif
if ($ExitCode$ = "-9")
logError "ExitCode = "+$ExitCode$+" Not a valid list type (string or number)"
isFatalError
endif
if ($ExitCode$ = "-10")
logError "ExitCode = "+$ExitCode$+" Data type is invalid"
isFatalError
endif
if ($ExitCode$ = "-11")
logError "ExitCode = "+$ExitCode$+" Unknown error during setup"
isFatalError
endif
if ($ExitCode$ = "-12")
logError "ExitCode = "+$ExitCode$+" Dialogs are out of order"
isFatalError
endif
if ($ExitCode$ = "-51")
logError "ExitCode = "+$ExitCode$+" Cannot create the specified folder"
isFatalError
endif
if ($ExitCode$ = "-52")
logError "ExitCode = "+$ExitCode$+" Cannot access the specified file or folder"
isFatalError
endif
if ($ExitCode$ = "-53")
logError "ExitCode = "+$ExitCode$+" Invalid option selected"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,29 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Normal execution (no error)"
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by user (cancel button)"
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by script"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -3,32 +3,46 @@
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
include_append "%ScriptPath%\browserkill.opsiinc"
Set $UninstallProgram$ = $InstallDir$ + "\" + $UninstallProg$
Set $UninstallProgram$ = $InstallDir$ + "\" + $UninstallExecutable$
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","")
endif
Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..."
else
Message "Uninstalling " + $ProductId$ + " ..."
endif
if FileExists($IniFile$)
Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe")
Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallProg$
Set $UninstallExecutable$ = GetValueFromInifile($IniFile$,"X86","UninstallExecutable","XXXXXXXX.exe")
Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallExecutable$
if FileExists($UninstallProgramOld$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall /32Bit
@ -38,34 +52,53 @@ Registry_uninstall /32Bit
comment "Delete program shortcuts"
LinkFolder_uninstall
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[Winbatch_uninstall_old]
; 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
[Files_uninstall]
; Example for recursively deleting the installation directory:
;
del -sf "$InstallDir$\"
; del -sf "$InstallDir$\"
[Registry_uninstall]
; Example of deleting a registry key:
@ -73,6 +106,10 @@ del -sf "$InstallDir$\"
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -84,6 +121,20 @@ del -sf "$InstallDir$\"
; set_subfolder ""
; delete_element $ProductId$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -1,5 +1,7 @@
[X86]
[X86_64]
[COMMON]
PN=name
VERSION=version

View File

@ -4,7 +4,10 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
include_append "%ScriptPath%\browserkill.opsiinc"
DefVar $UninstallProgram$
DefVar $UninstallProgramOld$
@ -22,7 +25,20 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $CheckOsVersion$
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -34,6 +50,15 @@ Set $LogDir$ = "%SystemDrive%\tmp"
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
@ -49,6 +74,12 @@ Set $LicensePool$ = "p_" + $ProductId$
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "No Space"
@ -57,9 +88,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$ + " ..."
@ -72,17 +103,47 @@ else
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
Sub_check_exitcode
comment "Copy files"
Files_install /32Bit
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
endif
endif
[Winbatch_install]
@ -94,12 +155,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"
@ -129,6 +190,10 @@ copy "$IniCfgFile$" "$InstallDir$"
; set "name3" = REG_BINARY:00 af 99 cd
[LinkFolder_install]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -141,7 +206,7 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters:
; working_dir: $InstallDir$
; icon_file:
@ -155,13 +220,55 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters: <some_param>
; working_dir: $InstallDir$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir$\$ProgramExecutable$"
parameters:
working_dir: $InstallDir$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[DosInAnIcon_DisbaleUpdate]
; Requires horstmuc.inifile
;
; inifile "$InstallDir$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_get_licensekey]
if opsiLicenseManagementEnabled
comment "License management is enabled and will be used"

View File

@ -4,7 +4,8 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
DefVar $UninstallProgram$
DefVar $UninstallProgramOld$
@ -20,7 +21,11 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -47,9 +52,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"

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,22 +9,66 @@ 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: true
licenseRequired: False
productClasses:
setupScript: setup32.ins
uninstallScript: uninstall32.ins
setupScript: setup32.opsiscript
uninstallScript: uninstall32.opsiscript
updateScript:
alwaysScript:
onceScript:
customScript:
userLoginScript:
[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"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -124,27 +144,54 @@ WINST_VALUE[1]="My content"
# !!! These Variables are requred if you remove them in this cfg file you will get error's about not defined Variables !!!
#
#########################
# if the packaga just supports X86 OR X86_64 (setupXX.ins delsubXX.ins uninstallXX.ins) then you have to just specify one UninstallProg
# 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]="UninstallProg"
OPSI_INI_OPTION[0]="MsiId"
OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
# OR
OPSI_INI_SECTION[0]="X86_64"
OPSI_INI_OPTION[0]="UninstallProg"
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 UninstallProg's
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallProg32"
OPSI_INI_OPTION[0]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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}"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallProg64"
OPSI_INI_OPTION[1]="MsiId64"
OPSI_INI_VALUE[1]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,53 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Setup was successfully run to completion."
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Setup failed to initialize."
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel in the wizard before the actual installation started, or chose "No" on the opening "This will install..." message box."
isFatalError
endif
if ($ExitCode$ = "3")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred while preparing to move to the next installation phase (for example, from displaying the pre-installation wizard pages to the actual installation process). This should never happen except under the most unusual of circumstances, such as running out of memory or Windows resources."
isFatalError
endif
if ($ExitCode$ = "4")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred during the actual installation process."
isFatalError
endif
if ($ExitCode$ = "5")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel during the actual installation process, or chose Abort at an Abort-Retry-Ignore box."
isFatalError
endif
if ($ExitCode$ = "6")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The Setup process was forcefully terminated by the debugger (Run | Terminate was used in the IDE)."
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,92 @@
;Request Exitcode of last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Success"
setLogLevel = 4
endif
if ($ExitCode$ = "-1")
logError "ExitCode = "+$ExitCode$+" General error"
isFatalError
endif
if ($ExitCode$ = "-2")
logError "ExitCode = "+$ExitCode$+" Invalid mode"
isFatalError
endif
if ($ExitCode$ = "-3")
logError "ExitCode = "+$ExitCode$+" Required data not found in the Setup.iss file"
isFatalError
endif
if ($ExitCode$ = "-4")
logError "ExitCode = "+$ExitCode$+" Not enough memory available"
isFatalError
endif
if ($ExitCode$ = "-5")
logError "ExitCode = "+$ExitCode$+" File does not exist"
isFatalError
endif
if ($ExitCode$ = "-6")
logError "ExitCode = "+$ExitCode$+" Cannot write to the response file"
isFatalError
endif
if ($ExitCode$ = "-7")
logError "ExitCode = "+$ExitCode$+" Unable to write to the log file"
isFatalError
endif
if ($ExitCode$ = "-8")
logError "ExitCode = "+$ExitCode$+" Invalid path to the InstallShield Silent response file"
isFatalError
endif
if ($ExitCode$ = "-9")
logError "ExitCode = "+$ExitCode$+" Not a valid list type (string or number)"
isFatalError
endif
if ($ExitCode$ = "-10")
logError "ExitCode = "+$ExitCode$+" Data type is invalid"
isFatalError
endif
if ($ExitCode$ = "-11")
logError "ExitCode = "+$ExitCode$+" Unknown error during setup"
isFatalError
endif
if ($ExitCode$ = "-12")
logError "ExitCode = "+$ExitCode$+" Dialogs are out of order"
isFatalError
endif
if ($ExitCode$ = "-51")
logError "ExitCode = "+$ExitCode$+" Cannot create the specified folder"
isFatalError
endif
if ($ExitCode$ = "-52")
logError "ExitCode = "+$ExitCode$+" Cannot access the specified file or folder"
isFatalError
endif
if ($ExitCode$ = "-53")
logError "ExitCode = "+$ExitCode$+" Invalid option selected"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,29 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Normal execution (no error)"
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by user (cancel button)"
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by script"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -3,32 +3,46 @@
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
include_append "%ScriptPath%\browserkill.opsiinc"
Set $UninstallProgram$ = $InstallDir$ + "\" + $UninstallProg$
Set $UninstallProgram$ = $InstallDir$ + "\" + $UninstallExecutable$
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","")
endif
Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..."
else
Message "Uninstalling " + $ProductId$ + " ..."
endif
if FileExists($IniFile$)
Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe")
Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallProg$
Set $UninstallExecutable$ = GetValueFromInifile($IniFile$,"X86","UninstallExecutable","XXXXXXXX.exe")
Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallExecutable$
if FileExists($UninstallProgramOld$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall /32Bit
@ -38,34 +52,53 @@ Registry_uninstall /32Bit
comment "Delete program shortcuts"
LinkFolder_uninstall
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[Winbatch_uninstall_old]
; 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
[Files_uninstall]
; Example for recursively deleting the installation directory:
;
del -sf "$InstallDir$\"
; del -sf "$InstallDir$\"
[Registry_uninstall]
; Example of deleting a registry key:
@ -73,6 +106,10 @@ del -sf "$InstallDir$\"
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -84,6 +121,20 @@ del -sf "$InstallDir$\"
; set_subfolder ""
; delete_element $ProductId$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -1,5 +1,7 @@
[X86]
[X86_64]
[COMMON]
PN=name
VERSION=version

View File

@ -4,7 +4,10 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
include_append "%ScriptPath%\browserkill.opsiinc"
DefVar $UninstallProgram$
DefVar $UninstallProgramOld$
@ -19,7 +22,20 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $CheckOsVersion$
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -31,6 +47,15 @@ Set $LogDir$ = "%SystemDrive%\tmp"
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
@ -44,6 +69,12 @@ Set $InstallDir$ = "%ProgramFiles32Dir%\<path to the product>"
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "No Space"
@ -52,9 +83,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$ + " ..."
@ -62,17 +93,47 @@ else
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
Sub_check_exitcode
comment "Copy files"
Files_install /32Bit
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
endif
endif
[Winbatch_install]
@ -84,12 +145,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"
@ -119,6 +180,10 @@ copy "$IniCfgFile$" "$InstallDir$"
; set "name3" = REG_BINARY:00 af 99 cd
[LinkFolder_install]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -131,7 +196,7 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters:
; working_dir: $InstallDir$
; icon_file:
@ -145,13 +210,55 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters: <some_param>
; working_dir: $InstallDir$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir$\$ProgramExecutable$"
parameters:
working_dir: $InstallDir$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[DosInAnIcon_DisbaleUpdate]
; Requires horstmuc.inifile
;
; inifile "$InstallDir$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -4,7 +4,8 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
DefVar $UninstallProgram$
DefVar $UninstallProgramOld$
@ -18,7 +19,11 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -43,8 +48,8 @@ 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

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,22 +9,66 @@ 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: setup32.ins
uninstallScript: uninstall32.ins
setupScript: setup32.opsiscript
uninstallScript: uninstall32.opsiscript
updateScript:
alwaysScript:
onceScript:
customScript:
userLoginScript:
[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"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -124,27 +144,54 @@ WINST_VALUE[1]="My content"
# !!! These Variables are requred if you remove them in this cfg file you will get error's about not defined Variables !!!
#
#########################
# if the packaga just supports X86 OR X86_64 (setupXX.ins delsubXX.ins uninstallXX.ins) then you have to just specify one UninstallProg
# 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]="UninstallProg"
OPSI_INI_OPTION[0]="MsiId"
OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
# OR
OPSI_INI_SECTION[0]="X86_64"
OPSI_INI_OPTION[0]="UninstallProg"
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 UninstallProg's
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallProg32"
OPSI_INI_OPTION[0]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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}"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallProg64"
OPSI_INI_OPTION[1]="MsiId64"
OPSI_INI_VALUE[1]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,307 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0" OR $ExitCode$ ="1641" OR $ExitCode$ ="3010")
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Action completed successfully."
setLogLevel = 4
endif
if ($ExitCode$ = "1641")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_INITIATED The installer has started a reboot. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
if ($ExitCode$ = "3010")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_REQUIRED A reboot is required to complete the install. This does not include installs where the ForceReboot action is run. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
else
if ($ExitCode$ = "13")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_DATA The data is invalid."
isFatalError
endif
if ($ExitCode$ = "87")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_PARAMETER One of the parameters was invalid."
isFatalError
endif
if ($ExitCode$ = "120")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CALL_NOT_IMPLEMENTED This function is not available for this platform. It is only available on Windows 2000 and Windows XP with Window Installer version 2.0."
isFatalError
endif
if ($ExitCode$ = "1259")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_APPHELP_BLOCK This error code only occurs when using Windows Installer version 2.0 and Windows XP or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user and asking whether to try to install anyway. This error code is returned if the user chooses not to try the installation."
isFatalError
endif
if ($ExitCode$ = "1601")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SERVICE_FAILURE The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered."
isFatalError
endif
if ($ExitCode$ = "1602")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_USEREXIT User cancel installation."
isFatalError
endif
if ($ExitCode$ = "1603")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_FAILURE Fatal error during installation."
isFatalError
endif
if ($ExitCode$ = "1604")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SUSPEND Installation suspended, incomplete."
isFatalError
endif
if ($ExitCode$ = "1605")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PRODUCT This action is only valid for products that are currently installed."
isFatalError
endif
if ($ExitCode$ = "1606")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_FEATURE Feature ID not registered."
isFatalError
endif
if ($ExitCode$ = "1607")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_COMPONENT Component ID not registered."
isFatalError
endif
if ($ExitCode$ = "1608")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PROPERTY Unknown property."
isFatalError
endif
if ($ExitCode$ = "1609")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_HANDLE_STATE Handle is in an invalid state."
isFatalError
endif
if ($ExitCode$ = "1610")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_CONFIGURATION The configuration data for this product is corrupt. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1611")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INDEX_ABSENT Component qualifier not present."
isFatalError
endif
if ($ExitCode$ = "1612")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SOURCE_ABSENT The installation source for this product is not available. Verify that the source exists and that you can access it."
isFatalError
endif
if ($ExitCode$ = "1613")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_VERSION This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1614")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_UNINSTALLED Product is uninstalled."
isFatalError
endif
if ($ExitCode$ = "1615")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_QUERY_SYNTAX SQL query syntax invalid or unsupported."
isFatalError
endif
if ($ExitCode$ = "1616")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_FIELD Record field does not exist."
isFatalError
endif
if ($ExitCode$ = "1618")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_ALREADY_RUNNING Another installation is already in progress. Complete that installation before proceeding with this install."
isFatalError
endif
if ($ExitCode$ = "1619")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_OPEN_FAILED This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1620")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_INVALID This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1621")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_UI_FAILURE There was an error starting the Windows Installer service user interface. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1622")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LOG_FAILURE Error opening installation log file. Verify that the specified log file location exists and is writable."
isFatalError
endif
if ($ExitCode$ = "1623")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LANGUAGE_UNSUPPORTED This language of this installation package is not supported by your system."
isFatalError
endif
if ($ExitCode$ = "1624")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_FAILURE Error applying transforms. Verify that the specified transform paths are valid."
isFatalError
endif
if ($ExitCode$ = "1625")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_REJECTED This installation is forbidden by system policy. Contact your system administrator."
isFatalError
endif
if ($ExitCode$ = "1626")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_NOT_CALLED Function could not be executed."
isFatalError
endif
if ($ExitCode$ = "1627")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_FAILED Function failed during execution."
isFatalError
endif
if ($ExitCode$ = "1628")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_TABLE Invalid or unknown table specified."
isFatalError
endif
if ($ExitCode$ = "1629")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_DATATYPE_MISMATCH Data supplied is of wrong type."
isFatalError
endif
if ($ExitCode$ = "1630")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNSUPPORTED_TYPE Data of this type is not supported."
isFatalError
endif
if ($ExitCode$ = "1631")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CREATE_FAILED The Windows Installer service failed to start. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1632")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TEMP_UNWRITABLE The temp folder is either full or inaccessible. Verify that the temp folder exists and that you can write to it."
isFatalError
endif
if ($ExitCode$ = "1633")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PLATFORM_UNSUPPORTED This installation package is not supported on this platform. Contact your application vendor."
isFatalError
endif
if ($ExitCode$ = "1634")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_NOTUSED Component not used on this machine"
isFatalError
endif
if ($ExitCode$ = "1635")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_OPEN_FAILED This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1636")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_INVALID This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1637")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_UNSUPPORTED This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1638")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_VERSION Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel."
isFatalError
endif
if ($ExitCode$ = "1639")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_COMMAND_LINE Invalid command line argument. Consult the Windows Installer SDK for detailed command line help."
isFatalError
endif
if ($ExitCode$ = "1640")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_REMOTE_DISALLOWED Installation from a Terminal Server client session not permitted for current user."
isFatalError
endif
if ($ExitCode$ = "1642")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_TARGET_NOT_FOUND The installer cannot install the upgrade patch because the program being upgraded may be missing or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. This error code is not available on Windows Installer version 1.0."
isFatalError
endif
if ($ExitCode$ = "1643")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_REJECTED The patch package is not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
if ($ExitCode$ = "1644")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_REJECTED One or more customizations are not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -3,6 +3,7 @@
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
include_append "%ScriptPath%\browserkill.opsiinc"
Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini"
@ -10,23 +11,32 @@ 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","")
endif
Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..."
else
Message "Uninstalling " + $ProductId$ + " ..."
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 "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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"
Winbatch_uninstall_msi
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall /32Bit
@ -36,16 +46,37 @@ Registry_uninstall /32Bit
comment "Delete program shortcuts"
LinkFolder_uninstall
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[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:
;
del -sf "$InstallDir$\"
; del -sf "$InstallDir$\"
[Registry_uninstall]
; Example of deleting a registry key:
@ -53,6 +84,10 @@ del -sf "$InstallDir$\"
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -64,6 +99,20 @@ del -sf "$InstallDir$\"
; set_subfolder ""
; delete_element $ProductId$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -1,10 +1,6 @@
[X86]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[X86_64]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[COMMON]
PN=name

View File

@ -4,7 +4,10 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
include_append "%ScriptPath%\browserkill.opsiinc"
DefVar $MsiIdOld$
DefVar $IniFile$
@ -21,7 +24,20 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $CheckOsVersion$
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -33,6 +49,15 @@ Set $LogDir$ = "%SystemDrive%\tmp"
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
@ -48,6 +73,12 @@ Set $LicensePool$ = "p_" + $ProductId$
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "No Space"
@ -56,9 +87,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$ + " ..."
@ -71,17 +102,45 @@ else
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
comment "Copy files"
Files_install /32Bit
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
endif
endif
[Winbatch_install]
@ -93,12 +152,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"
@ -128,6 +187,10 @@ copy "$IniCfgFile$" "$InstallDir$"
; set "name3" = REG_BINARY:00 af 99 cd
[LinkFolder_install]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -140,7 +203,7 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters:
; working_dir: $InstallDir$
; icon_file:
@ -154,13 +217,55 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters: <some_param>
; working_dir: $InstallDir$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir$\$ProgramExecutable$"
parameters:
working_dir: $InstallDir$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[DosInAnIcon_DisbaleUpdate]
; Requires horstmuc.inifile
;
; inifile "$InstallDir$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_get_licensekey]
if opsiLicenseManagementEnabled
comment "License management is enabled and will be used"

View File

@ -4,7 +4,8 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
DefVar $MsiIdOld$
DefVar $IniFile$
@ -19,7 +20,11 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -46,9 +51,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"

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,22 +9,66 @@ 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: True
licenseRequired: False
productClasses:
setupScript: setup32.ins
uninstallScript: uninstall32.ins
setupScript: setup32.opsiscript
uninstallScript: uninstall32.opsiscript
updateScript:
alwaysScript:
onceScript:
customScript:
userLoginScript:
[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"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -126,6 +146,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 +157,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]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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 +184,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]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,307 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0" OR $ExitCode$ ="1641" OR $ExitCode$ ="3010")
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Action completed successfully."
setLogLevel = 4
endif
if ($ExitCode$ = "1641")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_INITIATED The installer has started a reboot. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
if ($ExitCode$ = "3010")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_REQUIRED A reboot is required to complete the install. This does not include installs where the ForceReboot action is run. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
else
if ($ExitCode$ = "13")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_DATA The data is invalid."
isFatalError
endif
if ($ExitCode$ = "87")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_PARAMETER One of the parameters was invalid."
isFatalError
endif
if ($ExitCode$ = "120")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CALL_NOT_IMPLEMENTED This function is not available for this platform. It is only available on Windows 2000 and Windows XP with Window Installer version 2.0."
isFatalError
endif
if ($ExitCode$ = "1259")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_APPHELP_BLOCK This error code only occurs when using Windows Installer version 2.0 and Windows XP or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user and asking whether to try to install anyway. This error code is returned if the user chooses not to try the installation."
isFatalError
endif
if ($ExitCode$ = "1601")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SERVICE_FAILURE The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered."
isFatalError
endif
if ($ExitCode$ = "1602")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_USEREXIT User cancel installation."
isFatalError
endif
if ($ExitCode$ = "1603")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_FAILURE Fatal error during installation."
isFatalError
endif
if ($ExitCode$ = "1604")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SUSPEND Installation suspended, incomplete."
isFatalError
endif
if ($ExitCode$ = "1605")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PRODUCT This action is only valid for products that are currently installed."
isFatalError
endif
if ($ExitCode$ = "1606")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_FEATURE Feature ID not registered."
isFatalError
endif
if ($ExitCode$ = "1607")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_COMPONENT Component ID not registered."
isFatalError
endif
if ($ExitCode$ = "1608")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PROPERTY Unknown property."
isFatalError
endif
if ($ExitCode$ = "1609")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_HANDLE_STATE Handle is in an invalid state."
isFatalError
endif
if ($ExitCode$ = "1610")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_CONFIGURATION The configuration data for this product is corrupt. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1611")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INDEX_ABSENT Component qualifier not present."
isFatalError
endif
if ($ExitCode$ = "1612")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SOURCE_ABSENT The installation source for this product is not available. Verify that the source exists and that you can access it."
isFatalError
endif
if ($ExitCode$ = "1613")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_VERSION This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1614")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_UNINSTALLED Product is uninstalled."
isFatalError
endif
if ($ExitCode$ = "1615")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_QUERY_SYNTAX SQL query syntax invalid or unsupported."
isFatalError
endif
if ($ExitCode$ = "1616")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_FIELD Record field does not exist."
isFatalError
endif
if ($ExitCode$ = "1618")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_ALREADY_RUNNING Another installation is already in progress. Complete that installation before proceeding with this install."
isFatalError
endif
if ($ExitCode$ = "1619")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_OPEN_FAILED This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1620")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_INVALID This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1621")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_UI_FAILURE There was an error starting the Windows Installer service user interface. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1622")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LOG_FAILURE Error opening installation log file. Verify that the specified log file location exists and is writable."
isFatalError
endif
if ($ExitCode$ = "1623")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LANGUAGE_UNSUPPORTED This language of this installation package is not supported by your system."
isFatalError
endif
if ($ExitCode$ = "1624")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_FAILURE Error applying transforms. Verify that the specified transform paths are valid."
isFatalError
endif
if ($ExitCode$ = "1625")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_REJECTED This installation is forbidden by system policy. Contact your system administrator."
isFatalError
endif
if ($ExitCode$ = "1626")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_NOT_CALLED Function could not be executed."
isFatalError
endif
if ($ExitCode$ = "1627")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_FAILED Function failed during execution."
isFatalError
endif
if ($ExitCode$ = "1628")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_TABLE Invalid or unknown table specified."
isFatalError
endif
if ($ExitCode$ = "1629")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_DATATYPE_MISMATCH Data supplied is of wrong type."
isFatalError
endif
if ($ExitCode$ = "1630")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNSUPPORTED_TYPE Data of this type is not supported."
isFatalError
endif
if ($ExitCode$ = "1631")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CREATE_FAILED The Windows Installer service failed to start. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1632")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TEMP_UNWRITABLE The temp folder is either full or inaccessible. Verify that the temp folder exists and that you can write to it."
isFatalError
endif
if ($ExitCode$ = "1633")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PLATFORM_UNSUPPORTED This installation package is not supported on this platform. Contact your application vendor."
isFatalError
endif
if ($ExitCode$ = "1634")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_NOTUSED Component not used on this machine"
isFatalError
endif
if ($ExitCode$ = "1635")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_OPEN_FAILED This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1636")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_INVALID This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1637")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_UNSUPPORTED This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1638")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_VERSION Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel."
isFatalError
endif
if ($ExitCode$ = "1639")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_COMMAND_LINE Invalid command line argument. Consult the Windows Installer SDK for detailed command line help."
isFatalError
endif
if ($ExitCode$ = "1640")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_REMOTE_DISALLOWED Installation from a Terminal Server client session not permitted for current user."
isFatalError
endif
if ($ExitCode$ = "1642")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_TARGET_NOT_FOUND The installer cannot install the upgrade patch because the program being upgraded may be missing or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. This error code is not available on Windows Installer version 1.0."
isFatalError
endif
if ($ExitCode$ = "1643")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_REJECTED The patch package is not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
if ($ExitCode$ = "1644")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_REJECTED One or more customizations are not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -3,6 +3,7 @@
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
include_append "%ScriptPath%\browserkill.opsiinc"
Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini"
@ -10,23 +11,32 @@ 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","")
endif
Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..."
else
Message "Uninstalling " + $ProductId$ + " ..."
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 "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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"
Winbatch_uninstall_msi
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall /32Bit
@ -36,16 +46,37 @@ Registry_uninstall /32Bit
comment "Delete program shortcuts"
LinkFolder_uninstall
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[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:
;
del -sf "$InstallDir$\"
; del -sf "$InstallDir$\"
[Registry_uninstall]
; Example of deleting a registry key:
@ -53,6 +84,10 @@ del -sf "$InstallDir$\"
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -64,6 +99,20 @@ del -sf "$InstallDir$\"
; set_subfolder ""
; delete_element $ProductId$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -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"

View File

@ -1,10 +1,6 @@
[X86]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[X86_64]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[COMMON]
PN=name

View File

@ -4,7 +4,10 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
include_append "%ScriptPath%\browserkill.opsiinc"
DefVar $MsiIdOld$
DefVar $IniFile$
@ -18,7 +21,20 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $CheckOsVersion$
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -30,6 +46,15 @@ Set $LogDir$ = "%SystemDrive%\tmp"
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
@ -43,6 +68,12 @@ Set $InstallDir$ = "%ProgramFiles32Dir%\<path to the product>"
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "No Space"
@ -51,9 +82,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$ + " ..."
@ -61,17 +92,45 @@ else
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
comment "Copy files"
Files_install /32Bit
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
endif
endif
[Winbatch_install]
@ -83,12 +142,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"
@ -118,6 +177,10 @@ copy "$IniCfgFile$" "$InstallDir$"
; set "name3" = REG_BINARY:00 af 99 cd
[LinkFolder_install]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -130,7 +193,7 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters:
; working_dir: $InstallDir$
; icon_file:
@ -144,13 +207,55 @@ copy "$IniCfgFile$" "$InstallDir$"
;
; set_link
; name: $ProductId$
; target: <path to the program>
; target: $InstallDir$\$ProgramExecutable$
; parameters: <some_param>
; working_dir: $InstallDir$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir$\$ProgramExecutable$"
parameters:
working_dir: $InstallDir$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[DosInAnIcon_DisbaleUpdate]
; Requires horstmuc.inifile
;
; inifile "$InstallDir$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -4,7 +4,8 @@
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.2.6"
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
DefVar $MsiIdOld$
DefVar $IniFile$
@ -17,7 +18,11 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
Set $LogDir$ = "%SystemDrive%\tmp"
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
@ -42,8 +47,8 @@ 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

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,22 +9,66 @@ 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: setup32.ins
uninstallScript: uninstall32.ins
setupScript: setup32.opsiscript
uninstallScript: uninstall32.opsiscript
updateScript:
alwaysScript:
onceScript:
customScript:
userLoginScript:
[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"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -126,6 +146,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 +157,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]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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 +184,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]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,53 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Setup was successfully run to completion."
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Setup failed to initialize."
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel in the wizard before the actual installation started, or chose "No" on the opening "This will install..." message box."
isFatalError
endif
if ($ExitCode$ = "3")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred while preparing to move to the next installation phase (for example, from displaying the pre-installation wizard pages to the actual installation process). This should never happen except under the most unusual of circumstances, such as running out of memory or Windows resources."
isFatalError
endif
if ($ExitCode$ = "4")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred during the actual installation process."
isFatalError
endif
if ($ExitCode$ = "5")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel during the actual installation process, or chose Abort at an Abort-Retry-Ignore box."
isFatalError
endif
if ($ExitCode$ = "6")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The Setup process was forcefully terminated by the debugger (Run | Terminate was used in the IDE)."
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,92 @@
;Request Exitcode of last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Success"
setLogLevel = 4
endif
if ($ExitCode$ = "-1")
logError "ExitCode = "+$ExitCode$+" General error"
isFatalError
endif
if ($ExitCode$ = "-2")
logError "ExitCode = "+$ExitCode$+" Invalid mode"
isFatalError
endif
if ($ExitCode$ = "-3")
logError "ExitCode = "+$ExitCode$+" Required data not found in the Setup.iss file"
isFatalError
endif
if ($ExitCode$ = "-4")
logError "ExitCode = "+$ExitCode$+" Not enough memory available"
isFatalError
endif
if ($ExitCode$ = "-5")
logError "ExitCode = "+$ExitCode$+" File does not exist"
isFatalError
endif
if ($ExitCode$ = "-6")
logError "ExitCode = "+$ExitCode$+" Cannot write to the response file"
isFatalError
endif
if ($ExitCode$ = "-7")
logError "ExitCode = "+$ExitCode$+" Unable to write to the log file"
isFatalError
endif
if ($ExitCode$ = "-8")
logError "ExitCode = "+$ExitCode$+" Invalid path to the InstallShield Silent response file"
isFatalError
endif
if ($ExitCode$ = "-9")
logError "ExitCode = "+$ExitCode$+" Not a valid list type (string or number)"
isFatalError
endif
if ($ExitCode$ = "-10")
logError "ExitCode = "+$ExitCode$+" Data type is invalid"
isFatalError
endif
if ($ExitCode$ = "-11")
logError "ExitCode = "+$ExitCode$+" Unknown error during setup"
isFatalError
endif
if ($ExitCode$ = "-12")
logError "ExitCode = "+$ExitCode$+" Dialogs are out of order"
isFatalError
endif
if ($ExitCode$ = "-51")
logError "ExitCode = "+$ExitCode$+" Cannot create the specified folder"
isFatalError
endif
if ($ExitCode$ = "-52")
logError "ExitCode = "+$ExitCode$+" Cannot access the specified file or folder"
isFatalError
endif
if ($ExitCode$ = "-53")
logError "ExitCode = "+$ExitCode$+" Invalid option selected"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,29 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Normal execution (no error)"
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by user (cancel button)"
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by script"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,307 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
Set $UninstallProgram32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini"
Set $UninstallProgram64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 32 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 32 Bit..."
endif
if FileExists($IniFile32$)
Set $UninstallExecutable32$ = GetValueFromInifile($IniFile32$,"X86","UninstallExecutable32","XXXXXXXX.exe")
Set $UninstallProgramOld32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
if FileExists($UninstallProgramOld32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_32 /32Bit
comment "Cleanup registry"
Registry_uninstall /32Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 64 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 64 Bit..."
endif
if FileExists($IniFile64$)
Set $UninstallExecutable64$ = GetValueFromInifile($IniFile64$,"X86_64","UninstallExecutable64","XXXXXXXX.exe")
Set $UninstallProgramOld64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
if FileExists($UninstallProgramOld64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_64 /64Bit
comment "Cleanup registry"
Registry_uninstall /64Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
endif
comment "Delete program shortcuts"
LinkFolder_uninstall
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[Winbatch_uninstall_old_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
; "$UninstallProgramOld32$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld32$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_32]
msiexec /x $MsiIdOld32$ /qb-! REBOOT=ReallySuppress
[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_old_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
; "$UninstallProgramOld64$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_64]
msiexec /x $MsiIdOld64$ /qb-! REBOOT=ReallySuppress
[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]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; 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$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[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

View File

@ -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"

View File

@ -1,10 +1,6 @@
[X86]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[X86_64]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[COMMON]
PN=name

View File

@ -0,0 +1,473 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
DefVar $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $CheckOsVersion$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - 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 $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
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" $NAME$
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$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 32 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_32
comment "Copy files"
Files_install_32 /32Bit
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install_32
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_32
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 64 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_64
comment "Copy files"
Files_install_64 /64Bit
comment "Patch Registry"
Registry_install /64Bit
comment "Create shortcuts"
LinkFolder_install_64
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_64
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir32$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
[DosInAnIcon_DisbaleUpdate_32]
; Requires horstmuc.inifile
;
; inifile "$InstallDir32$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
[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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir64$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
[DosInAnIcon_DisbaleUpdate_64]
; Requires horstmuc.inifile
;
; inifile "$InstallDir64$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
[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_32]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters:
; working_dir: $InstallDir32$
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters: <some_param>
; working_dir: $InstallDir32$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_64]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters:
; working_dir: $InstallDir64$
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters: <some_param>
; working_dir: $InstallDir64$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink_32]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir32$\$ProgramExecutable32$"
parameters:
working_dir: $InstallDir32$
icon_file:
icon_index:
end_link
[LinkFolder_install_DesktopLink_64]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir64$\$ProgramExecutable64$"
parameters:
working_dir: $InstallDir64$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[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

View File

@ -0,0 +1,91 @@
; 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 $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$
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$)

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,12 +9,12 @@ 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: True
licenseRequired: False
productClasses:
setupScript: setup3264.ins
uninstallScript: uninstall3264.ins
setupScript: setup32.opsiscript
uninstallScript: uninstall32.opsiscript
updateScript:
alwaysScript:
onceScript:
@ -30,10 +30,45 @@ description: which architecture (32/64 bit) has to be installed
values: ["32 only", "64 only", "both", "system specific"]
default: ["system specific"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -124,27 +144,54 @@ WINST_VALUE[1]="My content"
# !!! These Variables are requred if you remove them in this cfg file you will get error's about not defined Variables !!!
#
#########################
# if the packaga just supports X86 OR X86_64 (setupXX.ins delsubXX.ins uninstallXX.ins) then you have to just specify one UninstallProg
# 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]="UninstallProg"
OPSI_INI_OPTION[0]="MsiId"
OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
# OR
OPSI_INI_SECTION[0]="X86_64"
OPSI_INI_OPTION[0]="UninstallProg"
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 UninstallProg's
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallProg32"
OPSI_INI_OPTION[0]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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}"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallProg64"
OPSI_INI_OPTION[1]="MsiId64"
OPSI_INI_VALUE[1]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,53 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Setup was successfully run to completion."
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Setup failed to initialize."
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel in the wizard before the actual installation started, or chose "No" on the opening "This will install..." message box."
isFatalError
endif
if ($ExitCode$ = "3")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred while preparing to move to the next installation phase (for example, from displaying the pre-installation wizard pages to the actual installation process). This should never happen except under the most unusual of circumstances, such as running out of memory or Windows resources."
isFatalError
endif
if ($ExitCode$ = "4")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred during the actual installation process."
isFatalError
endif
if ($ExitCode$ = "5")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel during the actual installation process, or chose Abort at an Abort-Retry-Ignore box."
isFatalError
endif
if ($ExitCode$ = "6")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The Setup process was forcefully terminated by the debugger (Run | Terminate was used in the IDE)."
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,92 @@
;Request Exitcode of last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Success"
setLogLevel = 4
endif
if ($ExitCode$ = "-1")
logError "ExitCode = "+$ExitCode$+" General error"
isFatalError
endif
if ($ExitCode$ = "-2")
logError "ExitCode = "+$ExitCode$+" Invalid mode"
isFatalError
endif
if ($ExitCode$ = "-3")
logError "ExitCode = "+$ExitCode$+" Required data not found in the Setup.iss file"
isFatalError
endif
if ($ExitCode$ = "-4")
logError "ExitCode = "+$ExitCode$+" Not enough memory available"
isFatalError
endif
if ($ExitCode$ = "-5")
logError "ExitCode = "+$ExitCode$+" File does not exist"
isFatalError
endif
if ($ExitCode$ = "-6")
logError "ExitCode = "+$ExitCode$+" Cannot write to the response file"
isFatalError
endif
if ($ExitCode$ = "-7")
logError "ExitCode = "+$ExitCode$+" Unable to write to the log file"
isFatalError
endif
if ($ExitCode$ = "-8")
logError "ExitCode = "+$ExitCode$+" Invalid path to the InstallShield Silent response file"
isFatalError
endif
if ($ExitCode$ = "-9")
logError "ExitCode = "+$ExitCode$+" Not a valid list type (string or number)"
isFatalError
endif
if ($ExitCode$ = "-10")
logError "ExitCode = "+$ExitCode$+" Data type is invalid"
isFatalError
endif
if ($ExitCode$ = "-11")
logError "ExitCode = "+$ExitCode$+" Unknown error during setup"
isFatalError
endif
if ($ExitCode$ = "-12")
logError "ExitCode = "+$ExitCode$+" Dialogs are out of order"
isFatalError
endif
if ($ExitCode$ = "-51")
logError "ExitCode = "+$ExitCode$+" Cannot create the specified folder"
isFatalError
endif
if ($ExitCode$ = "-52")
logError "ExitCode = "+$ExitCode$+" Cannot access the specified file or folder"
isFatalError
endif
if ($ExitCode$ = "-53")
logError "ExitCode = "+$ExitCode$+" Invalid option selected"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,29 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Normal execution (no error)"
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by user (cancel button)"
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by script"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,307 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
Set $UninstallProgram32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini"
Set $UninstallProgram64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 32 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 32 Bit..."
endif
if FileExists($IniFile32$)
Set $UninstallExecutable32$ = GetValueFromInifile($IniFile32$,"X86","UninstallExecutable32","XXXXXXXX.exe")
Set $UninstallProgramOld32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
if FileExists($UninstallProgramOld32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_32 /32Bit
comment "Cleanup registry"
Registry_uninstall /32Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 64 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 64 Bit..."
endif
if FileExists($IniFile64$)
Set $UninstallExecutable64$ = GetValueFromInifile($IniFile64$,"X86_64","UninstallExecutable64","XXXXXXXX.exe")
Set $UninstallProgramOld64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
if FileExists($UninstallProgramOld64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_64 /64Bit
comment "Cleanup registry"
Registry_uninstall /64Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
endif
comment "Delete program shortcuts"
LinkFolder_uninstall
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[Winbatch_uninstall_old_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
; "$UninstallProgramOld32$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld32$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_32]
msiexec /x $MsiIdOld32$ /qb-! REBOOT=ReallySuppress
[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_old_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
; "$UninstallProgramOld64$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_64]
msiexec /x $MsiIdOld64$ /qb-! REBOOT=ReallySuppress
[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]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; 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$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[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

View File

@ -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"

View File

@ -1,10 +1,6 @@
[X86]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[X86_64]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[COMMON]
PN=name

View File

@ -0,0 +1,473 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
DefVar $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $CheckOsVersion$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - 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 $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
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" $NAME$
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$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 32 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_32
comment "Copy files"
Files_install_32 /32Bit
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install_32
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_32
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 64 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_64
comment "Copy files"
Files_install_64 /64Bit
comment "Patch Registry"
Registry_install /64Bit
comment "Create shortcuts"
LinkFolder_install_64
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_64
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir32$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
[DosInAnIcon_DisbaleUpdate_32]
; Requires horstmuc.inifile
;
; inifile "$InstallDir32$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
[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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir64$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
[DosInAnIcon_DisbaleUpdate_64]
; Requires horstmuc.inifile
;
; inifile "$InstallDir64$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
[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_32]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters:
; working_dir: $InstallDir32$
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters: <some_param>
; working_dir: $InstallDir32$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_64]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters:
; working_dir: $InstallDir64$
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters: <some_param>
; working_dir: $InstallDir64$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink_32]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir32$\$ProgramExecutable32$"
parameters:
working_dir: $InstallDir32$
icon_file:
icon_index:
end_link
[LinkFolder_install_DesktopLink_64]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir64$\$ProgramExecutable64$"
parameters:
working_dir: $InstallDir64$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[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

View File

@ -0,0 +1,91 @@
; 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 $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$
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$)

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,12 +9,12 @@ 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:
@ -30,10 +30,45 @@ description: which architecture (32/64 bit) has to be installed
values: ["32 only", "64 only", "both", "system specific"]
default: ["system specific"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -124,27 +144,54 @@ WINST_VALUE[1]="My content"
# !!! These Variables are requred if you remove them in this cfg file you will get error's about not defined Variables !!!
#
#########################
# if the packaga just supports X86 OR X86_64 (setupXX.ins delsubXX.ins uninstallXX.ins) then you have to just specify one UninstallProg
# 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]="UninstallProg"
OPSI_INI_OPTION[0]="MsiId"
OPSI_INI_VALUE[0]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
# OR
OPSI_INI_SECTION[0]="X86_64"
OPSI_INI_OPTION[0]="UninstallProg"
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 UninstallProg's
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallProg32"
OPSI_INI_OPTION[0]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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}"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallProg64"
OPSI_INI_OPTION[1]="MsiId64"
OPSI_INI_VALUE[1]="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
##### Installer ##############
OPSI_INI_SECTION[0]="X86"
OPSI_INI_OPTION[0]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,307 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0" OR $ExitCode$ ="1641" OR $ExitCode$ ="3010")
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Action completed successfully."
setLogLevel = 4
endif
if ($ExitCode$ = "1641")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_INITIATED The installer has started a reboot. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
if ($ExitCode$ = "3010")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_REQUIRED A reboot is required to complete the install. This does not include installs where the ForceReboot action is run. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
else
if ($ExitCode$ = "13")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_DATA The data is invalid."
isFatalError
endif
if ($ExitCode$ = "87")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_PARAMETER One of the parameters was invalid."
isFatalError
endif
if ($ExitCode$ = "120")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CALL_NOT_IMPLEMENTED This function is not available for this platform. It is only available on Windows 2000 and Windows XP with Window Installer version 2.0."
isFatalError
endif
if ($ExitCode$ = "1259")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_APPHELP_BLOCK This error code only occurs when using Windows Installer version 2.0 and Windows XP or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user and asking whether to try to install anyway. This error code is returned if the user chooses not to try the installation."
isFatalError
endif
if ($ExitCode$ = "1601")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SERVICE_FAILURE The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered."
isFatalError
endif
if ($ExitCode$ = "1602")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_USEREXIT User cancel installation."
isFatalError
endif
if ($ExitCode$ = "1603")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_FAILURE Fatal error during installation."
isFatalError
endif
if ($ExitCode$ = "1604")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SUSPEND Installation suspended, incomplete."
isFatalError
endif
if ($ExitCode$ = "1605")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PRODUCT This action is only valid for products that are currently installed."
isFatalError
endif
if ($ExitCode$ = "1606")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_FEATURE Feature ID not registered."
isFatalError
endif
if ($ExitCode$ = "1607")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_COMPONENT Component ID not registered."
isFatalError
endif
if ($ExitCode$ = "1608")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PROPERTY Unknown property."
isFatalError
endif
if ($ExitCode$ = "1609")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_HANDLE_STATE Handle is in an invalid state."
isFatalError
endif
if ($ExitCode$ = "1610")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_CONFIGURATION The configuration data for this product is corrupt. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1611")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INDEX_ABSENT Component qualifier not present."
isFatalError
endif
if ($ExitCode$ = "1612")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SOURCE_ABSENT The installation source for this product is not available. Verify that the source exists and that you can access it."
isFatalError
endif
if ($ExitCode$ = "1613")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_VERSION This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1614")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_UNINSTALLED Product is uninstalled."
isFatalError
endif
if ($ExitCode$ = "1615")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_QUERY_SYNTAX SQL query syntax invalid or unsupported."
isFatalError
endif
if ($ExitCode$ = "1616")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_FIELD Record field does not exist."
isFatalError
endif
if ($ExitCode$ = "1618")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_ALREADY_RUNNING Another installation is already in progress. Complete that installation before proceeding with this install."
isFatalError
endif
if ($ExitCode$ = "1619")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_OPEN_FAILED This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1620")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_INVALID This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1621")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_UI_FAILURE There was an error starting the Windows Installer service user interface. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1622")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LOG_FAILURE Error opening installation log file. Verify that the specified log file location exists and is writable."
isFatalError
endif
if ($ExitCode$ = "1623")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LANGUAGE_UNSUPPORTED This language of this installation package is not supported by your system."
isFatalError
endif
if ($ExitCode$ = "1624")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_FAILURE Error applying transforms. Verify that the specified transform paths are valid."
isFatalError
endif
if ($ExitCode$ = "1625")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_REJECTED This installation is forbidden by system policy. Contact your system administrator."
isFatalError
endif
if ($ExitCode$ = "1626")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_NOT_CALLED Function could not be executed."
isFatalError
endif
if ($ExitCode$ = "1627")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_FAILED Function failed during execution."
isFatalError
endif
if ($ExitCode$ = "1628")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_TABLE Invalid or unknown table specified."
isFatalError
endif
if ($ExitCode$ = "1629")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_DATATYPE_MISMATCH Data supplied is of wrong type."
isFatalError
endif
if ($ExitCode$ = "1630")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNSUPPORTED_TYPE Data of this type is not supported."
isFatalError
endif
if ($ExitCode$ = "1631")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CREATE_FAILED The Windows Installer service failed to start. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1632")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TEMP_UNWRITABLE The temp folder is either full or inaccessible. Verify that the temp folder exists and that you can write to it."
isFatalError
endif
if ($ExitCode$ = "1633")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PLATFORM_UNSUPPORTED This installation package is not supported on this platform. Contact your application vendor."
isFatalError
endif
if ($ExitCode$ = "1634")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_NOTUSED Component not used on this machine"
isFatalError
endif
if ($ExitCode$ = "1635")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_OPEN_FAILED This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1636")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_INVALID This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1637")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_UNSUPPORTED This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1638")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_VERSION Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel."
isFatalError
endif
if ($ExitCode$ = "1639")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_COMMAND_LINE Invalid command line argument. Consult the Windows Installer SDK for detailed command line help."
isFatalError
endif
if ($ExitCode$ = "1640")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_REMOTE_DISALLOWED Installation from a Terminal Server client session not permitted for current user."
isFatalError
endif
if ($ExitCode$ = "1642")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_TARGET_NOT_FOUND The installer cannot install the upgrade patch because the program being upgraded may be missing or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. This error code is not available on Windows Installer version 1.0."
isFatalError
endif
if ($ExitCode$ = "1643")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_REJECTED The patch package is not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
if ($ExitCode$ = "1644")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_REJECTED One or more customizations are not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,307 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
Set $UninstallProgram32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini"
Set $UninstallProgram64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 32 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 32 Bit..."
endif
if FileExists($IniFile32$)
Set $UninstallExecutable32$ = GetValueFromInifile($IniFile32$,"X86","UninstallExecutable32","XXXXXXXX.exe")
Set $UninstallProgramOld32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
if FileExists($UninstallProgramOld32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_32 /32Bit
comment "Cleanup registry"
Registry_uninstall /32Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 64 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 64 Bit..."
endif
if FileExists($IniFile64$)
Set $UninstallExecutable64$ = GetValueFromInifile($IniFile64$,"X86_64","UninstallExecutable64","XXXXXXXX.exe")
Set $UninstallProgramOld64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
if FileExists($UninstallProgramOld64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_64 /64Bit
comment "Cleanup registry"
Registry_uninstall /64Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
endif
comment "Delete program shortcuts"
LinkFolder_uninstall
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[Winbatch_uninstall_old_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
; "$UninstallProgramOld32$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld32$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_32]
msiexec /x $MsiIdOld32$ /qb-! REBOOT=ReallySuppress
[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_old_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
; "$UninstallProgramOld64$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_64]
msiexec /x $MsiIdOld64$ /qb-! REBOOT=ReallySuppress
[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]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; 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$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[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

View File

@ -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"

View File

@ -1,10 +1,6 @@
[X86]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[X86_64]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[COMMON]
PN=name

View File

@ -0,0 +1,473 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
DefVar $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $CheckOsVersion$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - 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 $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
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" $NAME$
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$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 32 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_32
comment "Copy files"
Files_install_32 /32Bit
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install_32
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_32
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 64 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_64
comment "Copy files"
Files_install_64 /64Bit
comment "Patch Registry"
Registry_install /64Bit
comment "Create shortcuts"
LinkFolder_install_64
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_64
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir32$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
[DosInAnIcon_DisbaleUpdate_32]
; Requires horstmuc.inifile
;
; inifile "$InstallDir32$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
[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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir64$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
[DosInAnIcon_DisbaleUpdate_64]
; Requires horstmuc.inifile
;
; inifile "$InstallDir64$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
[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_32]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters:
; working_dir: $InstallDir32$
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters: <some_param>
; working_dir: $InstallDir32$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_64]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters:
; working_dir: $InstallDir64$
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters: <some_param>
; working_dir: $InstallDir64$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink_32]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir32$\$ProgramExecutable32$"
parameters:
working_dir: $InstallDir32$
icon_file:
icon_index:
end_link
[LinkFolder_install_DesktopLink_64]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir64$\$ProgramExecutable64$"
parameters:
working_dir: $InstallDir64$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[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

View File

@ -0,0 +1,91 @@
; 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 $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$
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$)

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,12 +9,12 @@ 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: True
licenseRequired: False
productClasses:
setupScript: setup3264.ins
uninstallScript: uninstall3264.ins
setupScript: setup32.opsiscript
uninstallScript: uninstall32.opsiscript
updateScript:
alwaysScript:
onceScript:
@ -30,10 +30,45 @@ description: which architecture (32/64 bit) has to be installed
values: ["32 only", "64 only", "both", "system specific"]
default: ["system specific"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -126,6 +146,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 +157,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]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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 +184,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]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,307 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0" OR $ExitCode$ ="1641" OR $ExitCode$ ="3010")
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Action completed successfully."
setLogLevel = 4
endif
if ($ExitCode$ = "1641")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_INITIATED The installer has started a reboot. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
if ($ExitCode$ = "3010")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_REQUIRED A reboot is required to complete the install. This does not include installs where the ForceReboot action is run. This error code not available on Windows Installer version 1.0."
setLogLevel = 4
endif
else
if ($ExitCode$ = "13")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_DATA The data is invalid."
isFatalError
endif
if ($ExitCode$ = "87")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_PARAMETER One of the parameters was invalid."
isFatalError
endif
if ($ExitCode$ = "120")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CALL_NOT_IMPLEMENTED This function is not available for this platform. It is only available on Windows 2000 and Windows XP with Window Installer version 2.0."
isFatalError
endif
if ($ExitCode$ = "1259")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_APPHELP_BLOCK This error code only occurs when using Windows Installer version 2.0 and Windows XP or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user and asking whether to try to install anyway. This error code is returned if the user chooses not to try the installation."
isFatalError
endif
if ($ExitCode$ = "1601")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SERVICE_FAILURE The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered."
isFatalError
endif
if ($ExitCode$ = "1602")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_USEREXIT User cancel installation."
isFatalError
endif
if ($ExitCode$ = "1603")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_FAILURE Fatal error during installation."
isFatalError
endif
if ($ExitCode$ = "1604")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SUSPEND Installation suspended, incomplete."
isFatalError
endif
if ($ExitCode$ = "1605")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PRODUCT This action is only valid for products that are currently installed."
isFatalError
endif
if ($ExitCode$ = "1606")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_FEATURE Feature ID not registered."
isFatalError
endif
if ($ExitCode$ = "1607")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_COMPONENT Component ID not registered."
isFatalError
endif
if ($ExitCode$ = "1608")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PROPERTY Unknown property."
isFatalError
endif
if ($ExitCode$ = "1609")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_HANDLE_STATE Handle is in an invalid state."
isFatalError
endif
if ($ExitCode$ = "1610")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_CONFIGURATION The configuration data for this product is corrupt. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1611")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INDEX_ABSENT Component qualifier not present."
isFatalError
endif
if ($ExitCode$ = "1612")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SOURCE_ABSENT The installation source for this product is not available. Verify that the source exists and that you can access it."
isFatalError
endif
if ($ExitCode$ = "1613")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_VERSION This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1614")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_UNINSTALLED Product is uninstalled."
isFatalError
endif
if ($ExitCode$ = "1615")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_BAD_QUERY_SYNTAX SQL query syntax invalid or unsupported."
isFatalError
endif
if ($ExitCode$ = "1616")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_FIELD Record field does not exist."
isFatalError
endif
if ($ExitCode$ = "1618")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_ALREADY_RUNNING Another installation is already in progress. Complete that installation before proceeding with this install."
isFatalError
endif
if ($ExitCode$ = "1619")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_OPEN_FAILED This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1620")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_INVALID This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package."
isFatalError
endif
if ($ExitCode$ = "1621")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_UI_FAILURE There was an error starting the Windows Installer service user interface. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1622")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LOG_FAILURE Error opening installation log file. Verify that the specified log file location exists and is writable."
isFatalError
endif
if ($ExitCode$ = "1623")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LANGUAGE_UNSUPPORTED This language of this installation package is not supported by your system."
isFatalError
endif
if ($ExitCode$ = "1624")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_FAILURE Error applying transforms. Verify that the specified transform paths are valid."
isFatalError
endif
if ($ExitCode$ = "1625")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_REJECTED This installation is forbidden by system policy. Contact your system administrator."
isFatalError
endif
if ($ExitCode$ = "1626")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_NOT_CALLED Function could not be executed."
isFatalError
endif
if ($ExitCode$ = "1627")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_FAILED Function failed during execution."
isFatalError
endif
if ($ExitCode$ = "1628")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_TABLE Invalid or unknown table specified."
isFatalError
endif
if ($ExitCode$ = "1629")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_DATATYPE_MISMATCH Data supplied is of wrong type."
isFatalError
endif
if ($ExitCode$ = "1630")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_UNSUPPORTED_TYPE Data of this type is not supported."
isFatalError
endif
if ($ExitCode$ = "1631")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_CREATE_FAILED The Windows Installer service failed to start. Contact your support personnel."
isFatalError
endif
if ($ExitCode$ = "1632")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TEMP_UNWRITABLE The temp folder is either full or inaccessible. Verify that the temp folder exists and that you can write to it."
isFatalError
endif
if ($ExitCode$ = "1633")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PLATFORM_UNSUPPORTED This installation package is not supported on this platform. Contact your application vendor."
isFatalError
endif
if ($ExitCode$ = "1634")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_NOTUSED Component not used on this machine"
isFatalError
endif
if ($ExitCode$ = "1635")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_OPEN_FAILED This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1636")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_INVALID This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package."
isFatalError
endif
if ($ExitCode$ = "1637")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_UNSUPPORTED This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
isFatalError
endif
if ($ExitCode$ = "1638")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_VERSION Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel."
isFatalError
endif
if ($ExitCode$ = "1639")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_COMMAND_LINE Invalid command line argument. Consult the Windows Installer SDK for detailed command line help."
isFatalError
endif
if ($ExitCode$ = "1640")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_REMOTE_DISALLOWED Installation from a Terminal Server client session not permitted for current user."
isFatalError
endif
if ($ExitCode$ = "1642")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_TARGET_NOT_FOUND The installer cannot install the upgrade patch because the program being upgraded may be missing or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. This error code is not available on Windows Installer version 1.0."
isFatalError
endif
if ($ExitCode$ = "1643")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_REJECTED The patch package is not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
if ($ExitCode$ = "1644")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_REJECTED One or more customizations are not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later."
isFatalError
endif
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,307 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
Set $UninstallProgram32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini"
Set $UninstallProgram64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 32 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 32 Bit..."
endif
if FileExists($IniFile32$)
Set $UninstallExecutable32$ = GetValueFromInifile($IniFile32$,"X86","UninstallExecutable32","XXXXXXXX.exe")
Set $UninstallProgramOld32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
if FileExists($UninstallProgramOld32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram32$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_32 /32Bit
comment "Cleanup registry"
Registry_uninstall /32Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
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","")
Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 64 Bit..."
else
Message "Uninstalling " + $ProductId$ + " 64 Bit..."
endif
if FileExists($IniFile64$)
Set $UninstallExecutable64$ = GetValueFromInifile($IniFile64$,"X86_64","UninstallExecutable64","XXXXXXXX.exe")
Set $UninstallProgramOld64$ = $InstallDir64$ + "\" + $UninstallExecutable64$
if FileExists($UninstallProgramOld64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_old_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
endif
if FileExists($UninstallProgram64$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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 "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
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
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
sub_check_exitcode
;set $Reboot$="1"
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_64 /64Bit
comment "Cleanup registry"
Registry_uninstall /64Bit
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_uninstall
endif
endif
comment "Delete program shortcuts"
LinkFolder_uninstall
DefVar $Property_CustomPostUninstall$
Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none")
if not ($Property_CustomPostUninstall$ = "none")
comment "Include custom post uninstall file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$)
sub_CustomPostUninstall
else
LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")"
endif
endif
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
[Winbatch_uninstall_old_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
; "$UninstallProgramOld32$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld32$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_32]
msiexec /x $MsiIdOld32$ /qb-! REBOOT=ReallySuppress
[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_old_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
; "$UninstallProgramOld64$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgramOld64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
[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_old_64]
msiexec /x $MsiIdOld64$ /qb-! REBOOT=ReallySuppress
[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]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; 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$
[DosInAnIcon_FileTypeAssoc_uninstall]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA --unreg AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[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

View File

@ -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"

View File

@ -1,10 +1,6 @@
[X86]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId32={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[X86_64]
MsiId={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
MsiId64={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
[COMMON]
PN=name

View File

@ -0,0 +1,473 @@
; 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 "%ScriptPath%\browserkill.opsiinc"
DefVar $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $CheckOsVersion$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
DefStringList $languageInfo$
set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_FileTypeAssociation$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; -----------------------------------------------------
; Minimal Supported OS (comment all other entries)
set $CheckOsVersion$ = "5.1" ; Windows XP
; set $CheckOsVersion$ = "5.2" ; Windows XP 64
; set $CheckOsVersion$ = "6.0" ; Windows Vista
; set $CheckOsVersion$ = "6.1" ; Windows 7
; set $CheckOsVersion$ = "6.2" ; Windows 8
; set $CheckOsVersion$ = "6.3" ; Windows 8.1
; set $CheckOsVersion$ = "10.0" ; Windows 10
; ----------------------------------------------------------------
; - 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 $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; Check Minimalen OS Version
if not(CompareDotSeparatedNumbers(GetMsVersionInfo, ">=", $CheckOsVersion$))
LogError "This Operating System (" + GetNtVersion + " " + GetSystemType + ") is not supported by this Product (" + $ProductId$ + ")!"
isFatalError
endif
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" $NAME$
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$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 32 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_32
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_32
comment "Copy files"
Files_install_32 /32Bit
comment "Patch Registry"
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install_32
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_32
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " 64 Bit..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_64
;Sub "%ScriptPath%\check_innosetup-exitcode.opsiscript"
;Sub "%ScriptPath%\check_installshield-exitcode.opsiscript"
;Sub "%ScriptPath%\check_nullsoft-exitcode.opsiscript"
;Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Disable Update check"
DosInAnIcon_DisableUpdate_64
comment "Copy files"
Files_install_64 /64Bit
comment "Patch Registry"
Registry_install /64Bit
comment "Create shortcuts"
LinkFolder_install_64
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_64
endif
Set $Property_FileTypeAssociation$ = GetProductProperty("FileTypeAssociation","true")
if ($Property_FileTypeAssociation$ = "true")
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
endif
Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($Property_CustomPostInstall$ = "none")
comment "Include custom post install file"
if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$)
sub_CustomPostInstall
else
LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")"
endif
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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir32$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
[DosInAnIcon_DisbaleUpdate_32]
; Requires horstmuc.inifile
;
; inifile "$InstallDir32$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir32$\config.xml"> "$InstallDir32$\config.model.xml"
[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]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir64$"
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
[DosInAnIcon_DisbaleUpdate_64]
; Requires horstmuc.inifile
;
; inifile "$InstallDir64$\custom.ini" [Updater] AutoUpdate=0
; Requires sourceforge.xmlstarlet
;
; Update value of an attribute
; xml ed -u "/xml/table/rec[@id=3]/@id" -v 5 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir64$\config.xml"> "$InstallDir64$\config.model.xml"
[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_32]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters:
; working_dir: $InstallDir32$
; 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: $InstallDir32$\$ProgramExecutable32$
; parameters: <some_param>
; working_dir: $InstallDir32$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_64]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "$NAME$"
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters:
; working_dir: $InstallDir64$
; 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: $InstallDir64$\$ProgramExecutable64$
; parameters: <some_param>
; working_dir: $InstallDir64$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink_32]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir32$\$ProgramExecutable32$"
parameters:
working_dir: $InstallDir32$
icon_file:
icon_index:
end_link
[LinkFolder_install_DesktopLink_64]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir64$\$ProgramExecutable64$"
parameters:
working_dir: $InstallDir64$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
; Set Acrobat Reader DC as Default .pdf reader:
;
; SFTA AcroExch.Document.DC .pdf
;
; Set Sumatra PDF as Default .pdf reader:
;
; SFTA Applications\SumatraPDF.exe .pdf
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[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

View File

@ -0,0 +1,91 @@
; 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 $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
DefVar $IniFile32$
DefVar $MsiIdOld64$
DefVar $UninstallProgram64$
DefVar $UninstallProgramOld64$
DefVar $IniFile64$
DefVar $IniCfgFile$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$
DefVar $Reboot$
DefVar $Property_FileTypeAssociation$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$
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$)

View File

@ -1,5 +1,5 @@
[Package]
version: 2
version: 1
depends:
incremental: False
@ -9,12 +9,12 @@ 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:
@ -30,10 +30,45 @@ description: which architecture (32/64 bit) has to be installed
values: ["32 only", "64 only", "both", "system specific"]
default: ["system specific"]
[ProductProperty]
type: bool
name: FileTypeAssociation
description: File Type Associations on/off
default: True
[ProductProperty]
type: bool
name: DesktopLink
description: Show Desktop Link on/off
default: False
[ProductProperty]
type: unicode
name: custom-post-install
multivalue: False
editable: True
description: Define filename for include script in custom directory after installation
values: ["none"]
default: ["none"]
[ProductProperty]
type: unicode
name: custom-post-uninstall
multivalue: False
editable: True
description: Define filename for include script in custom directory after uninstallation
values: ["none"]
default: ["none"]
[ProductDependency]
action: setup
requiredProduct: sereby.aio
requiredStatus: installed
requirementType: before
[ProductDependency]
action: setup
requiredProduct: danysys.sfta
requiredStatus: installed
requirementType: before

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0

View File

@ -58,7 +58,7 @@ TYPE="public"
# - Compression format
# If the retrieved file is compressed, the compression format is specified to
# extract it. If the parameter is not set, no extraction happens
# Optional parameter. Valid values: unzip, 7zip. Default value: <not set>.
# Optional parameter. Valid values: unzip, 7zip, unrar, lha, targz, tarbz2, cab . Default value: <not set>.
# DL_EXTRACT_FORMAT="zip"
#
# - Extraction directory for compressed files
@ -98,6 +98,26 @@ DL_EXTRACT_TO[3]="office"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
#######################################
# specify Executable for Desktop link
#######################################
on 32bit or 64bit packages
WINST_NAME[0]="ProgramExecutable"
WINST_VALUE[0]="7z.exe"
######################################
on the dual arch package
WINST_NAME[0]="ProgramExecutable32"
WINST_VALUE[0]="7z.exe"
# AND
WINST_NAME[1]="ProgramExecutable64"
WINST_VALUE[1]="7z.exe"
#########################
# Setup additional, custom WINST variables
# which will be injected to the *.ins files (replaces token @@BUILDER_VARIABLES@@ )
@ -110,11 +130,11 @@ ICON_DL_INDEX=0
# results in "%ScriptPath%\X86_64\svcpack\aio-runtimes.exe"
#
#########################
WINST_NAME[0]="InstallExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="InstallExe"
WINST_VALUE[1]="@DL_EXTRACT_WINST_PATH[2]@\\svcpack\\aio-runtimes.exe"
WINST_NAME[1]="MyVar"
WINST_VALUE[1]="My content"
WINST_NAME[2]="MyVar"
WINST_VALUE[3]="My content"
#########################
# Setup required OPSI_INI variables
@ -126,6 +146,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 +157,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]="UninstallExecutable"
OPSI_INI_VALUE[0]="uninstall.exe"
# OR
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable"
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 +184,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]="UninstallExecutable32"
OPSI_INI_VALUE[0]="uninstall.exe"
# AND
OPSI_INI_SECTION[1]="X86_64"
OPSI_INI_OPTION[1]="UninstallExecutable64"
OPSI_INI_VALUE[1]="uninstall.exe"

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -0,0 +1,53 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Setup was successfully run to completion."
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Setup failed to initialize."
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel in the wizard before the actual installation started, or chose "No" on the opening "This will install..." message box."
isFatalError
endif
if ($ExitCode$ = "3")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred while preparing to move to the next installation phase (for example, from displaying the pre-installation wizard pages to the actual installation process). This should never happen except under the most unusual of circumstances, such as running out of memory or Windows resources."
isFatalError
endif
if ($ExitCode$ = "4")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" A fatal error occurred during the actual installation process."
isFatalError
endif
if ($ExitCode$ = "5")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The user clicked Cancel during the actual installation process, or chose Abort at an Abort-Retry-Ignore box."
isFatalError
endif
if ($ExitCode$ = "6")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" The Setup process was forcefully terminated by the debugger (Run | Terminate was used in the IDE)."
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,92 @@
;Request Exitcode of last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Success"
setLogLevel = 4
endif
if ($ExitCode$ = "-1")
logError "ExitCode = "+$ExitCode$+" General error"
isFatalError
endif
if ($ExitCode$ = "-2")
logError "ExitCode = "+$ExitCode$+" Invalid mode"
isFatalError
endif
if ($ExitCode$ = "-3")
logError "ExitCode = "+$ExitCode$+" Required data not found in the Setup.iss file"
isFatalError
endif
if ($ExitCode$ = "-4")
logError "ExitCode = "+$ExitCode$+" Not enough memory available"
isFatalError
endif
if ($ExitCode$ = "-5")
logError "ExitCode = "+$ExitCode$+" File does not exist"
isFatalError
endif
if ($ExitCode$ = "-6")
logError "ExitCode = "+$ExitCode$+" Cannot write to the response file"
isFatalError
endif
if ($ExitCode$ = "-7")
logError "ExitCode = "+$ExitCode$+" Unable to write to the log file"
isFatalError
endif
if ($ExitCode$ = "-8")
logError "ExitCode = "+$ExitCode$+" Invalid path to the InstallShield Silent response file"
isFatalError
endif
if ($ExitCode$ = "-9")
logError "ExitCode = "+$ExitCode$+" Not a valid list type (string or number)"
isFatalError
endif
if ($ExitCode$ = "-10")
logError "ExitCode = "+$ExitCode$+" Data type is invalid"
isFatalError
endif
if ($ExitCode$ = "-11")
logError "ExitCode = "+$ExitCode$+" Unknown error during setup"
isFatalError
endif
if ($ExitCode$ = "-12")
logError "ExitCode = "+$ExitCode$+" Dialogs are out of order"
isFatalError
endif
if ($ExitCode$ = "-51")
logError "ExitCode = "+$ExitCode$+" Cannot create the specified folder"
isFatalError
endif
if ($ExitCode$ = "-52")
logError "ExitCode = "+$ExitCode$+" Cannot access the specified file or folder"
isFatalError
endif
if ($ExitCode$ = "-53")
logError "ExitCode = "+$ExitCode$+" Invalid option selected"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

View File

@ -0,0 +1,29 @@
;Request ExitCode from last Program
set $ExitCode$ = getLastExitCode
;Modify Loglevel
setLogLevel = 4
;Check ExitCode
if ($ExitCode$ = "0")
setLogLevel = 5
comment "ExitCode = "+$ExitCode$+" Normal execution (no error)"
setLogLevel = 4
endif
if ($ExitCode$ = "1")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by user (cancel button)"
isFatalError
endif
if ($ExitCode$ = "2")
setLogLevel = 5
logError "ExitCode = "+$ExitCode$+" Installation aborted by script"
isFatalError
endif
;Modify Loglevel
setLogLevel = 6

Some files were not shown because too many files have changed in this diff Show More