User Tools

Site Tools


userspace:zygrib

zyGrib

Tested with opsi 4.2
Windows 10 x64 Ent SAC 19.09, 20H2 & 21H2
Download zyGrib from here: https://www.zygrib.org/

type: localboot
id: zyGrib
description: GRIB File Viewer - Weather data visualization
Beschreibung: GRIB File Viewer -Grafische Darstellung von Wetterdaten

Hinweis: zyGrib liegt nicht als klassischer Installer vor. Es handelt sich um ein gepacktes Programm welches an die gewünschte Stelle, sprich das Installationsverzeichnis, entpackt wird. Ich habe zum entpacken das Programm 7-Zip verwendet, welches entsprechend Vorraussetzung ist damit dieses Script funktioniert. Anschließend wird einfach ein Link im Startmenü zur ausführbaren Datei erstellt über welchen das Programm gestartet anschließend werden kann. Zum Ausführen des Programms zyGrib benötigt die entsprechende Benutzergruppe “ändern” Recht. Daher sollte an dieser Stelle im Script “setup.opsiscript”:

[DosInAnIcon_rights]
icacls "$InstallDir$" /T /grant Benutzer:(OI)(CI)(M)

der Benutzer an die gewünschte Benutzergruppe, welche das Programm ausführen können soll, angepaßt werden.

Notice: zyGrib is not available as a classic installer. It is a packed program which only needs to be unpacked to the desired location, in this case the installation directory. I used the 7-Zip program to unpack, which is a prerequisite for this script to work. A link is then simply created in the start menu to the executable file, which starts the program. To run the zyGrib program, the corresponding user group needs “change” rights. Therefore, at this point in the script “setup.opsiscript”:

[DosInAnIcon_rights]
icacls "$InstallDir$" /T /grant Benutzer:(OI)(CI)(M)

the Benutzer needs to be adapted to the desired user group that should be able to run the program.

tree:
|-- setup.opsiscript
|-- uninstall.opsiscript
|-- zyGrib_win_withmaps2-8.0.1.zip
|-- zyGrib_32.png



setup.opsiscript

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
[Initial]
setLogLevel=6
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
 
[Actions]
requiredWinstVersion >= "4.11.3.11"
 
; ----------------------------------------------------------------
; - define Variables			                           		 -
; ----------------------------------------------------------------
DefVar $ProductId$
DefVar $Version$
DefVar $LogDir$
DefVar $MinimumSpace$
DefVar $INST_architecture$
DefVar $INST_SystemType$
DefVar $INST_MsVersion$
DefVar $7zPrg$
DefVar $7zCall$
DefVar $OSVersion$
DefVar $InstallDir$
DefVar $Product_Pic$
DefVar $ExitCode$
DefVar $TestResult$
DefVar $zyGribZip$
DefVar $LinkFolder_Prog$
DefVar $Link_Prog_Name$
DefVar $Link_WorkingDir$
DefVar $Link_TargetProg$
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Setting fixed Variables          						     -
; ----------------------------------------------------------------
Set $INST_SystemType$ = GetSystemType
Set $INST_MsVersion$ = GetMsVersionInfo
Set $OSVersion$ = "7.0"
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$			= "zyGrib"
Set $Version$			= "8.0.1"
Set $MinimumSpace$		= "500 MB"
; the path were we find the product after the installation
Set $InstallDir$		= "c:\zyGrib"
Set $zyGribZip$			= "%ScriptPath%\zyGrib_win_withmaps2-8.0.1.zip"
Set $7zPrg$			= "%ProgramFilesSysnativeDir%\7-Zip\7z.exe"
Set $7zCall$			= "x -y "+$zyGribZip$+" -o"+$InstallDir$
Set $Product_Pic$		= "zyGrib_32.png"
; for Start Menue entry
Set $LinkFolder_Prog$		= "zyGrib-Win"
Set $Link_Prog_Name$		= "zyGrib"
Set $Link_WorkingDir$		= $InstallDir$+"\zyGrib_win"
Set $Link_TargetProg$		= $Link_WorkingDir$+"\zyGrib.exe"
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Check System Requierements                                   -
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError "Drive Space"
	; Stop process and set installation status to failed
endif
 
if CompareDotSeparatedNumbers($INST_MsVersion$,"<",$OSVersion$)
	LogError "Wrong OS Version. At least Windows 7 is required for installation!"
	isFatalError "OS Version"
	; Stop process and set installation status to failed
endif
 
if not(FileExists($7zPrg$))
	LogError "7-Zip not found in default Installation destination " + $7zPrg$ + ". Check 7-Zip installation."
	isFatalError "7-Zip missing"
endif
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Installation                                                 -
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $Product_Pic$ $ProductId$
 
