@@ -226,6 +226,9 @@ Function check_previous_install
226
226
StrCpy $UpgradeInstall "0"
227
227
IfFileExists "$DATADIR\@INC_CPACK_ARANGO_DATA_DIR@\SERVER" OldFound
228
228
IfFileExists "$DATADIR\@INC_CPACK_ARANGO_DATA_DIR@\ENGINE" OldFound
229
+ IfSilent 0 continueNoDirectMatch
230
+ IfFileExists "$DATADIR\ENGINE" OldFound
231
+ continueNoDirectMatch:
229
232
DetailPrint "This is a fresh install."
230
233
return
231
234
OldFound:
@@ -238,7 +241,16 @@ Function stop_old_service
238
241
SimpleSC::StopService '${TRI_SVC_NAME}' 0 30
239
242
Call WaitForServiceDown
240
243
SimpleSC::RemoveService '${TRI_SVC_NAME}'
244
+ Pop $0 ; returns an errorcode (<>0) otherwise success (0)
245
+ IntCmp $0 0 Done_stop_old
246
+ IntCmp $0 1060 Done_stop_old ; service not there, we don't care.
247
+ Push $0
248
+ SimpleSC::GetErrorMessage
249
+ Pop $0
250
+ DetailPrint 'Stopping ArangoDB fails - Reason: $0'
251
+ MessageBox MB_OK 'Stopping ArangoDB fails - Reason: $0'
241
252
${EndIf}
253
+ Done_stop_old:
242
254
FunctionEnd
243
255
244
256
@@ -731,7 +743,7 @@ Function UpgradeExisting
731
743
push ${ARANGO_EXIT_ALREADY_RUNNING}
732
744
pop $0
733
745
retryDetectUpgradeNeeded:
734
- ExecWait "$INSTDIR\${SBIN_DIR}\arangod.exe --server.rest-server false --log.foreground-tty false --database.check-version" $0
746
+ ExecWait "$INSTDIR\${SBIN_DIR}\arangod.exe --server.rest-server false --log.foreground-tty false --database.check-version $DATADIR " $0
735
747
DetailPrint "done Checking whether an existing database needs upgrade: $0"
736
748
${If} $0 == ${ARANGO_EXIT_ALREADY_RUNNING}
737
749
${OrIf} $0 == ${ARANGO_EXIT_COULD_NOT_LOCK}
@@ -759,7 +771,7 @@ retryDetectUpgradeNeeded:
759
771
${EndIf}
760
772
DetailPrint "Attempting to run database upgrade: "
761
773
; Now actually do the upgrade
762
- ExecWait "$INSTDIR\${SBIN_DIR}\arangod.exe --server.rest-server false --log.level error --database.auto-upgrade true" $0
774
+ ExecWait "$INSTDIR\${SBIN_DIR}\arangod.exe --server.rest-server false --log.level error --database.auto-upgrade true $DATADIR " $0
763
775
DetailPrint "Done running database upgrade: $0"
764
776
${If} $0 != 0
765
777
!insertmacro printExitCode $0 "the Upgrade failed, please do a manual upgrade" ""
@@ -886,6 +898,13 @@ FunctionEnd
886
898
;Installer Sections
887
899
888
900
Section "-Core installation"
901
+ IfSilent 0 continueBaseInstall
902
+ ; this would be called inside the UI code:
903
+ Call check_previous_install
904
+ ${If} $UpgradeInstall == "1"
905
+ Call stop_old_service
906
+ ${EndIf}
907
+ continueBaseInstall:
889
908
;Use the entire tree produced by the INSTALL target. Keep the
890
909
;list of directories here in sync with the RMDir commands below.
891
910
SetOutPath "$INSTDIR"
@@ -970,9 +989,6 @@ Section "-Core installation"
970
989
CreateDirectory $LOGDIR
971
990
${EndIf}
972
991
973
- ; non-interactive install only hits us here?
974
- Call check_previous_install
975
-
976
992
CreateDirectory $APPDIR
977
993
Call assignFileRights
978
994
${If} $UpgradeInstall == "1"
@@ -1255,6 +1271,7 @@ SectionEnd
1255
1271
; "Program Files" for AllUsers, "My Documents" for JustMe...
1256
1272
1257
1273
var CMDINSTDIR
1274
+ var CMDUPGRADE
1258
1275
1259
1276
Function .onInit
1260
1277
; are we allowed to install admin in first place?
@@ -1292,7 +1309,17 @@ Function .onInit
1292
1309
${EndIf}
1293
1310
noInstDir:
1294
1311
1295
- # we only want to manipulate APPDIR here if /APPDIR is really set!
1312
+ # $AUTOMATIC_UPDATE would be set later in the UI code (if)
1313
+ StrCpy $AUTOMATIC_UPDATE "0"
1314
+ ${GetParameters} $R0
1315
+ ClearErrors
1316
+ ${GetOptions} $R0 "/UPGRADE=" $CMDUPGRADE
1317
+ IfErrors noUpgrade 0
1318
+ IfSilent 0 noUpgrade
1319
+ StrCpy $AUTOMATIC_UPDATE "$CMDUPGRADE"
1320
+ noUpgrade:
1321
+
1322
+ # we only want to manipulate APPDIR here if /APPDIR is really set!
1296
1323
${GetParameters} $R0
1297
1324
ClearErrors
1298
1325
${GetOptions} $R0 "/APPDIR=" $CMDINSTDIR
0 commit comments