Skip to content

Commit

Permalink
winbareos.nsi: remove sqlite parts
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz authored and arogge committed Dec 10, 2021
1 parent 5e1617c commit 8a09628
Showing 1 changed file with 5 additions and 99 deletions.
104 changes: 5 additions & 99 deletions core/platforms/win32/winbareos.nsi
Expand Up @@ -54,9 +54,8 @@ $\r$\n\
[/DIRECTORPASSWORD=password]$\r$\n\
$\r$\n\
[/INSTALLDIRECTOR]$\r$\n\
[/DBDRIVER=database driver <postgresql (default)|sqlite3>]$\r$\n\
[/DBADMINUSER=database user (only Postgres)]$\r$\n\
[/DBADMINPASSWORD=database password (only Postgres)]$\r$\n\
[/DBADMINUSER=PostgreSQL database user]$\r$\n\
[/DBADMINPASSWORD=PostgreSQL database password]$\r$\n\
[/INSTALLWEBUI requires 'Visual C++ Redistributable for Visual Studio 2012 x86', sets /INSTALLDIRECTOR]$\r$\n\
[/WEBUILISTENADDRESS=network address, default 127.0.0.1]$\r$\n\
[/WEBUILISTENPORT=network port, default 9100]$\r$\n\
Expand Down Expand Up @@ -278,7 +277,7 @@ ${EndIf}
System::Call 'kernel32::SetEnvironmentVariable(t "PGUSER", t "$DbAdminUser")i.r0'
System::Call 'kernel32::SetEnvironmentVariable(t "PGPASSWORD", t "$DbAdminPassword")i.r0'

DetailPrint "Now trying to log into the postgres server with the DbAdmin User and Password"
DetailPrint "Now trying to log into the PostgreSQL server with the DbAdmin User and Password"
DetailPrint "Running $PostgresPsqlExeFullPath -c \copyright"
StrCmp $WriteLogs "yes" 0 +2
LogEx::Write "Running $PostgresPsqlExeFullPath -c \copyright"
Expand Down Expand Up @@ -463,7 +462,6 @@ ShowInstDetails show
ShowUnInstDetails show

InstType "Standard - FileDaemon + Plugins, Traymonitor"
InstType "Full SQLite - All Daemons, Director with SQLite Backend (no DB Server needed)"
InstType "Full PostgreSQL - All Daemons, Director PostgreSQL Backend (needs local PostgreSQL Server)"
InstType "Minimal - FileDaemon + Plugins, no Traymonitor"

Expand Down Expand Up @@ -809,7 +807,6 @@ Section -DataBaseCheck
IfSilent 0 DataBaseCheckEnd # if we are silent, we do the db credentials check, otherwise the db dialog will do it

StrCmp $InstallDirector "no" DataBaseCheckEnd # skip DbConnection if not installing director
StrCmp $DbDriver "sqlite3" DataBaseCheckEnd # skip DbConnection if not installing director

${If} ${SectionIsSelected} ${SEC_DIR_POSTGRES}
!insertmacro CheckDbAdminConnection
Expand All @@ -820,56 +817,6 @@ SectionEnd





Section /o "Director SQLite Backend Support " SEC_DIR_SQLITE
SectionIn 2
SetShellVarContext all

SetOutPath "$INSTDIR"
File "sqlite3.exe"
File "libsqlite3-0.dll"
File "libbareoscats-sqlite3.dll"

Rename "$PLUGINSDIR\sqlite3.sql" "$APPDATA\${PRODUCT_NAME}\scripts\sqlite3.sql"

# write database create batch file sqlite3
#
FileOpen $R1 "$APPDATA\${PRODUCT_NAME}\scripts\sqlite3-createdb.bat" w
FileWrite $R1 'REM call this batch file to create the bareos database in sqlite3 $\r$\n'
FileWrite $R1 'REM $\r$\n'
FileWrite $R1 'REM $\r$\n'
FileWrite $R1 'REM create sqlite3 database $\r$\n'

FileWrite $R1 "cd $APPDATA\${PRODUCT_NAME}\scripts\$\r$\n"

FileWrite $R1 "echo creating bareos database$\r$\n"
FileWrite $R1 "$\"$INSTDIR\sqlite3.exe$\" $\"$APPDATA\${PRODUCT_NAME}\\working\bareos.db$\" < $\"$APPDATA\${PRODUCT_NAME}\scripts\sqlite3.sql$\"$\r$\n"
FileClose $R1

#
# write database dump file
#
FileOpen $R1 "$APPDATA\${PRODUCT_NAME}\scripts\make_catalog_backup.bat" w
FileWrite $R1 '@echo off$\r$\n'
FileWrite $R1 'REM call this batch file to create a db dump$\r$\n'
FileWrite $R1 'REM create sqlite3 database dump$\r$\n'
FileWrite $R1 'echo dumping bareos database$\r$\n'
FileWrite $R1 "echo .dump | $\"$INSTDIR\sqlite3.exe$\" $\"$APPDATA\${PRODUCT_NAME}\\working\bareos.db$\" > $\"$APPDATA\${PRODUCT_NAME}\working\bareos.sql$\"$\r$\n"
FileClose $R1

#
# write delete sql dump file
#
FileOpen $R1 "$APPDATA\${PRODUCT_NAME}\scripts\delete_catalog_backup.bat" w
FileWrite $R1 '@echo off $\r$\n'
FileWrite $R1 'REM this script deletes the db dump $\r$\n'
FileWrite $R1 'del $APPDATA\${PRODUCT_NAME}\working\bareos.sql $\r$\n'
FileClose $R1

