StrCpy $R2 "$OldInstallDir\Doc"
WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "An old installation has been found in $OldInstallDir. The Configuration will be migrated. Please choose the installation type for any additional components you select."
- WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" 'The software will be installed in the default directory "$PROGRAMFILES\Bacula". The configuration files for additional components will be generated using defaults applicable to most installations.'
+ WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"$PROGRAMFILES\Bacula$\". The configuration files for additional components will be generated using defaults applicable to most installations."
WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You may choose the installation directory. The configuration defaults will be displayed and you will be given the chance to make changes before the configuration files are written."
${EndIf}
${Else}
; New Install
StrCpy $InstallType ${NewInstall}
- WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" 'The software will be installed in the default directory "$PROGRAMFILES\Bacula". The configuration files will be generated using defaults applicable to most installations.'
+ WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"$PROGRAMFILES\Bacula$\". The configuration files will be generated using defaults applicable to most installations."
${EndIf}
${If} $InstallType <> ${NewInstall}
StrCpy $AutomaticInstall 0
${EndIf}
- ${If} $InstallType <> ${NewInstall}
- ${AndIf} $InitialSelectionDone = 0
- StrCpy $InitialSelectionDone 1
-
- IntOp $R1 $PreviousComponents & ${ComponentFile}
- ${If} $R1 <> 0
- !InsertMacro SelectSection ${SecFileDaemon}
- ${Else}
- !InsertMacro UnselectSection ${SecFileDaemon}
- ${EndIf}
- IntOp $R1 $PreviousComponents & ${ComponentStorage}
- ${If} $R1 <> 0
- !InsertMacro SelectSection ${SecStorageDaemon}
- ${Else}
- !InsertMacro UnselectSection ${SecStorageDaemon}
- ${EndIf}
- IntOp $R1 $PreviousComponents & ${ComponentDirector}
- ${If} $R1 <> 0
- !InsertMacro SelectSection ${SecDirectorDaemon}
- ${Else}
- !InsertMacro UnselectSection ${SecDirectorDaemon}
- ${EndIf}
- IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
- ${If} $R1 <> 0
- !InsertMacro SelectSection ${SecConsole}
- ${Else}
- !InsertMacro UnselectSection ${SecConsole}
- ${EndIf}
- IntOp $R1 $PreviousComponents & ${ComponentGUIConsole}
- ${If} $R1 <> 0
- !InsertMacro SelectSection ${SecWxConsole}
- ${Else}
- !InsertMacro UnselectSection ${SecWxConsole}
- ${EndIf}
- IntOp $R1 $PreviousComponents & ${ComponentPDFDocs}
- ${If} $R1 <> 0
- !InsertMacro SelectSection ${SecDocPdf}
- ${Else}
- !InsertMacro UnselectSection ${SecDocPdf}
- ${EndIf}
- IntOp $R1 $PreviousComponents & ${ComponentHTMLDocs}
- ${If} $R1 <> 0
- !InsertMacro SelectSection ${SecDocHtml}
- ${Else}
- !InsertMacro UnselectSection ${SecDocHtml}
- ${EndIf}
- ${EndIf}
-
Pop $R2
Pop $R1
Pop $R0
!include "Sections.nsh"
!include "StrFunc.nsh"
!include "WinMessages.nsh"
-
;
; Basics
;
;
!define MUI_COMPONENTSPAGE_SMALLDESC
-!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_HEADERIMAGE
!define MUI_BGCOLOR 739AB9
!InsertMacro MUI_PAGE_DIRECTORY
Page custom EnterConfigPage1 LeaveConfigPage1
Page custom EnterConfigPage2 LeaveConfigPage2
+!Define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveInstallPage
!InsertMacro MUI_PAGE_INSTFILES
+Page custom EnterWriteTemplates
!Define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
!InsertMacro MUI_PAGE_FINISH
!define UpgradeInstall 1
!define MigrateInstall 2
-Var InitialSelectionDone
Var OldInstallDir
Var PreviousComponents
Var NewComponents
StrCpy $OldInstallDir ""
StrCpy $PreviousComponents 0
StrCpy $NewComponents 0
- StrCpy $InitialSelectionDone 0
${GetParameters} $R0
File "/oname=$PLUGINSDIR\libeay32.dll" "${DEPKGS_BIN}\libeay32.dll"
File "/oname=$PLUGINSDIR\ssleay32.dll" "${DEPKGS_BIN}\ssleay32.dll"
File "/oname=$PLUGINSDIR\sed.exe" "${DEPKGS_BIN}\sed.exe"
- File "/oname=$PLUGINSDIR\InstallType.ini" "InstallType.ini"
+
+ !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "InstallType.ini"
+ !InsertMacro MUI_INSTALLOPTIONS_EXTRACT "WriteTemplates.ini"
SetPluginUnload alwaysoff
LangString TITLE_InstallType ${LANG_ENGLISH} "Installation Type"
LangString SUBTITLE_InstallType ${LANG_ENGLISH} "Choose installation type."
+LangString TITLE_WriteTemplates ${LANG_ENGLISH} "Create Templates"
+LangString SUBTITLE_WriteTemplates ${LANG_ENGLISH} "Create resource templates for inclusion in the Director's configuration file."
+
!InsertMacro MUI_FUNCTION_DESCRIPTION_BEGIN
!InsertMacro MUI_DESCRIPTION_TEXT ${SecFileDaemon} $(DESC_SecFileDaemon)
!InsertMacro MUI_DESCRIPTION_TEXT ${SecStorageDaemon} $(DESC_SecStorageDaemon)
RMDir "$SMPROGRAMS\Bacula"
; remove files and uninstaller (preserving config for now)
- Delete /REBOOTOK "$INSTDIR\bin\*.*"
- Delete /REBOOTOK "$INSTDIR\doc\*.*"
- Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
+ Delete /REBOOTOK "$INSTDIR\bin\*"
+ Delete /REBOOTOK "$INSTDIR\doc\*"
+ Delete /REBOOTOK "$INSTDIR\*"
; Check for existing installation
MessageBox MB_YESNO|MB_ICONQUESTION \
Call DisableServerSections
${EndIf}
+ Call SelectPreviousComponents
Call UpdateComponentUI
FunctionEnd
${EndIf}
FunctionEnd
+Function LeaveInstallPage
+ Push "$INSTDIR\install.log"
+ Call DumpLog
+FunctionEnd
+
+Function EnterWriteTemplates
+ Push $R0
+ Push $R1
+
+ Call GetSelectedComponents
+ Pop $R0
+
+ IntOp $R0 $R0 & ${ComponentDirector}
+ IntOp $R1 $NewComponents & ${ComponentsFileAndStorage}
+
+ ${If} $R0 <> 0
+ ${OrIf} $R1 = 0
+ Pop $R1
+ Pop $R0
+ Abort
+ ${EndIf}
+
+ IntOp $R0 $NewComponents & ${ComponentFile}
+ ${If} $R0 = 0
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 0
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags DISABLED
+ DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
+ ${Else}
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" State 1
+ DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 2" Flags
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 3" State "C:\$ConfigClientName.conf"
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
+ ${EndIf}
+
+ IntOp $R0 $NewComponents & ${ComponentStorage}
+ ${If} $R0 = 0
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 0
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags DISABLED
+ DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST|DISABLED
+ ${Else}
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" State 1
+ DeleteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 4" Flags
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" State "C:\$ConfigStorageName.conf"
+ WriteINIStr "$PLUGINSDIR\WriteTemplates.ini" "Field 5" Flags REQ_SAVE|FILE_EXPLORER|WARN_IF_EXIST
+ ${EndIf}
+
+ !InsertMacro MUI_HEADER_TEXT "$(TITLE_WriteTemplates)" "$(SUBTITLE_WriteTemplates)"
+ !InsertMacro MUI_INSTALLOPTIONS_DISPLAY "WriteTemplates.ini"
+
+ !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 2" State
+ ${If} $R0 <> 0
+ File "/oname=$PLUGINSDIR\client.conf.in" "client.conf.in"
+
+ nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\client.conf.in"'
+ !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 3" State
+ ${If} $R0 != ""
+ CopyFiles "$PLUGINSDIR\client.conf.in" "$R0"
+ ${EndIf}
+ ${EndIf}
+
+ !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 4" State
+ ${If} $R0 <> 0
+ File "/oname=$PLUGINSDIR\storage.conf.in" "storage.conf.in"
+
+ nsExec::ExecToLog '$PLUGINSDIR\sed.exe -f "$PLUGINSDIR\config.sed" -i.bak "$PLUGINSDIR\storage.conf.in"'
+ !InsertMacro MUI_INSTALLOPTIONS_READ $R0 "WriteTemplates.ini" "Field 5" State
+ ${If} $R0 != ""
+ CopyFiles "$PLUGINSDIR\storage.conf.in" "$R0"
+ ${EndIf}
+ ${EndIf}
+
+ Pop $R1
+ Pop $R0
+FunctionEnd
+
+Function SelectPreviousComponents
+ ${If} $InstallType <> ${NewInstall}
+ IntOp $R1 $PreviousComponents & ${ComponentFile}
+ ${If} $R1 <> 0
+ !InsertMacro SelectSection ${SecFileDaemon}
+ !InsertMacro SetSectionFlag ${SecFileDaemon} ${SF_RO}
+ ${Else}
+ !InsertMacro UnselectSection ${SecFileDaemon}
+ !InsertMacro ClearSectionFlag ${SecFileDaemon} ${SF_RO}
+ ${EndIf}
+ IntOp $R1 $PreviousComponents & ${ComponentStorage}
+ ${If} $R1 <> 0
+ !InsertMacro SelectSection ${SecStorageDaemon}
+ !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
+ ${Else}
+ !InsertMacro UnselectSection ${SecStorageDaemon}
+ !InsertMacro ClearSectionFlag ${SecStorageDaemon} ${SF_RO}
+ ${EndIf}
+ IntOp $R1 $PreviousComponents & ${ComponentDirector}
+ ${If} $R1 <> 0
+ !InsertMacro SelectSection ${SecDirectorDaemon}
+ !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO}
+ ${Else}
+ !InsertMacro UnselectSection ${SecDirectorDaemon}
+ !InsertMacro ClearSectionFlag ${SecDirectorDaemon} ${SF_RO}
+ ${EndIf}
+ IntOp $R1 $PreviousComponents & ${ComponentTextConsole}
+ ${If} $R1 <> 0
+ !InsertMacro SelectSection ${SecConsole}
+ !InsertMacro SetSectionFlag ${SecConsole} ${SF_RO}
+ ${Else}
+ !InsertMacro UnselectSection ${SecConsole}
+ !InsertMacro ClearSectionFlag ${SecConsole} ${SF_RO}
+ ${EndIf}
+ IntOp $R1 $PreviousComponents & ${ComponentGUIConsole}
+ ${If} $R1 <> 0
+ !InsertMacro SelectSection ${SecWxConsole}
+ !InsertMacro SetSectionFlag ${SecWxConsole} ${SF_RO}
+ ${Else}
+ !InsertMacro UnselectSection ${SecWxConsole}
+ !InsertMacro ClearSectionFlag ${SecWxConsole} ${SF_RO}
+ ${EndIf}
+ IntOp $R1 $PreviousComponents & ${ComponentPDFDocs}
+ ${If} $R1 <> 0
+ !InsertMacro SelectSection ${SecDocPdf}
+ !InsertMacro SetSectionFlag ${SecDocPdf} ${SF_RO}
+ ${Else}
+ !InsertMacro UnselectSection ${SecDocPdf}
+ !InsertMacro ClearSectionFlag ${SecDocPdf} ${SF_RO}
+ ${EndIf}
+ IntOp $R1 $PreviousComponents & ${ComponentHTMLDocs}
+ ${If} $R1 <> 0
+ !InsertMacro SelectSection ${SecDocHtml}
+ !InsertMacro SetSectionFlag ${SecDocHtml} ${SF_RO}
+ ${Else}
+ !InsertMacro UnselectSection ${SecDocHtml}
+ !InsertMacro ClearSectionFlag ${SecDocHtml} ${SF_RO}
+ ${EndIf}
+ ${EndIf}
+FunctionEnd
+
Function DisableServerSections
!InsertMacro UnselectSection ${SecGroupServer}
- !InsertMacro SetSectionFlag ${SecGroupServer} ${SF_RO}
+ !InsertMacro SetSectionFlag ${SecGroupServer} ${SF_RO}
!InsertMacro UnselectSection ${SecStorageDaemon}
- !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
+ !InsertMacro SetSectionFlag ${SecStorageDaemon} ${SF_RO}
!InsertMacro UnselectSection ${SecDirectorDaemon}
- !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO}
+ !InsertMacro SetSectionFlag ${SecDirectorDaemon} ${SF_RO}
FunctionEnd
Function UpdateComponentUI
!include "InstallType.nsh"
!include "ConfigPage1.nsh"
!include "ConfigPage2.nsh"
+!include "DumpLog.nsh"