huangyi5209

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  0 Posts :: 13 Stories :: 0 Comments :: 0 Trackbacks

常用链接

留言簿

我参与的团队

搜索

  •  

最新评论

#
Name 
"qdzyServer"

OutFile 
"qdzyServer.exe"

CRCCheck on
XPStyle on 

SetCompressor lzma

!include MUI.nsh
!include InstallOptions.nsh

#
!insertmacro MUI_PAGE_WELCOME

Page custom GetInfos 
"" ": register page"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "SimpChinese"
#
!insertmacro MUI_PAGE_FINISH

InstallDir $PROGRAMFILES\i3NVRSystem

RequestExecutionLevel admin

Icon 
"${NSISDIR}\Contrib\Graphics\Icons\icmsMonitorUI.ico"
UninstallIcon 
"${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico"

; Pages

/* Page directory
Page instfiles 
*/


Var login
Var password
Var db
Var createdb
Var errorsrc
Var license

Function .onInit 
    InitPluginsDir
    
!insertmacro INSTALLOPTIONS_EXTRACT "config.ini"    
FunctionEnd
#SilentInstall silent

Section

    SectionIn RO
    
    ReadINIStr $license 
"$PLUGINSDIR\config.ini" "Field 2" "State"
    #StrCmp $
2 1 0 endinst
    WriteRegStr HKLM SOFTWARE\\SOBEY\\ICMS\\CONFIG 
"License" $license
    
    #StrCpy $errorsrc 
"license error"
    #Goto abortinst
    
    SetOutPath $INSTDIR
    
    File 
"binr\sblicense.lic"
    File 
"binr\AlarmPlugConfigruation.xml"
    File 
"binr\AudioEncodePlugConfigruation.xml"
    File 
"binr\iSwitchConfigruation.xml"
    File 
"binr\NetworkWatchConfig.xml"
    File 
"binr\PlugConfigruation.xml"
    File 
"binr\iswitchconfig.ini"
    File 
"binr\NVRSystmSet.ini"
    File 
"binr\sbtfsdk.ini"
    
    File 
"binr\iNVR-iCMS.sql"
    File 
"binr\restorMysql.bat"
    
    File 
"binr\iCMSAlarm.exe"
    File 
"binr\icmsmc.exe"
    File 
"binr\iSwitchServiceApp.exe"
    File 
"binr\i3NVRSystem.exe"
    
    File 
"binr\iCMSADOperator.dll"
    File 
"binr\iCMSPCommonTools.dll"
    File 
"binr\IcmspDBOperate.dll"
    File 
"binr\IcmsPIocpSocket.dll"
    File 
"binr\iCMSPLoginInfo.dll"
    File 
"binr\iCMSPSMTPEmail.dll"
    File 
"binr\IcmsPUtility.dll"
    File 
"binr\IcmsPXmlParser.dll"
    File 
"binr\iCMSSAlarmSender.dll"
    File 
"binr\icmsscmdreceiver.dll"
    File 
"binr\icmsscmdsender.dll"
    File 
"binr\icmsscommonfifo.dll"
    File 
"binr\icmssdevcheckmodule.dll"
    File 
"binr\icmssdevcontainer.dll"
    File 
"binr\iCMSSDevFileRetrieval.dll"
    File 
"binr\iCMSSDeviceDetect.dll"
    File 
"binr\icmssdeviceplugsnt.dll"
    File 
"binr\iCMSSDeviceSNCPlus.dll"
    File 
"binr\icmssdevplaybackunit.dll"
    File 
"binr\icmssfilegeneralmodule.dll"
    File 
"binr\icmssgenfilerecorder.dll"
    File 
"binr\iCMSSHttpRequest.dll"
    File 
"binr\icmssmediaplaybackman.dll"
    File 
"binr\icmssmediaswitchcenter.dll"        
    File 
"binr\iCMSSMS.dll"
    File 
"binr\icmssplaybackunit.dll"
    File 
"binr\icmssrealstreamman.dll"
    File 
"binr\icmssrealstreamservo.dll"
    File 
"binr\icmssrtpmodule.dll"
    File 
"binr\icmsssonydevpacket.dll"
    File 
