Skip to content

Commit

Permalink
create OPSI package for winbareos
Browse files Browse the repository at this point in the history
Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
joergsteffens authored and Marco van Wieringen committed Feb 17, 2015
1 parent d5cb1ca commit 10d5cff
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 302 deletions.
22 changes: 0 additions & 22 deletions platforms/opsi/CLIENT_DATA/delsub3264.ins
Expand Up @@ -4,10 +4,7 @@
; credits: http://www.opsi.org/en/credits/


;Set $MsiId32$ = 'Bareos'
Set $UninstallProgram32$ = $InstallDir32$ + "\uninst.exe"

;Set $MsiId64$ = 'Bareos'
Set $UninstallProgram64$ = $InstallDir64$ + "\uninst.exe"

if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
Expand All @@ -19,12 +16,6 @@ if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specif
sub_check_exitcode
endif

;if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "")
; comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
; Winbatch_uninstall_msi_32
; sub_check_exitcode
;endif

;comment "Delete files"
;Files_uninstall_32 /32Bit
;comment "Cleanup registry"
Expand All @@ -40,12 +31,6 @@ if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system spe
sub_check_exitcode
endif

;if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "")
; comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall"
; Winbatch_uninstall_msi_64
; sub_check_exitcode
;endif

;comment "Delete files"
;Files_uninstall_64 /64Bit
;comment "Cleanup registry"
Expand All @@ -63,19 +48,12 @@ endif
"$UninstallProgram64$" /S


[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_msi_64]
msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress

[Files_uninstall_64]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
Expand Down
105 changes: 10 additions & 95 deletions platforms/opsi/CLIENT_DATA/setup3264.ins
Expand Up @@ -12,16 +12,13 @@ DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$
DefVar $ProductVer$
DefVar $ReleaseVer$
DefVar $ProductExe32$
DefVar $ProductExe64$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$

Expand Down Expand Up @@ -55,16 +52,14 @@ Set $LogDir$ = "%SystemDrive%\tmp"
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts,
; no white space use '-' as a seperator
Set $ProductId$ = "bareos"
Set $ProductVer$ = "12.4.1"
Set $ReleaseVer$ = "r1.1.exe"
Set $MinimumSpace$ = "30 MB"
Set $ProductId$ = "winbareos"
Set $ProductExe32$ = "winbareos32.exe"
Set $ProductExe64$ = "winbareos64.exe"
Set $MinimumSpace$ = "30 MB"
; the path were we find the product after the installation
Set $InstallDir$ = "%ProgramFilesDir%\Bareos"
Set $InstallDir32$ = "%ProgramFiles32Dir%\Bareos"
Set $InstallDir64$ = "%ProgramFiles64Dir%\Bareos"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
Expand All @@ -74,18 +69,13 @@ if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
endif

comment "Show product picture"
ShowBitmap "%ScriptPath%\logo.png" $ProductId$
ShowBitmap "%ScriptPath%\logo.png" "Bareos"

