Skip to content

Commit

Permalink
Added the new product property "auto_config"
Browse files Browse the repository at this point in the history
With the new product property you can use the new silent parameter to keep configurationsfiles during a deinstallation and a reinstall.
If it is set on false, opsi doesnt delete the configuration files and doesnt overwrite the old configuration files. The new configuration files will be saved as File.new

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
xtruthx authored and Marco van Wieringen committed Feb 17, 2015
1 parent e11cbc9 commit 4905d0d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 118 deletions.
33 changes: 2 additions & 31 deletions platforms/opsi/CLIENT_DATA/delsub3264.ins
Expand Up @@ -41,40 +41,11 @@ endif
;LinkFolder_uninstall

[Winbatch_uninstall_32]
"$UninstallProgram32$" /S
"$UninstallProgram32$" /S $keep_config$


[Winbatch_uninstall_64]
"$UninstallProgram64$" /S


[Files_uninstall_32]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
; delete -sf "$InstallDir32$\"


[Files_uninstall_64]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
; delete -sf "$InstallDir64$\"

[Registry_uninstall]
; Example of deleting a registry key:
;
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
; delete_subfolder $ProductId$
;
; Example of deleting a shortcut from AllUsers desktop:
;
; set_basefolder common_desktopdirectory
; set_subfolder ""
; delete_element $ProductId$
"$UninstallProgram64$" /S $keep_config$

[Sub_check_exitcode]
comment "Test for installation success via exit code"
Expand Down
94 changes: 28 additions & 66 deletions platforms/opsi/CLIENT_DATA/setup3264.ins
Expand Up @@ -12,6 +12,7 @@ DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$
DefVar $ProductName$
DefVar $ProductExe32$
DefVar $ProductExe64$
DefVar $MinimumSpace$
Expand All @@ -30,31 +31,25 @@ DefVar $filedaemon_client_address$
DefVar $director_name$
DefVar $director_address$
DefVar $director_password$
DefVar $keep_config$
DefVar $auto_config$


Set $INST_SystemType$ = GetSystemType
Set $INST_architecture$ = GetProductProperty("install_architecture","system specific")

Set $filedaemon_full_name$ = GetProductProperty( "filedaemon_full_name", "" )
Set $filedaemon_full_password$ = GetProductProperty( "filedaemon_full_password", "filedaemon_full_password" )
Set $filedaemon_monitor_name$ = GetProductProperty( "filedaemon_monitor_name", "filedaemon_monitor_name" )
Set $filedaemon_monitor_password$ = GetProductProperty( "filedaemon_monitor_password", "filedaemon_monitor_password" )
Set $filedaemon_client_address$ = GetProductProperty( "filedaemon_client_address", "")
Set $director_name$ = GetProductProperty( "director_name", "director_name" )
Set $director_address$ = GetProductProperty( "director_address", "director_address" )
Set $director_password$ = GetProductProperty( "director_password", "director_password" )

Set $LogDir$ = "%SystemDrive%\tmp"


; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts,
; no white space use '-' as a seperator
Set $ProductId$ = "winbareos"
Set $ProductExe32$ = "data\winbareos-12.4.4-32-bit-r510.4.exe"
Set $ProductExe64$ = "data\winbareos-12.4.4-64-bit-r510.4.exe"
Set $ProductExe32$ = "data\winbareos-12.4.4-32-bit-r512.1.exe"
Set $ProductExe64$ = "data\winbareos-12.4.4-64-bit-r512.1.exe"
Set $MinimumSpace$ = "30 MB"
; the path were we find the product after the installation
Set $InstallDir$ = "%ProgramFilesDir%\Bareos"
Expand All @@ -68,8 +63,18 @@ if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
; Stop process and set installation status to failed
endif


Set $auto_config$ = lower( GetProductProperty("auto_config", "true"))

if $auto_config$ = "true"
set $ProductName$ = $ProductId$ + " (auto config)"
else
set $keep_config$ = "/SILENTKEEPCONFIG"
set $ProductName$ = $ProductId$
endif

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

if FileExists("%ScriptPath%\delsub3264.ins")
comment "Start uninstall sub section"
Expand All @@ -78,16 +83,25 @@ endif

comment "installing"

Set $filedaemon_full_password$ = GetProductProperty( "filedaemon_full_password", "filedaemon_full_password" )
Set $filedaemon_monitor_password$ = GetProductProperty( "filedaemon_monitor_password", "filedaemon_monitor_password" )
Set $director_name$ = GetProductProperty( "director_name", "director_name" )
Set $director_address$ = GetProductProperty( "director_address", "director_address" )
Set $director_password$ = GetProductProperty( "director_password", "director_password" )