if ($INST_SystemType$ = "x86 System")
	Message "Installing " + $ProductId$ + $Version$ + " on 32 Bit OS."
	WinBatch_Install
	Set $ExitCode$ = getLastExitCode
	if ($ExitCode$ = "0")
		comment "Unpack of Zip File successful."
	else
		if ($ExitCode$ = "7")
			LogError "7-Zip Command Line Error. Exit Code" + $ExitCode$ + " returned."
			isFatalError "7-Zip CLI Error"
		else
			LogError "Unpack of Zip File erroneous. Exitcode " + $ExitCode$ + " returned."
			isFatalError "Unpack erroneous"
		endif
	endif
	DosInAnIcon_rights
	LinkFolder_install
endif
 
if ($INST_SystemType$ = "64 Bit System")
	Message "Installing " + $ProductId$ + $Version$ + " on 64 Bit OS."
	WinBatch_Install
	Set $ExitCode$ = getLastExitCode
	if ($ExitCode$ = "0")
		comment "Unpack of Zip File successful."
	else
		if ($ExitCode$ = "7")
			LogError "7-Zip Command Line Error. Exit Code" + $ExitCode$ + " returned."
			isFatalError "7-Zip CLI Error"
		else
			LogError "Unpack of Zip File erroneous. Exitcode " + $ExitCode$ + " returned."
			isFatalError "Unpack erroneous"
		endif
	endif
	DosInAnIcon_rights
	LinkFolder_install
endif
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Sub's                                      			         -
; ----------------------------------------------------------------
 
[WinBatch_Install]
"$7zPrg$" $7zCall$
 
[DosInAnIcon_rights]
icacls "$InstallDir$" /T /grant Benutzer:(OI)(CI)(M)
 
[LinkFolder_install]
set_basefolder common_programs
 
; Link for User Information
set_subfolder $LinkFolder_Prog$
 
set_link
	name: $Link_Prog_Name$
	target: $Link_TargetProg$
	parameters:
	working_dir: $Link_WorkingDir$
	icon_file:
	icon_index:
end_link

uninstall.opsiscript

[Initial]
setLogLevel=6
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
 
[Actions]
requiredWinstVersion >= "4.11.3.11"
 
; ----------------------------------------------------------------
; - define Variables			                           		 -
; ----------------------------------------------------------------
DefVar $ProductId$
DefVar $Version$
DefVar $LogDir$
DefVar $MinimumSpace$
DefVar $INST_architecture$
DefVar $INST_SystemType$
DefVar $INST_MsVersion$
DefVar $OSVersion$
DefVar $InstallDir$
DefVar $Product_Pic$
DefVar $LinkFolder_Prog$
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Setting fixed Variables          						     -
; ----------------------------------------------------------------
Set $INST_SystemType$ = GetSystemType
Set $INST_MsVersion$ = GetMsVersionInfo
Set $OSVersion$ = "7.0"
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$			= "zyGrib"
Set $Version$			= "8.0.1"
Set $MinimumSpace$		= "500 MB"
; the path were we find the product after the installation
Set $InstallDir$		= '"c:\zyGrib"'
Set $Product_Pic$		= "zyGrib.png"
; for Start Menue entry
Set $LinkFolder_Prog$		= "zyGrib-Win"
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Check System Requierements                                   -
; ----------------------------------------------------------------
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
endif
 
if CompareDotSeparatedNumbers($INST_MsVersion$,"<",$OSVersion$)
	LogError "Wrong OS Version. At least Windows 7 is required for deinstallation!"
	isFatalError
	; Stop process and set installation status to failed
endif
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Installation                                                 -
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $Product_Pic$ $ProductId$
 
if ($INST_SystemType$ = "x86 System")
	Message "Deinstalling " + $ProductId$ + $Version$ + " on 32 Bit OS."
	Files_delete
	LinkFolder_remove
endif
 
if ($INST_SystemType$ = "64 Bit System")
	Message "Deinstalling " + $ProductId$ + $Version$ + " on 64 Bit OS."
	Files_delete
	LinkFolder_remove
endif
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Sub's                                      			         -
; ----------------------------------------------------------------
 
[Files_delete]
del -sf $InstallDir$
 
[LinkFolder_remove]
set_basefolder common_startmenu
delete_subfolder $LinkFolder_Prog$

control

[Package]
version: 1
depends: 
 
[Product]
type: localboot
id: zyGrib
name: zyGrib mit Kartendaten
description: zyGrib - Programm zum anzeigen von Wetterdaten - Win 32 & 64 Bit
advice: 7-Zip muss vor Installation installiert sein
version: 8.0.1
priority: 0
licenseRequired: False
productClasses: 
setupScript: setup.opsiscript
uninstallScript: uninstall.opsiscript
updateScript: 
alwaysScript: 
onceScript: 
customScript: 
userLoginScript: 
 
[ProductDependency]
action: setup
requiredProduct: 7-Zip
requiredStatus: installed
requirementType: before
 
[Changelog]
zyGrib (1.0-1) stable; urgency=low
 
Project created with opsi Package Builder 8.4.4
userspace/zygrib.txt · Last modified: 2023/01/10 16:42 by chris_10