"binr\iCMSSSoundForward.dll"
    File 
"binr\icmssstorageman.dll"
    File 
"binr\iCMSSTaskMan.dll"
    File 
"binr\icmsstcpmodule.dll"
    File 
"binr\iCMSSWEDEVCCTVIOBox.dll"
    File 
"binr\sbcommontoolsr.dll"
    File 
"binr\sncatdcv.dll"
    File 
"binr\snccore.dll"
    File 
"binr\SonyDiscoverPlug.dll"
    File 
"binr\icmssuploadman.dll"
    File 
"binr\icmssuploadunit.dll"
    
    File 
/r binr\MySql
    
    ; Write the License into the registry
    #WriteRegStr HKLM SOFTWARE\\SOBEY\\ICMS\\CONFIG 
"License" "ZISECAWXWHHOXRTTI"
    WriteRegStr HKLM SOFTWARE\\SOBEY\\ICMS\\CONFIG 
"i3NVRType" "i3NVR-SW09"        

    CreateShortCut 
"$DESKTOP\i3NVRSystem.lnk" "$INSTDIR\i3NVRSystem.exe"\
"" "" 2 SW_SHOWNORMAL \
"" "位置:$INSTDIR"

    WriteUninstaller 
"uninstall.exe"
    
    CreateShortCut 
"$INSTDIR\uninstall.lnk" "$INSTDIR\uninstall.exe"\
"" "" 2 SW_SHOWNORMAL \
"" "位置:$INSTDIR"

    ; import mysql script
    
    
/* ReadINIStr $login "$PLUGINSDIR\config.ini" "MyQL Setting" "Login"
    ReadINIStr $password "$PLUGINSDIR\config.ini" "MyQL Setting" "Password"
    ReadINIStr $db "$PLUGINSDIR\config.ini" "MyQL Setting" "DB"
    ReadINIStr $createdb "$PLUGINSDIR\config.ini" "MyQL Setting" "Createdb"
    
    ExecWait '"$INSTDIR\mysql\mysql" --user=$login --password=$password --execute="SHOW DATABASES;"' $0
    StrCmp $0 1 0 +4
    StrCpy $errorsrc "Wrong login or password"
    Goto abortinst
 
    DetailPrint "Running import"
 
    StrCmp $createdb 1 createdbs importdbs
 
    createdbs:
    DetailPrint "Creating database"
    ExecWait '"$INSTDIR\mysql\mysql" --user=$login --password=$password --execute="CREATE DATABASE $db"' $1
    StrCmp $1 1 0 +4
    StrCpy $errorsrc "Unable to create database"
    Goto abortinst    
 
    importdbs:
    DetailPrint "SQL file import"
    ExecWait '"$INSTDIR\mysql\mysql" --user=$login --password=$password --execute="source $INSTDIR\iNVR-iCMS.sql"' $2
    StrCmp $2 1 0 endinst
    StrCpy $errorsrc "File import error"
    Goto abortinst  
*/
  

    Execcmd::exec 
'D:\restorMysql.bat "$INSTDIR"'
       Pop $
0
       Execcmd::wait $
0
       
       #MessageBox MB_OK 
"Exit code $0"
       
       StrCmp $
0 1 0 endinst
    StrCpy $errorsrc 
"File import error"
    Goto abortinst
 
 
    abortinst:
    DetailPrint 
"                         "  
    DetailPrint 
"$\n An error occured ! $\n"
    DetailPrint 
"  $errorsrc              "
    DetailPrint 
"                         "
 
    endinst:

SectionEnd

Section 
"Uninstall"
    RMDir 
/r $INSTDIR
    Delete 
"$DESKTOP\i3NVRSystem.lnk"
    
    ; Remove registry keys
    DeleteRegKey HKLM 
"SOFTWARE\\SOBEY\\ICMS\\CONFIG"
SectionEnd

Function GetInfos 
    
!insertmacro MUI_HEADER_TEXT "register informations" "register informations "
    
!insertmacro INSTALLOPTIONS_DISPLAY "config.ini"
FunctionEnd
posted on 2011-04-20 14:23 huangyi5209 阅读(3254) 评论(0)  编辑 收藏 引用 所属分类: NSIS

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理