Set $filedaemon_full_name$ = GetProductProperty( "filedaemon_full_name", "" )
if $filedaemon_full_name$ = ""
set $filedaemon_full_name$ = "%HostID%-fd"
opsiservicecall_set_product_property_filedaemon_full_name
endif

Set $filedaemon_monitor_name$ = GetProductProperty( "filedaemon_monitor_name", "filedaemon_monitor_name" )
if $filedaemon_monitor_name$ = ""
set $filedaemon_monitor_name$ = "%HostID%-mon"
opsiservicecall_set_product_property_filedaemon_monitor_name
endif

Set $filedaemon_client_address$ = GetProductProperty( "filedaemon_client_address", "")
if $filedaemon_client_address$ = ""
set $filedaemon_client_address$ = "%HostID%"
opsiservicecall_set_product_property_filedaemon_client_address
Expand Down Expand Up @@ -134,11 +148,11 @@ endif
; don't use " around argument, otherwise argument is ignored

[Winbatch_install_32]
"%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$
"%ScriptPath%\$ProductExe32$" /S $keep_config$ /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%\$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$
"%ScriptPath%\$ProductExe64$" /S $keep_config$ /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]
Expand Down Expand Up @@ -169,58 +183,6 @@ endif
]


[Files_install_32]
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"

[Files_install_64]
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"

[Registry_install]
; Example of setting some values of an registry key:
;
; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
; set "name1" = "some string value"
; set "name2" = REG_DWORD:0001
; set "name3" = REG_BINARY:00 af 99 cd
[LinkFolder_install]
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
; delete_subfolder $ProductId$
;
; Example of creating an shortcut to the installed exe in AllUsers startmenu:
;
; set_basefolder common_programs
; set_subfolder $ProductId$
;
; set_link
; name: $ProductId$
; target: <path to the program>
; parameters:
; working_dir: $InstallDir$
; icon_file:
; icon_index:
; end_link
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
; set_basefolder common_desktopdirectory
; set_subfolder ""
;
; set_link
; name: $ProductId$
; target: <path to the program>
; parameters: <some_param>
; working_dir: $InstallDir$
; icon_file: <path to icon file>
; icon_index: 2
; end_link
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
Expand Down
35 changes: 14 additions & 21 deletions platforms/opsi/CLIENT_DATA/uninstall3264.ins
Expand Up @@ -13,10 +13,13 @@ DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $ProductName$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $auto_config$
DefVar $keep_config$
DefVar $INST_SystemType$
DefVar $INST_architecture$

Expand All @@ -32,13 +35,21 @@ Set $LogDir$ = "%SystemDrive%\tmp"
Set $ProductId$ = "bareos"
Set $InstallDir32$ = "%ProgramFiles32Dir%\Bareos"
Set $InstallDir64$ = "%ProgramFiles64Dir%\Bareos"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
;Set $LicenseRequired$ = "false"
;Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------

Set $auto_config$ = lower( GetProductProperty("auto_config", "true"))

if $auto_config$ = "true"
set $ProductName$ = $ProductId$ + " (auto config)"
else
set $keep_config$ = "/SILENTKEEPCONFIG"
set $ProductName$ = $ProductId$
endif

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

Message "Uninstalling " + $ProductId$ + " ..."

Expand All @@ -47,21 +58,3 @@ if FileExists("%ScriptPath%\delsub3264.ins")
Sub "%ScriptPath%\delsub3264.ins"
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$)
12 changes: 12 additions & 0 deletions platforms/opsi/OPSI/control
Expand Up @@ -21,6 +21,15 @@ onceScript:
customScript:
userLoginScript:

[ProductProperty]
type: unicode
name: auto_config
multivalue: False
editable: False
description: if true, Bareos configuration gets generated from Opsi properties
values: ["false", "true"]
default: ["true"]

[ProductProperty]
type: unicode
name: filedaemon_full_name
Expand Down Expand Up @@ -95,6 +104,9 @@ values: ["32 only", "64 only", "both", "system specific"]
default: ["system specific"]

[Changelog]
20130627, Daniel Neuberger
* added ProductProperty Update_KeepConfig

20130215, Joerg Steffens
* adapted to be build with http://build.opensuse.org

Expand Down

0 comments on commit 4905d0d

Please sign in to comment.