Skip to content

Commit

Permalink
compatible mode can now be set during install
Browse files Browse the repository at this point in the history
Now during install the setting of compatible can be
chosen in a checkbox and on the cmdline for silent install.

compatible is still enabled by default, but it can be disabled
during install.

fixes #235: offer setting of compatible setting of client during install

Signed-off-by: Marco van Wieringen <marco.van.wieringen@bareos.com>
  • Loading branch information
pstorz authored and Marco van Wieringen committed Feb 17, 2015
1 parent 3505f3b commit c3b49c4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
22 changes: 20 additions & 2 deletions platforms/win32/clientdialog.ini
@@ -1,14 +1,14 @@
;Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=14
NumFields=16

[Field 1]
Type=Groupbox
Text=Configuration of the Bareos Client
Left=0
Right=300
Top=0
Bottom=132
Bottom=140

[Field 2]
Type=Text
Expand Down Expand Up @@ -111,3 +111,21 @@ Left=100
Right=290
Top=71
Bottom=84


[Field 15]
Type=Label
Text=Bacula compatibility
Left=10
Right=90
Top=128
Bottom=136

[Field 16]
Type=Checkbox
Text=compatible (new bareos features cannot be used)
Left=100
Right=290
Top=128
Bottom=136
State=1
24 changes: 15 additions & 9 deletions platforms/win32/winbareos.nsi
Expand Up @@ -44,6 +44,7 @@ Var ClientName #XXX_REPLACE_WITH_HOSTNAME_XXX
Var ClientPassword #XXX_REPLACE_WITH_FD_PASSWORD_XXX
Var ClientMonitorPassword #XXX_REPLACE_WITH_FD_MONITOR_PASSWORD_XXX
Var ClientAddress #XXX_REPLACE_WITH_FD_MONITOR_PASSWORD_XXX
Var ClientCompatible # is client compatible?

# Needed for bconsole and bat:
Var DirectorAddress #XXX_REPLACE_WITH_HOSTNAME_XXX
Expand Down Expand Up @@ -295,6 +296,11 @@ Section -SetPasswords
FileWrite $R1 "s#XXX_REPLACE_WITH_HOSTNAME_XXX#$DirectorAddress#g$\r$\n"
FileWrite $R1 "s#XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX#$DirectorPassword#g$\r$\n"

# if we do not want to be compatible we uncomment the setting for compatible
#
${If} $ClientCompatible != ${BST_CHECKED}
FileWrite $R1 "s@# compatible@compatible@g$\r$\n"
${EndIf}
FileClose $R1


Expand All @@ -317,7 +323,6 @@ Section -SetPasswords
# FileWrite $R1 '}$\n'
#
# FileClose $R1
#
SectionEnd

Section "Bareos Client (FileDaemon) and base libs" SEC_CLIENT
Expand Down Expand Up @@ -466,7 +471,7 @@ SectionEnd
Section -StartDaemon
nsExec::ExecToLog "net start bareos-fd"
${If} ${SectionIsSelected} ${SEC_TRAYMON}
MessageBox MB_OK|MB_ICONINFORMATION "The tray monitor will be started automatically on next login" /SD IDOK
MessageBox MB_OK|MB_ICONINFORMATION "The tray monitor will be started automatically on next login. $\r$\n Alternatively it can be started from the start menu entry now." /SD IDOK
${EndIf}
SectionEnd

Expand Down Expand Up @@ -626,6 +631,7 @@ done:
[/DIRECTORNAME=Name of Director to access the client and of the Director accessed by bconsole/BAT] $\r$\n\
[/CLIENTADDRESS=Network Address of the client] $\r$\n\
[/CLIENTMONITORPASSWORD=Password for monitor access] $\r$\n\
[/CLIENTCOMPATIBLE=(0/1) client compatible setting (0=no,1=yes)]$\r$\n\
$\r$\n\
[/DIRECTORADDRESS=Network Address of the Director (for bconsole or BAT)] $\r$\n\
[/DIRECTORPASSWORD=Password to access Director]$\r$\n\
Expand Down Expand Up @@ -653,6 +659,9 @@ done:
${GetOptions} $cmdLineParams "/CLIENTMONITORPASSWORD=" $ClientMonitorPassword
ClearErrors

${GetOptions} $cmdLineParams "/CLIENTCOMPATIBLE=" $ClientCompatible
ClearErrors

${GetOptions} $cmdLineParams "/DIRECTORADDRESS=" $DirectorAddress
ClearErrors

Expand Down Expand Up @@ -731,11 +740,6 @@ done:



# MessageBox MB_OK "RandomPassword: $ClientPassword"
# MessageBox MB_OK "RandomPassword: $ClientMonitorPassword"



# if the variables are not empty (because of cmdline params),
# dont set them with our own logic but leave them as they are
strcmp $ClientName "" +1 +2
Expand Down Expand Up @@ -772,13 +776,15 @@ strcmp $Upgrading "yes" skip
${If} ${SectionIsSelected} ${SEC_CLIENT}
InstallOptions::dialog $PLUGINSDIR\clientdialog.ini
Pop $R0
ReadINIStr $ClientName "$PLUGINSDIR\clientdialog.ini" "Field 2" "state"
ReadINIStr $ClientName "$PLUGINSDIR\clientdialog.ini" "Field 2" "state"
ReadINIStr $DirectorName "$PLUGINSDIR\clientdialog.ini" "Field 3" "state"
ReadINIStr $ClientPassword "$PLUGINSDIR\clientdialog.ini" "Field 4" "state"
ReadINIStr $ClientMonitorPassword "$PLUGINSDIR\clientdialog.ini" "Field 14" "state"
ReadINIStr $ClientAddress "$PLUGINSDIR\clientdialog.ini" "Field 5" "state"
ReadINIStr $ClientCompatible "$PLUGINSDIR\clientdialog.ini" "Field 16" "state"

${EndIf}
# MessageBox MB_OK "$ClientName$\r$\n$ClientPassword$\r$\n$ClientMonitorPassword "
# MessageBox MB_OK "Compatible:$\r$\n$Compatible"

skip:
Pop $R0
Expand Down

0 comments on commit c3b49c4

Please sign in to comment.