12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031 |
-
- !include "StrFunc.nsh"
- !include "WordFunc.nsh"
- ${StrRep}
- ${StrStr}
- !include "LogicLib.nsh"
- !include "nsDialogs.nsh"
- !include "common.nsh"
- !include "x64.nsh"
- !include "MUI.nsh"
- !include "WinVer.nsh"
- !include "commonfunc.nsh"
- !insertmacro MUI_LANGUAGE "SimpChinese"
- VIProductVersion "${PRODUCT_VERSION}"
- VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
- VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
- VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
- VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
- VIAddVersionKey "InternalName" "${EXE_NAME}"
- VIAddVersionKey "FileDescription" "${PRODUCT_NAME}"
- VIAddVersionKey "LegalCopyright" "${PRODUCT_LEGAL}"
- !define INSTALL_PAGE_CONFIG 0
- ;!define INSTALL_PAGE_LICENSE 1
- !define INSTALL_PAGE_PROCESSING 1
- !define INSTALL_PAGE_FINISH 2
- !define INSTALL_PAGE_UNISTCONFIG 3
- !define INSTALL_PAGE_UNISTPROCESSING 4
- !define INSTALL_PAGE_UNISTFINISH 5
- Page custom DUIPage
- UninstPage custom un.DUIPage
- Var hInstallDlg
- Var hInstallSubDlg
- Var sCmdFlag
- Var sCmdSetupPath
- Var sSetupPath
- Var sReserveData
- Var InstallState
- Var UnInstallValue
- Var basedir
- Var datadir
- Var logError
- Var buildModelPath
- Var profilePath
- Var buildCallPath
- Var dbpath
- Var logpath
- Var binPath
- Var javaPath
- Var temp11
- Var temp12
- Var OLD_VER
- Var step
- ;在安装程序运行前的回调函数前实现
- Function .onInit
- System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e'
- Pop $R0
- StrCmp $R0 0 +3
- MessageBox MB_OK|MB_USERICON '有一个安装向导已经运行,请勿重复打开'
- Abort
- ${IfNot} ${AtLeastWin10}
- MessageBox MB_OK|MB_USERICON '本程序只能安装在windows-10(64位)系统上'
- Abort
- ${EndIf}
- ReadRegStr $OLD_VER HKLM "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion"
- ${IF} $OLD_VER != ""
- ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0
- ${If} $R0 == "0"
- MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
- Quit
- ${EndIf}
- ${If} $R0 == "1"
- MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
- ;MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},您安装的版本是 ${PRODUCT_VERSION} 小于版本 $OLD_VER '
- Quit
- ${EndIf}
- ${If} $R0 == "2"
- MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
- ;MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},您安装的版本是 ${PRODUCT_VERSION} 大于版本 $OLD_VER '
- Quit
- ${EndIf}
- ${EndIf}
- FunctionEnd
- Function un.onInit
- System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e'
- Pop $R0
- StrCmp $R0 0 +3
- MessageBox MB_OK|MB_USERICON '有一个卸载向导已经运行,请勿重复打开'
- Abort
- FunctionEnd
- Function DUIPage
- StrCpy $InstallState "0"
- InitPluginsDir
- SetOutPath "$PLUGINSDIR"
- File "${INSTALL_LICENCE_FILENAME}"
- File "${INSTALL_RES_PATH}"
- File /oname=logo.ico "${INSTALL_ICO}" #
- nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" "${INSTALL_LICENCE_FILENAME}"
- Pop $hInstallDlg
-
- Call GenerateSetupAddress
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" "$INSTDIR\"
- Call OnRichEditTextChange
- nsNiuniuSkin::SetWindowTile $hInstallDlg "${PRODUCT_NAME}安装程序"
- nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG}
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "licensename" "text" "《四维深时本地版用户许可协议》"
-
- Call BindUIControls
- nsNiuniuSkin::ShowPage 0
- FunctionEnd
- Function un.DUIPage
- StrCpy $InstallState "0"
- InitPluginsDir
- SetOutPath "$PLUGINSDIR"
- File "${INSTALL_RES_PATH}"
- File /oname=logo.ico "${UNINSTALL_ICO}"
- nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" ""
- Pop $hInstallDlg
- nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTCONFIG}
- nsNiuniuSkin::SetWindowTile $hInstallDlg "${PRODUCT_NAME}卸载程序"
- nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390s
- Call un.BindUnInstUIControls
-
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAutoRun" "selected" "true"
-
- nsNiuniuSkin::ShowPage 0
-
- FunctionEnd
- Function un.BindUnInstUIControls
- GetFunctionAddress $0 un.ExitDUISetup
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnUninstalled" $0
-
- GetFunctionAddress $0 un.onUninstall
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnUnInstall" $0
-
- GetFunctionAddress $0 un.ExitDUISetup
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0
-
- GetFunctionAddress $0 un.OnBtnMin
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0
- GetFunctionAddress $0 un.BtnDirPre
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0
- FunctionEnd
- Function BindUIControls
- GetFunctionAddress $0 OnExitDUISetup
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseClose" $0
-
- GetFunctionAddress $0 OnBtnMin
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseMin" $0
-
-
- GetFunctionAddress $0 OnBtnLicenseClick
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgreement" $0
-
- GetFunctionAddress $0 OnExitDUISetup
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirClose" $0
-
- GetFunctionAddress $0 OnExitDUISetup
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseCancel" $0
-
- GetFunctionAddress $0 OnBtnMin
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirMin" $0
-
- GetFunctionAddress $0 OnBtnSelectDir
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnSelectDir" $0
-
- GetFunctionAddress $0 OnBtnDirPre
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0
-
- GetFunctionAddress $0 OnBtnShowConfig
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgree" $0
-
- GetFunctionAddress $0 OnBtnCancel
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirCancel" $0
-
- GetFunctionAddress $0 OnBtnInstall
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnInstall" $0
-
- GetFunctionAddress $0 OnExitDUISetup
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailClose" $0
-
- GetFunctionAddress $0 OnBtnMin
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailMin" $0
- GetFunctionAddress $0 OnFinished
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnRun" $0
-
- GetFunctionAddress $0 OnBtnMin
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0
-
- GetFunctionAddress $0 OnExitDUISetup
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0
-
- GetFunctionAddress $0 OnCheckLicenseClick
- nsNiuniuSkin::BindCallBack $hInstallDlg "chkAgree" $0
-
- GetFunctionAddress $0 OnBtnShowMore
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnShowMore" $0
-
- GetFunctionAddress $0 OnBtnHideMore
- nsNiuniuSkin::BindCallBack $hInstallDlg "btnHideMore" $0
-
- GetFunctionAddress $0 OnSysCommandCloseEvent
- nsNiuniuSkin::BindCallBack $hInstallDlg "syscommandclose" $0
-
- GetFunctionAddress $0 OnRichEditTextChange
- nsNiuniuSkin::BindCallBack $hInstallDlg "editDir" $0
- FunctionEnd
- Function OnRichEditTextChange
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text"
- Pop $0
- StrCpy $INSTDIR "$0"
-
- Call onVerifyInstDir
- Pop $0
- ${If} $0 == 1
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "不能包含中文路径"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
- goto TextChangeAbort
- ${EndIf}
- ${If} $0 == 2
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "路径不能为空"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
- goto TextChangeAbort
- ${EndIf}
- Call IsSetupPathIlleagal
- ${If} $R5 == "0"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "路径错误"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
- goto TextChangeAbort
- ${EndIf}
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#FF999999"
- ${If} $R0 > 1024
-
- IntOp $R1 $R0 % 1024
- IntOp $R0 $R0 / 1024;
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "剩余空间:$R0.$R1GB"
- ${Else}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "剩余空间:$R0.$R1MB"
- ${endif}
-
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
- Pop $0
- ${If} $0 == "1"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
- ${Else}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
- ${EndIf}
-
- TextChangeAbort:
- FunctionEnd
- Function OnCheckLicenseClick
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
- Pop $0
- ${If} $0 == "0"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
- ${Else}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
- ${EndIf}
- FunctionEnd
- Function OnBtnLicenseClick
- ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_LICENSE}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "true"
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "moreconfiginfo" "visible"
- Pop $0
- ${If} $0 = 0
- ;pos="10,35,560,405"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,385"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "270"
- ${Else}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,495"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "375"
- ${EndIf}
-
- FunctionEnd
- Section "silentInstallSec" SEC01
- #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent install code here."
- SectionEnd
- Function ShowMsgBox
- nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose"
- Pop $hInstallSubDlg
- nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" "提示"
- nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8"
- ${If} "$R7" == "1"
- nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true"
- ${EndIf}
-
- nsNiuniuSkin::ShowSkinSubPage 0
- FunctionEnd
- Function OnBtnInstall
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
- Pop $0
- StrCpy $0 "1"
-
- StrCmp $0 "0" InstallAbort 0
-
- nsProcess::_FindProcess "${EXE_NAME_EXT}"
- Pop $R0
-
- ${If} $R0 == 0
- StrCpy $R8 "${PRODUCT_NAME} 正在运行,请退出后重试!"
- StrCpy $R7 "0"
- Call ShowMsgBox
- goto InstallAbort
- ${EndIf}
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text"
- Pop $0
- StrCmp $0 "" InstallAbort 0
-
- Call AdjustInstallPath
- StrCpy $sSetupPath "$INSTDIR"
-
- Call IsSetupPathIlleagal
- ${If} $R5 == "0"
- StrCpy $R8 "路径错误,请使用正确的路径安装!"
- StrCpy $R7 "0"
- Call ShowMsgBox
- goto InstallAbort
- ${EndIf}
- ${If} $R5 == "-1"
- StrCpy $R8 "目标磁盘空间不足,请使用其他的磁盘安装!"
- StrCpy $R7 "0"
- Call ShowMsgBox
- goto InstallAbort
- ${EndIf}
-
-
- nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false"
- nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_PROCESSING}
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "min" "0"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "max" "100"
-
- #Call BakFiles
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "正在安装"
- GetFunctionAddress $0 ExtractFunc
- BgWorker::CallAndWait
-
-
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkShotcut" "selected"
- #Pop $R0
- # ${If} $R0 == "1"
- # SetShellVarContext all
- # CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
- # SetShellVarContext current
- # ${EndIf}
- SetShellVarContext all
- CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
- SetShellVarContext current
- Call CreateAppShortcut
- Call CreateUninstall
-
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "正在初始化..."
- GetFunctionAddress $0 OnEnvInstall
- BgWorker::CallAndWait
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "正在初始化服务..."
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" ""
- GetFunctionAddress $0 installService
- BgWorker::CallAndWait
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "初始化完成"
- StrCpy $InstallState "1"
- #Call OnFinished
-
- nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_FINISH}
- InstallAbort:
- FunctionEnd
- Function ExtractCallback
- Pop $1
- Pop $2
- System::Int64Op $1 * 100
- Pop $3
- System::Int64Op $3 / $2
- Pop $0
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "$0"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "$0%"
- ${If} $1 == $2
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "100"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "100%"
- ${EndIf}
- FunctionEnd
- Function OnSysCommandCloseEvent
- Call OnExitDUISetup
- FunctionEnd
- Function OnExitDUISetup
- ${If} $InstallState == "0"
- StrCpy $R8 "确定要停止安装吗?"
- StrCpy $R7 "1"
- Call ShowMsgBox
- pop $0
- ${If} $0 == 0
- goto endfun
- ${EndIf}
- ${EndIf}
- nsNiuniuSkin::ExitDUISetup
- endfun:
- FunctionEnd
- Function OnBtnMin
- SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
- FunctionEnd
- Function OnBtnCancel
- nsNiuniuSkin::ExitDUISetup
- FunctionEnd
- Function OnEnvInstall
- EnVar::SetHKLM
- EnVar::AddValue FDMGEA_HOME "$INSTDIR"
- ;EnVar::SetHKLM
- ;EnVar::AddValue JAVA_HOME "$INSTDIR\jdk1.8"
- EnVar::SetHKLM
- EnVar::AddValue MYSQL_HOME "$INSTDIR\mysql"
- EnVar::SetHKLM
- EnVar::AddValue REDIS_HOME "$INSTDIR\redis"
- EnVar::SetHKLM
- EnVar::AddValue 4DKK_HOME "$INSTDIR\CGAII"
- EnVar::SetHKLM
- EnVar::AddValue MONGODB_HOME "$INSTDIR\mongodb"
- ;EnVar::SetHKLM
- ;EnVar::AddValue CLASS_PATH ".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
- EnVar::SetHKLM
- ;EnVar::AddValue "Path" "$INSTDIR\jdk1.8\bin;$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;"
- EnVar::AddValue "Path" "$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;"
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
- ;nsExec::ExecToStack '"$INSTDIR\tools\env_install.bat" $INSTDIR '
-
- FunctionEnd
- Function un.OnEnvDownInstall
- EnVar::SetHKLM
- EnVar::Delete "FDMGEA_HOME" "$INSTDIR"
- ;EnVar::Delete "JAVA_HOME" "$INSTDIR\jdk1.8"
- EnVar::Delete "MYSQL_HOME" "$INSTDIR\mysql"
- EnVar::Delete "REDIS_HOME" "$INSTDIR\redis"
- EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII"
- EnVar::Delete "MONGODB_HOME" "$INSTDIR\mongodb"
- ;EnVar::Delete "CLASS_PATH" "%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
- ;EnVar::DeleteValue "PATH" "%JAVA_HOME%\bin"
- EnVar::DeleteValue "PATH" "$INSTDIR\mysql\bin"
- EnVar::DeleteValue "PATH" "$INSTDIR\mongodb\bin"
- EnVar::DeleteValue "PATH" "$INSTDIR\redis"
- EnVar::DeleteValue "PATH" "$INSTDIR\CGAII"
- EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\lib"
- ;nsExec::ExecToStack '"$INSTDIR\tools\uninstall.bat" $INSTDIR '
- FunctionEnd
- Function un.installService
-
- ${If} $sReserveData == 1
- ; CreateDirectory $INSTDIR\USER_DATA\static
- ; CreateDirectory $INSTDIR\USER_DATA\pro
- ;CopyFiles /SILENT $INSTDIR\4DKK_PROGRAM_STATIC\*.* $INSTDIR\USER_DATA\static
- ;CopyFiles /SILENT $INSTDIR\4DKK_PROGRAM_DATA\*.* $INSTDIR\USER_DATA\pro
- ${EndIf}
- nsExec::ExecToStack '"$INSTDIR\tools\unservice.bat" $INSTDIR '
- SimpleSC::ExistsService "lasermongodb"
- Pop $0
- ${If} $0 == 0
- SimpleSC::StopService "lasermongodb" 0 30
- SimpleSC::RemoveService "lasermongodb"
- ${EndIf}
- SimpleSC::ExistsService "lasermysql"
- Pop $0
- ${If} $0 == 0
- SimpleSC::StopService "lasermysql" 0 30
- SimpleSC::RemoveService "lasermysql"
- ${EndIf}
- SimpleSC::ExistsService "laserredis"
- Pop $0
- ${If} $0 == 0
- SimpleSC::StopService "laserredis" 0 30
- SimpleSC::RemoveService "laserredis"
- ${EndIf}
- SimpleSC::ExistsService "checkLaserProcess"
- Pop $0
- ${If} $0 == 0
- SimpleSC::StopService "checkLaserProcess" 0 30
- SimpleSC::RemoveService "checkLaserProcess"
- ${EndIf}
- FunctionEnd
- Function installService
- ${StrRep} $0 '$INSTDIR\mysql' '\' '\\'
- StrCpy $basedir $0
- ${StrRep} $0 '$INSTDIR\mysql\data' '\' '\\'
- StrCpy $datadir $0
- ${StrRep} $0 '$INSTDIR\mysql\logs.log' '\' '\\'
- StrCpy $logError $0
- WriteINIStr $INSTDIR\mysql\my.ini mysqld port 3307
- WriteINIStr $INSTDIR\mysql\my.ini mysqld basedir $basedir
- WriteINIStr $INSTDIR\mysql\my.ini mysqld datadir $datadir
- WriteINIStr $INSTDIR\mysql\my.ini mysqld log-error $logError
- WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connections 1000
- WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connect_errors 10
- WriteINIStr $INSTDIR\mysql\my.ini mysqld character-set-server utf8mb4
- WriteINIStr $INSTDIR\mysql\my.ini mysqld default-storage-engine INNODB
- WriteINIStr $INSTDIR\mysql\my.ini mysqld default_authentication_plugin mysql_native_password
- WriteINIStr $INSTDIR\mysql\my.ini mysqld local_infile ON
- WriteINIStr $INSTDIR\mysql\my.ini mysql default-character-set utf8mb4
- WriteINIStr $INSTDIR\mysql\my.ini mysql local_infile ON
- WriteINIStr $INSTDIR\mysql\my.ini client port 3307
- WriteINIStr $INSTDIR\mysql\my.ini client default-character-set utf8mb4
- Sleep 2000
- SetOutPath "$INSTDIR\mysql\bin"
- Sleep 2000
- nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1'
- Pop $0
- Pop $1
- ${If} $0 = 0
- nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
- ${Else}
- ;MessageBox mb_ok "code=$0,mes=$1"
- nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\VC_redist.x64.exe /install /quiet /norestart'
- Sleep 2000
- nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --initialize-insecure --lower-case-table-names=1'
- Sleep 2000
- nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\mysql\bin\mysqld.exe --install lasermysql'
- ${EndIf}
- nsExec::ExecToStack '"cmd.exe" /c powercfg.exe /hibernate off '
- SimpleSC::StartService "lasermysql" "" 30
- SetOutPath "$INSTDIR\redis"
- nsExec::ExecToStack '"cmd.exe" /c redis-server.exe --service-install "$INSTDIR\redis\redis.windows.conf" --service-name laserredis --loglevel verbose'
- SimpleSC::StartService "laserredis" "" 30
- nsExec::ExecToStack '"cmd.exe" /c sc config laserredis start=auto'
- SimpleSC::RestartService "laserredis" "" 30
- Sleep 2000
- SetOutPath "$INSTDIR\mongodb"
- ${StrRep} $0 '$INSTDIR\mongodb\db' '\' '\\'
- StrCpy $dbpath $0
- ${StrRep} $0 '$INSTDIR\mongodb\logs\mongo.log' '\' '\\'
- StrCpy $logpath $0
- FileOpen $0 $INSTDIR\mongodb\mongo.conf w
- IfErrors done
- FileWrite $0 'port=29031$\n'
- FileWrite $0 'dbpath=$dbpath$\n'
- FileWrite $0 'logpath=$logpath$\n'
- FileWrite $0 'logappend=true$\n'
- FileWrite $0 'maxConns=1000$\n'
- FileClose $0
- done:
- nsExec::ExecToStack '"cmd.exe" /c sc create lasermongodb binpath= "$INSTDIR\mongodb\bin\mongod.exe --config $INSTDIR\mongodb\mongo.conf --service" start= auto'
- SimpleSC::StartService "lasermongodb" "" 30
- Sleep 2000
- ; IfFileExists "$INSTDIR\USER_DATA\static\*.*" 0 static_not_found
- ; CopyFiles /SILENT $INSTDIR\USER_DATA\static\*.* $INSTDIR\4DKK_PROGRAM_STATIC
- ; RMDir /r "$INSTDIR\USER_DATA\static"
- ; goto static_end_of
- ; static_not_found:
- ; goto static_end_of
- ; static_end_of:
- ; IfFileExists "$INSTDIR\USER_DATA\pro\*.*" 0 pro_not_found
- ; CopyFiles /SILENT $INSTDIR\USER_DATA\pro\*.* $INSTDIR\4DKK_PROGRAM_DATA
- ; RMDir /r "$INSTDIR\USER_DATA\pro"
- ; goto pro_end_of
- ; pro_not_found:
- ; goto pro_end_of
- ; pro_end_of:
- Sleep 2000
- ;
- ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\'
- StrCpy $buildModelPath $0
- ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\'
- StrCpy $profilePath $0
- ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\'
- StrCpy $buildCallPath $0
- ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\'
- StrCpy $binPath $0
- ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\'
- StrCpy $javaPath $0
- nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json
- nsJSON::Set /value `{}`
- nsJSON::Set `sceneConfig` /value `"config.json"`
- nsJSON::Set `sceheKey` /value `"id"`
- nsJSON::Set `sceneBundle` /value `"./build.zip"`
- nsJSON::Set `sceneBundleDir` /value `"capture"`
- nsJSON::Set `buildModelPath` /value `"$buildModelPath"`
- nsJSON::Set `javaPort` /value `9000`
- nsJSON::Set `javaPath` /value `"$javaPath"`
- nsJSON::Set `profilePath` /value `"$profilePath"`
- nsJSON::Set `buildCallPath` /value `"$buildCallPath"`
- nsJSON::Set `binPath` /value `"$binPath"`
- nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json
- nsExec::ExecToStack '"$INSTDIR\tools\service.bat" $INSTDIR '
- nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR '
- ; FileOpen $0 $INSTDIR\bin\resources\static\4dmega.vmoptions w
- ; IfErrors done
- ; FileWrite $0 '-DBIN_PATH=$INSTDIR\bin\resources\static$\n'
- ; FileWrite $0 '-DPROFILE_PATH=$INSTDIR\4DKK_PROGRAM_STATIC\$\n'
- ; FileWrite $0 '-DBUILD_MODEL_PATH=$INSTDIR\4DKK_PROGRAM_DATA\$\n'
- ; FileWrite $0 '-DBUILD_CALL_PATH=$INSTDIR\CGAII\$\n'
- ; FileWrite $0 '-Dspring.profiles.active=standAloneProd$\n'
- ; FileWrite $0 '-Dserver.port=9000$\n'
- ; FileClose $0
- ; done:
- nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\tools\MonitorPid.exe install '
- functionend
- Function OnFinished
- #MessageBox MB_YESNO|MB_ICONQUESTION "需要重启系统才能完成安装" IDNO +2
- #Reboot
- #Exec "$INSTDIR${EXE_NAME}"
- Call OnExitDUISetup
- FunctionEnd
- Function OnBtnSelectDir
- nsNiuniuSkin::SelectInstallDirEx $hInstallDlg "请选择安装路径"
- Pop $0
- ${Unless} "$0" == ""
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" $0
- ${EndUnless}
- FunctionEnd
- Function StepHeightSizeAsc
- ${ForEach} $R0 390 500 + 10
- nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
- Sleep 5
- ${Next}
- FunctionEnd
- Function StepHeightSizeDsc
- ${ForEach} $R0 480 390 - 10
- nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
- Sleep 5
- ${Next}
- FunctionEnd
- Function OnBtnShowMore
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "true"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "true"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "false"
- GetFunctionAddress $0 StepHeightSizeAsc
- BgWorker::CallAndWait
-
- nsNiuniuSkin::SetWindowSize $hInstallDlg 480 500
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
- FunctionEnd
- Function OnBtnHideMore
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "false"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "false"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "true"
- GetFunctionAddress $0 StepHeightSizeDsc
- BgWorker::CallAndWait
- nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
- FunctionEnd
- Function OnBtnShowConfig
- ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "false"
- FunctionEnd
- Function OnBtnDirPre
-
- StrCpy $R8 "确定要取消四维深时本地版安装吗?"
- StrCpy $R7 "0"
- Call ShowMsgBox
- ;nsNiuniuSkin::PrePage "wizardTab"
- FunctionEnd
- Function un.BtnDirPre
-
- StrCpy $R8 "确定要取消四维深时本地版卸载吗?"
- StrCpy $R7 "0"
- Call un.ShowMsgBox
- ;nsNiuniuSkin::PrePage "wizardTab"
- FunctionEnd
- Function un.ShowMsgBox
- nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose"
- Pop $hInstallSubDlg
- nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" "提示"
- nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8"
- ${If} "$R7" == "1"
- nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true"
- ${EndIf}
-
- nsNiuniuSkin::ShowSkinSubPage 0
- FunctionEnd
- Function un.ExitDUISetup
- nsNiuniuSkin::ExitDUISetup
- FunctionEnd
- Function un.OnBtnMin
- SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
- FunctionEnd
- Section "un.silentInstallSec" SEC02
- #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent uninstall code here."
- SectionEnd
- Function un.onUninstall
- nsProcess::_FindProcess "${EXE_NAME_EXT}"
- Pop $R0
-
- ${If} $R0 == 0
- StrCpy $R8 "${PRODUCT_NAME} 正在运行,请退出后重试!"
- StrCpy $R7 "0"
- Call un.ShowMsgBox
- goto InstallAbort
- ${EndIf}
- nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkbox_userdata" "selected"
- Pop $0
- StrCpy $sReserveData $0
- ${If} $sReserveData == 1
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" "正在准备卸载..."
- CreateDirectory $INSTDIR\USER_DATA
- ${EndIf}
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false"
- nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTPROCESSING}
-
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "min" "0"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "max" "100"
- IntOp $UnInstallValue 0 + 1
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" "正在准备卸载..."
- GetFunctionAddress $0 un.OnEnvDownInstall
- BgWorker::CallAndWait
- nsExec::ExecToStack 'cmd.exe /c powercfg.exe /hibernate on '
- GetFunctionAddress $0 un.installService
- BgWorker::CallAndWait
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" "正在卸载..."
- Call un.DeleteShotcutAndInstallInfo
-
- IntOp $UnInstallValue $UnInstallValue + 8
-
- GetFunctionAddress $0 un.RemoveFiles
- BgWorker::CallAndWait
- InstallAbort:
- FunctionEnd
- Function un.RemoveFiles
- ${Locate} "$INSTDIR" "/G=0 /M=*.*" "un.onDeleteFileFound"
-
- StrCpy $InstallState "1"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
- nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTFINISH}
- FunctionEnd
- Function un.onDeleteFileFound
- ; $R9 "path\name"
- ; $R8 "path"
- ; $R7 "name"
- ; $R6 "size" ($R6 = "" if directory, $R6 = "0" if file with /S=)
-
-
- ${If} $sReserveData == 0
- Delete "$R9"
- RMDir /r "$R9"
- RMDir "$R9"
- ${EndIf}
- ${If} $sReserveData == 1
- RMDir /r "$R8\bin"
- RMDir /r "$R8\CGAII"
- RMDir /r "$R8\mongodb"
- RMDir /r "$R8\mysql"
- RMDir /r "$R8\redis"
- RMDir /r "$R8\jdk1.8"
- ; RMDir /r "$R8\4DKK_PROGRAM_STATIC"
- ; RMDir /r "$R8\4DKK_PROGRAM_DATA"
- RMDir /r "$R8\tools"
- Delete "$R8\uninst.exe"
- ${EndIf}
- IntOp $UnInstallValue $UnInstallValue + 2
- ${If} $UnInstallValue > 100
- IntOp $UnInstallValue 100 + 0
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
- ${Else}
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "$UnInstallValue"
- nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_pos" "text" "$UnInstallValue%"
-
- #Sleep 100
- ${EndIf}
- undelete:
- Push "LocateNext"
- FunctionEnd
- #
- # 以 Unicode 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
- # 但建议 Unicode 版本优先使用此函数。
- #
- Function PathIsDBCS_W
- Exch $R0
- Push $R1
- Push $R2
- Push $R3
- System::Call "*(&w${NSIS_MAX_STRLEN}R0)p.R1"
- StrCpy $R0 0
- StrCpy $R2 $R1
- lbl_loop:
- # Unicode 版取 2 个字节长度的字符,字符串遇到 0 字符表示结束了。
- System::Call "*$R2(&i2.R3)"
- IntCmp $R3 0 lbl_done
- # Unicode 字符直接判断字符值,大于 128 的我们就视为非英文字符。
- IntCmp $R3 128 0 lbl_skip
- IntOp $R0 $R0 !
- Goto lbl_done
- lbl_skip:
- # 如果用 NSIS 3.x 这里可以用 IntPtrOp 代替。
- IntOp $R2 $R2 + 2
- Goto lbl_loop
- lbl_done:
- System::Free $R1
- Pop $R3
- Pop $R2
- Pop $R1
- Exch $R0
- FunctionEnd
- #
- # 以 ANSI 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
- # 但建议 ANSI 版本优先使用此函数。
- #
- Function PathIsDBCS_A
- Exch $R0
- Push $R1
- Push $R2
- Push $R3
- Push $R4
- System::Call "*(&m${NSIS_MAX_STRLEN}R0)p.R1"
- StrCpy $R0 0
- StrCpy $R2 $R1
- lbl_loop:
- # ANSI 版取 1 个字节长度的字符,字符串遇到 0 字符表示结束了。
- System::Call "*$R2(&i1.R3)"
- IntCmp $R3 0 lbl_done
- # ANSI 字符用 IsDBCSLeadByte 判断是否双字节字符的前导字节。
- System::Call "kernel32::IsDBCSLeadByte(iR3)i.R4"
- IntCmp $R4 0 lbl_skip
- IntOp $R0 $R0 !
- Goto lbl_done
- lbl_skip:
- # 用 CharNextA 得到下一个字符的地址 (可正确处理双字节字符)。
- System::Call "user32::CharNextA(pR2)p.R2"
- Goto lbl_loop
- lbl_done:
- Pop $R4
- Pop $R3
- Pop $R2
- Pop $R1
- Exch $R0
- FunctionEnd
- #
- # 当选择的安装路径变更时,路径为空或包含双字节字符 (不限于简体中文),都不允许继续。
- # 路径为空时,NSIS 会自行判断。
- #
- # 此示例未判断是否包含空格。如有需要,请与示例一配合使用。
- #
- Function onVerifyInstDir
- # 检查安装路径是否包含双字节字符 (不限于简体中文)。
- StrCpy $0 $INSTDIR
- StrLen $1 $0
- # 这里也可以换成 PathIsDBCS_A 以测试效果。
- ${If} $1 == 0
- Push 2
- ${Else}
- Push $INSTDIR
- Call PathIsDBCS_A
- Pop $R0
- Push $R0
- ${endif}
- lbl_done:
- FunctionEnd
- Function isEmptyDir
- # Stack -> # Stack: <directory>
- Exch $0 # Stack: $0
- Push $1 # Stack: $1, $0
- FindFirst $0 $1 "$0\*.*"
- strcmp $1 "." 0 _notempty
- FindNext $0 $1
- strcmp $1 ".." 0 _notempty
- ClearErrors
- FindNext $0 $1
- IfErrors 0 _notempty
- FindClose $0
- Pop $1 # Stack: $0
- StrCpy $0 1
- Exch $0 # Stack: 1 (true)
- goto _end
- _notempty:
- FindClose $0
- ClearErrors
- Pop $1 # Stack: $0
- StrCpy $0 0
- Exch $0 # Stack: 0 (false)
- _end:
- FunctionEnd
- Function un.isEmptyDir
- # Stack -> # Stack: <directory>
- Exch $0 # Stack: $0
- Push $1 # Stack: $1, $0
- FindFirst $0 $1 "$0\*.*"
- strcmp $1 "." 0 _notempty
- FindNext $0 $1
- strcmp $1 ".." 0 _notempty
- ClearErrors
- FindNext $0 $1
- IfErrors 0 _notempty
- FindClose $0
- Pop $1 # Stack: $0
- StrCpy $0 1
- Exch $0 # Stack: 1 (true)
- goto _end
- _notempty:
- FindClose $0
- ClearErrors
- Pop $1 # Stack: $0
- StrCpy $0 0
- Exch $0 # Stack: 0 (false)
- _end:
- FunctionEnd
|