if FileExists("%ScriptPath%\delsub3264.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub3264.ins"
endif

;if $LicenseRequired$ = "true"
; comment "Licensing required, reserve license and get license key"
; Sub_get_licensekey
;endif

comment "installing"

if $filedaemon_full_name$ = ""
Expand Down Expand Up @@ -131,9 +121,6 @@ if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system spe
;LinkFolder_install
endif

;Patches_bareos_conf $InstallDir$+"\bareos-fd.conf"
;DosBatch_bareos-fd.conf

;
; end
;
Expand All @@ -147,52 +134,12 @@ endif
; don't use " around argument, otherwise argument is ignored

[Winbatch_install_32]
"%ScriptPath%\data\winbareos-$ProductVer$-32-bit-$ReleaseVer$" /S /CLIENTNAME=$filedaemon_full_name$ /CLIENTPASSWORD=$filedaemon_full_password$ /DIRECTORNAME=$director_name$ /CLIENTADDRESS=$filedaemon_client_address$ /CLIENTMONITORPASSWORD=$filedaemon_monitor_password$ /DIRECTORADDRESS=$director_address$ /DIRECTORPASSWORD=$director_password$ /D=$InstallDir32$
"%ScriptPath%\$ProductExe32$" /S /CLIENTNAME=$filedaemon_full_name$ /CLIENTPASSWORD=$filedaemon_full_password$ /DIRECTORNAME=$director_name$ /CLIENTADDRESS=$filedaemon_client_address$ /CLIENTMONITORPASSWORD=$filedaemon_monitor_password$ /DIRECTORADDRESS=$director_address$ /DIRECTORPASSWORD=$director_password$ /D=$InstallDir32$


[Winbatch_install_64]
"%ScriptPath%\data\winbareos-$ProductVer$-64-bit-$ReleaseVer$" /S /CLIENTNAME=$filedaemon_full_name$ /CLIENTPASSWORD=$filedaemon_full_password$ /DIRECTORNAME=$director_name$ /CLIENTADDRESS=$filedaemon_client_address$ /CLIENTMONITORPASSWORD=$filedaemon_monitor_password$ /DIRECTORADDRESS=$director_address$ /DIRECTORPASSWORD=$director_password$ /D=$InstallDir64$


;[DosBatch_bareos-fd.conf]
;(
;echo # managed by opsi
;echo #
;echo # "Global" File daemon configuration specifications
;echo #
;echo FileDaemon { # this is me
;echo Name = $filedaemon_full_name$
;echo FDport = 9102 # where we listen for the director
;echo WorkingDirectory = "$InstallDir32$\\working"
;echo Pid Directory = "$InstallDir32$\\working"
;echo Plugin Directory = "$InstallDir32$\\plugins"
;echo Maximum Concurrent Jobs = 10
;echo }
;echo
;echo #
;echo # List Directors who are permitted to contact this File daemon
;echo #
;echo Director {
;echo Name = $director_name$
;echo Password = "$filedaemon_full_password$"
;echo }
;echo
;echo #
;echo # Restricted Director, used by tray-monitor to get the
;echo # status of the file daemon
;echo #
;echo Director {
;echo Name = $filedaemon_monitor_name$
;echo Password = "$filedaemon_monitor_password$"
;echo Monitor = yes
;echo }
;echo
;echo # Send all messages except skipped files back to Director
;echo Messages {
;echo Name = Standard
;echo director = $director_name$ = all, !skipped, !restored
;echo }
;) >> $InstallDir$/bareos-fd.conf
"%ScriptPath%\$ProductExe64$" /S /CLIENTNAME=$filedaemon_full_name$ /CLIENTPASSWORD=$filedaemon_full_password$ /DIRECTORNAME=$director_name$ /CLIENTADDRESS=$filedaemon_client_address$ /CLIENTMONITORPASSWORD=$filedaemon_monitor_password$ /DIRECTORADDRESS=$director_address$ /DIRECTORPASSWORD=$director_password$ /D=$InstallDir64$


[opsiservicecall_set_product_property_filedaemon_full_name]
"method": "setProductProperty",
Expand Down Expand Up @@ -274,38 +221,6 @@ endif
; icon_index: 2
; end_link
[Sub_get_licensekey]
comment "License management is enabled and will be used"
comment "Trying to get a license key"
Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
; If there is an assignment of exactly one licensepool to the product the following call is possible:
; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use:
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
DefVar $ServiceErrorClass$
set $ServiceErrorClass$ = getLastServiceErrorClass
comment "Error class: " + $ServiceErrorClass$
if $ServiceErrorClass$ = "None"
comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
else
if $ServiceErrorClass$ = "LicenseConfigurationError"
LogError "Fatal: license configuration must be corrected"
LogError getLastServiceErrorMessage
isFatalError
else
if $ServiceErrorClass$ = "LicenseMissingError"
LogError "Fatal: required license is not supplied"
isFatalError
endif
endif
endif
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
Expand Down

0 comments on commit 10d5cff

Please sign in to comment.