mirror of https://gitee.com/bigwinds/arangodb
add selector for auto/mmfiles/rocksdb engine to NSIS installer plus fix some strings to be more userfriendly
This commit is contained in:
parent
03e5e68993
commit
005b35a2cb
|
@ -0,0 +1,135 @@
|
|||
!define StrRep "!insertmacro StrRep"
|
||||
!macro StrRep output string old new
|
||||
Push `${string}`
|
||||
Push `${old}`
|
||||
Push `${new}`
|
||||
!ifdef __UNINSTALL__
|
||||
Call un.StrRep
|
||||
!else
|
||||
Call StrRep
|
||||
!endif
|
||||
Pop ${output}
|
||||
!macroend
|
||||
|
||||
!macro Func_StrRep un
|
||||
Function ${un}StrRep
|
||||
Exch $R2 ;new
|
||||
Exch 1
|
||||
Exch $R1 ;old
|
||||
Exch 2
|
||||
Exch $R0 ;string
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
Push $R6
|
||||
Push $R7
|
||||
Push $R8
|
||||
Push $R9
|
||||
|
||||
StrCpy $R3 0
|
||||
StrLen $R4 $R1
|
||||
StrLen $R6 $R0
|
||||
StrLen $R9 $R2
|
||||
loop:
|
||||
StrCpy $R5 $R0 $R4 $R3
|
||||
StrCmp $R5 $R1 found
|
||||
StrCmp $R3 $R6 done
|
||||
IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character
|
||||
Goto loop
|
||||
found:
|
||||
StrCpy $R5 $R0 $R3
|
||||
IntOp $R8 $R3 + $R4
|
||||
StrCpy $R7 $R0 "" $R8
|
||||
StrCpy $R0 $R5$R2$R7
|
||||
StrLen $R6 $R0
|
||||
IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string
|
||||
Goto loop
|
||||
done:
|
||||
|
||||
Pop $R9
|
||||
Pop $R8
|
||||
Pop $R7
|
||||
Pop $R6
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Push $R0
|
||||
Push $R1
|
||||
Pop $R0
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro Func_StrRep ""
|
||||
!insertmacro Func_StrRep "un."
|
||||
|
||||
Function RIF
|
||||
|
||||
ClearErrors ; want to be a newborn
|
||||
|
||||
Exch $0 ; REPLACEMENT
|
||||
Exch
|
||||
Exch $1 ; SEARCH_TEXT
|
||||
Exch 2
|
||||
Exch $2 ; SOURCE_FILE
|
||||
|
||||
Push $R0 ; SOURCE_FILE file handle
|
||||
Push $R1 ; temporary file handle
|
||||
Push $R2 ; unique temporary file name
|
||||
Push $R3 ; a line to sar/save
|
||||
Push $R4 ; shift puffer
|
||||
|
||||
IfFileExists $2 +1 RIF_error ; knock-knock
|
||||
FileOpen $R0 $2 "r" ; open the door
|
||||
|
||||
GetTempFileName $R2 ; who's new?
|
||||
FileOpen $R1 $R2 "w" ; the escape, please!
|
||||
|
||||
RIF_loop: ; round'n'round we go
|
||||
FileRead $R0 $R3 ; read one line
|
||||
IfErrors RIF_leaveloop ; enough is enough
|
||||
RIF_sar: ; sar - search and replace
|
||||
Push "$R3" ; (hair)stack
|
||||
Push "$1" ; needle
|
||||
Push "$0" ; blood
|
||||
Call StrRep ; do the bartwalk
|
||||
StrCpy $R4 "$R3" ; remember previous state
|
||||
Pop $R3 ; gimme s.th. back in return!
|
||||
StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
|
||||
FileWrite $R1 "$R3" ; save the newbie
|
||||
Goto RIF_loop ; gimme more
|
||||
|
||||
RIF_leaveloop: ; over'n'out, Sir!
|
||||
FileClose $R1 ; S'rry, Ma'am - clos'n now
|
||||
FileClose $R0 ; me 2
|
||||
|
||||
Delete "$2.old" ; go away, Sire
|
||||
Rename "$2" "$2.old" ; step aside, Ma'am
|
||||
Rename "$R2" "$2" ; hi, baby!
|
||||
|
||||
ClearErrors ; now i AM a newborn
|
||||
Goto RIF_out ; out'n'away
|
||||
|
||||
RIF_error: ; ups - s.th. went wrong...
|
||||
SetErrors ; ...so cry, boy!
|
||||
|
||||
RIF_out: ; your wardrobe?
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
Pop $2
|
||||
Pop $0
|
||||
Pop $1
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!macro _ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
|
||||
Push "${SOURCE_FILE}"
|
||||
Push "${SEARCH_TEXT}"
|
||||
Push "${REPLACEMENT}"
|
||||
Call RIF
|
||||
!macroend
|
|
@ -1,11 +1,11 @@
|
|||
[Settings]
|
||||
NumFields=9
|
||||
NumFields=11
|
||||
|
||||
[Field 1]
|
||||
Type=label
|
||||
Text=By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does not add its directory to the system PATH.
|
||||
Left=0
|
||||
Right=-1
|
||||
Right=140
|
||||
Top=0
|
||||
Bottom=20
|
||||
|
||||
|
@ -13,7 +13,7 @@ Bottom=20
|
|||
Type=radiobutton
|
||||
Text=as service into the default directory
|
||||
Left=5
|
||||
Right=-1
|
||||
Right=140
|
||||
Top=30
|
||||
Bottom=40
|
||||
State=1
|
||||
|
@ -22,7 +22,7 @@ State=1
|
|||
Type=radiobutton
|
||||
Text=for all users
|
||||
Left=5
|
||||
Right=-1
|
||||
Right=140
|
||||
Top=40
|
||||
Bottom=50
|
||||
State=0
|
||||
|
@ -31,7 +31,7 @@ State=0
|
|||
Type=radiobutton
|
||||
Text=for the current user
|
||||
Left=5
|
||||
Right=-1
|
||||
Right=140
|
||||
Top=50
|
||||
Bottom=60
|
||||
State=0
|
||||
|
@ -67,7 +67,7 @@ State=
|
|||
Type=label
|
||||
Text=Install @CPACK_PACKAGE_NAME@
|
||||
Left=0
|
||||
Right=-1
|
||||
Right=160
|
||||
Top=20
|
||||
Bottom=29
|
||||
|
||||
|
@ -78,3 +78,21 @@ Left=0
|
|||
Right=-1
|
||||
Top=75
|
||||
Bottom=85
|
||||
|
||||
[Field 10]
|
||||
Type=label
|
||||
Text=Choose the stogare engine to use for this ArangoDB Installation
|
||||
Left=160
|
||||
Right=-1
|
||||
Top=0
|
||||
Bottom=20
|
||||
|
||||
[Field 11]
|
||||
Type=Droplist
|
||||
ListItems=auto|mmfiles|rocksdb
|
||||
State=auto
|
||||
Left=160
|
||||
Right=-1
|
||||
Top=20
|
||||
Bottom=29
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
!addplugindir '@CPACK_PLUGIN_PATH@/AccessControl/Plugins'
|
||||
!addplugindir '@CPACK_PLUGIN_PATH@/SharedMemory/Plugins'
|
||||
!addincludedir '@CPACK_PLUGIN_PATH@/UAC-plug-in-NSIS'
|
||||
|
||||
!addincludedir '@CPACK_PLUGIN_PATH@/'
|
||||
!include StrRep.nsh
|
||||
;--------------------------------
|
||||
; Include LogicLib for more readable code
|
||||
!include "LogicLib.nsh"
|
||||
|
@ -47,7 +48,8 @@
|
|||
|
||||
Var INSTALL_DESKTOP ; x bool: add desktop icon
|
||||
Var IS_DEFAULT_INSTALLDIR
|
||||
|
||||
|
||||
Var STORAGE_ENGINE ; x string auto/mmfiles/rocksdb
|
||||
Var PASSWORD ; x string
|
||||
Var PASSWORD_AGAIN ; x string / only for comparison
|
||||
|
||||
|
@ -566,6 +568,7 @@ FunctionEnd
|
|||
;--------------------------------
|
||||
|
||||
Function WaitForServiceUp
|
||||
DetailPrint "starting ArangoDB Service..."
|
||||
Push 0
|
||||
Pop $retryCount
|
||||
try_again:
|
||||
|
@ -579,7 +582,7 @@ Function WaitForServiceUp
|
|||
${EndIf}
|
||||
Sleep 1000
|
||||
${If} $retryCount == 40
|
||||
MessageBox MB_OK "Service waiting retry count reached"
|
||||
MessageBox MB_OK "Waited 40 seconds for ArangoDB to come up; Please look at the Windows Eventlog for eventual errors!"
|
||||
Return
|
||||
${EndIf}
|
||||
IntOp $retryCount $retryCount + 1
|
||||
|
@ -589,6 +592,7 @@ FunctionEnd
|
|||
;--------------------------------
|
||||
|
||||
Function WaitForServiceDown
|
||||
DetailPrint "stopping ArangoDB Service..."
|
||||
Push 0
|
||||
Pop $retryCount
|
||||
try_again:
|
||||
|
@ -602,7 +606,7 @@ Function WaitForServiceDown
|
|||
${EndIf}
|
||||
Sleep 1000
|
||||
${If} $retryCount == 40
|
||||
MessageBox MB_OK "Service shutdown waiting retry count reached; you may need to remove files by hand"
|
||||
MessageBox MB_OK "Waited 40 seconds for the ArangoDB Service to shutdown; you may need to remove files by hand"
|
||||
Return
|
||||
${EndIf}
|
||||
IntOp $retryCount $retryCount + 1
|
||||
|
@ -610,6 +614,7 @@ Function WaitForServiceDown
|
|||
FunctionEnd
|
||||
|
||||
Function un.WaitForServiceDown
|
||||
DetailPrint "stopping ArangoDB Service..."
|
||||
Push 0
|
||||
Pop $retryCount
|
||||
try_again:
|
||||
|
@ -623,7 +628,7 @@ Function un.WaitForServiceDown
|
|||
${EndIf}
|
||||
Sleep 1000
|
||||
${If} $retryCount == 40
|
||||
MessageBox MB_OK "Service shutdown waiting retry count reached; you may need to remove files by hand"
|
||||
MessageBox MB_OK "Waited 40 seconds for the ArangoDB Service to shutdown; you may need to remove files by hand"
|
||||
Return
|
||||
${EndIf}
|
||||
IntOp $retryCount $retryCount + 1
|
||||
|
@ -779,6 +784,12 @@ Section "-Core installation"
|
|||
; this variable was defined by eld and included in NSIS.template.in
|
||||
; we probably need this for the install/uninstall software list.
|
||||
SetRegView ${BITS}
|
||||
|
||||
StrCmp $TRI_INSTALL_TYPE 'Service' 0 noServiceToStop
|
||||
SimpleSC::StopService '${TRI_SVC_NAME}' 0 30
|
||||
Call WaitForServiceDown
|
||||
SimpleSC::RemoveService '${TRI_SVC_NAME}'
|
||||
noServiceToStop:
|
||||
@CPACK_NSIS_FULL_INSTALL@
|
||||
|
||||
;Store installation folder
|
||||
|
@ -861,6 +872,8 @@ Section "-Core installation"
|
|||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
!insertmacro _ReplaceInFile "$INSTDIR\etc\arangodb3\arangod.conf" "storage-engine = auto" "storage-engine = $STORAGE_ENGINE"
|
||||
|
||||
System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("ARANGODB_DEFAULT_ROOT_PASSWORD", "$PASSWORD").r0'
|
||||
StrCmp $0 0 error
|
||||
ExecWait "$INSTDIR\${SBIN_DIR}\arangod.exe --database.init-database"
|
||||
|
@ -870,9 +883,6 @@ Section "-Core installation"
|
|||
done:
|
||||
@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
|
||||
StrCmp $TRI_INSTALL_TYPE 'Service' 0 nothing
|
||||
SimpleSC::StopService '${TRI_SVC_NAME}' 0 30
|
||||
Call WaitForServiceDown
|
||||
SimpleSC::RemoveService '${TRI_SVC_NAME}'
|
||||
SimpleSC::InstallService '${TRI_SVC_NAME}' '${TRI_SVC_NAME}' '16' '2' '"$INSTDIR\${SBIN_DIR}\arangod.exe" --start-service' '' '' ''
|
||||
SimpleSC::SetServiceDescription '${TRI_SVC_NAME}' '${TRI_FRIENDLY_SVC_NAME}'
|
||||
SimpleSC::StartService '${TRI_SVC_NAME}' '' 30
|
||||
|
@ -923,6 +933,7 @@ displayAgain:
|
|||
!insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $STORAGE_ENGINE "NSIS.InstallOptions.ini" "Field 11" "State"
|
||||
|
||||
StrCmp $PASSWORD $PASSWORD_AGAIN +3 0
|
||||
MessageBox MB_OK|MB_ICONSTOP "Passwords don't match, try again"
|
||||
|
@ -1401,6 +1412,12 @@ Function .onInit
|
|||
IfErrors 0 +3
|
||||
StrCpy $ADD_TO_PATH_CURRENT_USER "0"
|
||||
|
||||
${GetParameters} $R0
|
||||
ClearErrors
|
||||
${GetOptions} $R0 "/STORAGE_ENGINE=" $STORAGE_ENGINE
|
||||
IfErrors 0 +3
|
||||
StrCpy $ADD_TO_PATH_CURRENT_USER "0"
|
||||
|
||||
IfSilent 0 dontValidatePathOption
|
||||
StrCpy $allPathOpts "0"
|
||||
IntOp $allPathOpts $allPathOpts + $DO_NOT_ADD_TO_PATH
|
||||
|
@ -1450,6 +1467,7 @@ inst:
|
|||
; Reads components status for registry
|
||||
!insertmacro SectionList "InitSection"
|
||||
|
||||
StrCpy $STORAGE_ENGINE "auto"
|
||||
; check to see if /D has been used to change
|
||||
; the install directory by comparing it to the
|
||||
; install directory that is expected to be the
|
||||
|
|
|
@ -26,6 +26,7 @@ directory = @LOCALSTATEDIR@/lib/arangodb3
|
|||
# endpoint = tcp://[fe80::21a:5df1:aede:98cf]:8529
|
||||
#
|
||||
endpoint = tcp://127.0.0.1:8529
|
||||
storage-engine = auto
|
||||
|
||||
# reuse a port on restart or wait until it is freed by the operating system
|
||||
# reuse-address = false
|
||||
|
|
Loading…
Reference in New Issue