SectionEnd


Section /o "Director Plugins" SEC_DIRPLUGINS
SectionIn 2 3
SetShellVarContext all
Expand Down Expand Up @@ -1075,9 +1022,6 @@ ${Else}
${EndIf}
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIR_POSTGRES} "$SEC_DIR_POSTGRES_DESCRIPTION"


!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIR_SQLITE} "SQLite Catalog Database Support - Uses integrated SQLite Support"

!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIRPLUGINS} "Installs the Bareos Director Plugins"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_FIREWALL_DIR} "Opens the needed ports for the Director Daemon in the windows firewall"

Expand Down Expand Up @@ -1255,11 +1199,6 @@ Section -StartDaemon
StrCmp $WriteLogs "yes" 0 +2
LogEx::AddFile " >" "$PLUGINSDIR\db_setup_output.log"

${ElseIf} $DbDriver == sqlite3
# create sqlite3 db
LogText "### Executing $APPDATA\${PRODUCT_NAME}\scripts\sqlite3-createdb.bat"
nsExec::ExecToLog "$APPDATA\${PRODUCT_NAME}\scripts\sqlite3-createdb.bat > $PLUGINSDIR\db_setup_output.log"

${EndIf}

LogText "### Executing net start bareos-dir"
Expand Down Expand Up @@ -1591,8 +1530,6 @@ done:
File "/oname=$PLUGINSDIR\postgresql-grant.sql" ".\ddl\grants\postgresql.sql"
# File "/oname=$PLUGINSDIR\postgresql.sql" ".\ddl\updates\postgresql.sql"

File "/oname=$PLUGINSDIR\sqlite3.sql" ".\ddl\creates\sqlite3.sql"

# webui
File "/oname=$PLUGINSDIR\php.ini" ".\bareos-webui\php\php.ini"
File "/oname=$PLUGINSDIR\global.php" ".\bareos-webui\config\autoload\global.php"
Expand Down Expand Up @@ -1623,27 +1560,11 @@ done:
SectionSetFlags ${SEC_BCONSOLE} ${SF_SELECTED} # bconsole

IfSilent 0 DbDriverCheckEnd
${If} $DbDriver == sqlite3
LogText "DbDriver is sqlite3"
SectionSetFlags ${SEC_DIR_POSTGRES} ${SF_UNSELECTED}
SectionSetFlags ${SEC_DIR_SQLITE} ${SF_SELECTED}
${ElseIf} $DbDriver == postgresql
LogText "DbDriver is postgresql"
SectionSetFlags ${SEC_DIR_POSTGRES} ${SF_SELECTED}
SectionSetFlags ${SEC_DIR_SQLITE} ${SF_UNSELECTED}
${Else}
LogText "DbDriver needs to be sqlite3 or postgresql but is $DbDriver"
Abort
${EndIf}
DbDriverCheckEnd:

IfSilent AutoSelecPostgresIfAvailableEnd
${If} $IsPostgresInstalled == yes
SectionSetFlags ${SEC_DIR_POSTGRES} ${SF_SELECTED}
SectionSetFlags ${SEC_DIR_SQLITE} ${SF_UNSELECTED}
${Else}
SectionSetFlags ${SEC_DIR_SQLITE} ${SF_SELECTED}
${EndIf}
IfSilent AutoSelecPostgresIfAvailableEnd
SectionSetFlags ${SEC_DIR_POSTGRES} ${SF_SELECTED}
AutoSelecPostgresIfAvailableEnd:

dontInstDir:
Expand Down Expand Up @@ -1941,7 +1862,6 @@ Function getDatabaseParametersLeave
dbcheckend:

StrCmp $InstallDirector "no" SkipDbCheck # skip DbConnection if not instaling director
StrCmp $DbDriver "sqlite3" SkipDbCheck # skip DbConnection of using sqlite3

${If} ${SectionIsSelected} ${SEC_DIR_POSTGRES}
!insertmacro CheckDbAdminConnection
Expand Down Expand Up @@ -2126,10 +2046,6 @@ ConfDeleteSkip:
Delete "$INSTDIR\libbareoscats.dll"
Delete "$INSTDIR\libbareoscats-postgresql.dll"

Delete "$INSTDIR\libbareoscats-sqlite3.dll"
Delete "$INSTDIR\libsqlite3-0.dll"
Delete "$INSTDIR\sqlite3.exe"

Delete "$INSTDIR\libcrypto-*.dll"
Delete "$INSTDIR\libgcc_s_*-1.dll"
Delete "$INSTDIR\libhistory8.dll"
Expand Down Expand Up @@ -2252,11 +2168,6 @@ Function .onSelChange
Push $R0
Push $R1

# !insertmacro StartRadioButtons $1
# !insertmacro RadioButton ${SEC_DIR_POSTGRES}
# !insertmacro RadioButton ${SEC_DIR_SQLITE}
# !insertmacro EndRadioButtons

# if Postgres was not detected always disable postgresql backend

${If} $IsPostgresInstalled == no
Expand All @@ -2277,11 +2188,6 @@ Function .onSelChange
StrCpy $InstallDirector "yes"
SectionSetFlags ${SEC_BCONSOLE} ${SF_SELECTED} # bconsole

SectionGetFlags ${SEC_DIR_SQLITE} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 +2
StrCpy $DbDriver "sqlite3"

SectionGetFlags ${SEC_DIR_POSTGRES} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 +2
Expand Down

0 comments on commit 8a09628

Please sign in to comment.