一个Oracle 10G 客户端(含OLE DB)的NSIS安装制作脚本
; Script generated by the HM NIS Edit Script Wizard.
; 使用了NSIS的NIS Edit脚本向导工具
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "PsmisPrint"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "广州供电局, Inc."
!define PRODUCT_WEB_SITE "http://www.sunrise.com"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\BIN\OraclePlus.reg"
; Finish page
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\BIN\regOledb.bat"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "SimpChinese"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "C:\PsmisPrint"
ShowInstDetails show
ShowUnInstDetails show
Section "MainSection" SEC01
SetOverwrite ifnewer
;目录复制
SetOutPath "$INSTDIR\nls\data"
File "G:\OLEDB\nls\data\*.nlb"
; File "G:\OLEDB\nls\data\lx40002.nlb"
; File "G:\OLEDB\nls\data\lx40001.nlb"
; File "G:\OLEDB\nls\data\lx20354.nlb"
; File "G:\OLEDB\nls\data\lx20001.nlb"
; File "G:\OLEDB\nls\data\lx10035.nlb"
; File "G:\OLEDB\nls\data\lx10001.nlb"
; File "G:\OLEDB\nls\data\lx2001f.nlb"
; File "G:\OLEDB\nls\data\lx207d0.nlb"
; File "G:\OLEDB\nls\data\lx00023.nlb"
; File "G:\OLEDB\nls\data\lx1boot.nlb"
; File "G:\OLEDB\nls\data\lx00001.nlb"
;复制到目标目录
SetOutPath "$INSTDIR\NETWORK\ADMIN"
File "G:\OLEDB\NETWORK\ADMIN\sqlnet.ora"
File "G:\OLEDB\NETWORK\ADMIN\tnsnames.ora"
SetOutPath "$INSTDIR\sqlplus\mesg"
File "G:\OLEDB\sqlplus\mesg\*.msb"
SetOutPath "$INSTDIR\oracore\mesg"
File "G:\OLEDB\oracore\mesg\*.msb"
SetOutPath "$INSTDIR\oracore\zoneinfo"
File "G:\OLEDB\oracore\zoneinfo\*.*"
SetOutPath "$INSTDIR\BIN"
File "G:\OLEDB\BIN\oraxml10.dll"
File "G:\OLEDB\BIN\oravsn10.dll"
File "G:\OLEDB\BIN\orauts.dll"
File "G:\OLEDB\BIN\oraunls10.dll"
File "G:\OLEDB\BIN\orasql10.dll"
File "G:\OLEDB\BIN\orasnls10.dll"
File "G:\OLEDB\BIN\ORASLAX10.DLL"
File "G:\OLEDB\BIN\orapls10.dll"
File "G:\OLEDB\BIN\oraplp10.dll"
File "G:\OLEDB\BIN\OraOLEDButl10.dll"
File "G:\OLEDB\BIN\OraOLEDBrst10.dll"
File "G:\OLEDB\BIN\OraOLEDBrmc10.dll"
File "G:\OLEDB\BIN\OraOLEDBrfc10.dll"
File "G:\OLEDB\BIN\OraOLEDBpus10.dll"
File "G:\OLEDB\BIN\OraOLEDBgmr10.dll"
File "G:\OLEDB\BIN\OraOLEDB10zhs.dll"
File "G:\OLEDB\BIN\OraOLEDB10us.dll"
File "G:\OLEDB\BIN\OraOLEDB10.tlb"
File "G:\OLEDB\BIN\OraOLEDB10.dll"
File "G:\OLEDB\BIN\oraocrb10.dll"
File "G:\OLEDB\BIN\oraocr10.dll"
File "G:\OLEDB\BIN\orantns10.dll"
File "G:\OLEDB\BIN\orantcp10.dll"
File "G:\OLEDB\BIN\oranro10.dll"
File "G:\OLEDB\BIN\orannzsbb10.dll"
File "G:\OLEDB\BIN\oranls10.dll"
File "G:\OLEDB\BIN\oranldap10.dll"
File "G:\OLEDB\BIN\oranl10.dll"
File "G:\OLEDB\BIN\oranhost10.dll"
File "G:\OLEDB\BIN\orancrypt10.dll"
File "G:\OLEDB\BIN\orancds10.dll"
File "G:\OLEDB\BIN\oran10.dll"
File "G:\OLEDB\BIN\oraldapclnt10.dll"
File "G:\OLEDB\BIN\orahasgen10.dll"
File "G:\OLEDB\BIN\orageneric10.dll"
File "G:\OLEDB\BIN\oradc.ocx"
File "G:\OLEDB\BIN\oracore10.dll"
File "G:\OLEDB\BIN\oracommon10.dll"
File "G:\OLEDB\BIN\oraclient10.dll"
File "G:\OLEDB\BIN\OraclePlus.reg"
File "G:\OLEDB\BIN\oracle.key"
File "G:\OLEDB\BIN\oip10.tlb"
File "G:\OLEDB\BIN\oip10.dll"
File "G:\OLEDB\BIN\ociw32.dll"
File "G:\OLEDB\BIN\oci.dll"
File "G:\OLEDB\BIN\regOledb.bat"
File "G:\OLEDB\BIN\OraclePlus.reg"
File "G:\OLEDB\BIN\oledb.reg"
File "G:\OLEDB\BIN\sqlplusw.exe"
File "G:\OLEDB\BIN\sqlplus.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
;写注册表
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
;写系统环境变量 在%PATH%后增加路径
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0;$INSTDIR\BIN"
;刷新环境变量
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment"
WriteRegExpandStr HKLM "SOFTWARE\ORACLE\KEY_OraDb10g_home1" "ORACLE_HOME" "$INSTDIR"
WriteRegExpandStr HKLM "SOFTWARE\ORACLE\KEY_OraDb10g_home1" "NLS_LANG" "SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,其及所有的组件?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\BIN\regOledb.bat"
Delete "$INSTDIR\BIN\*.dll"
Delete "$INSTDIR\BIN\*.exe"
Delete "$INSTDIR\BIN\*.reg"
RMDir "$INSTDIR\BIN"
Delete "$INSTDIR\nls\data\*.nlb"
RMDir "$INSTDIR\nls\data"
Delete "$INSTDIR\NETWORK\ADMIN\*.ora"
RMDir "$INSTDIR\NETWORK\ADMIN"
RMDir "$INSTDIR\NETWORK"
Delete "$INSTDIR\sqlplus\mesg\*.msb"
RMDir "$INSTDIR\sqlplus\mesg"
RMDir "$INSTDIR\sqlplus\"
Delete "$INSTDIR\oracore\mesg\*.msb"
RMDir "$INSTDIR\oracore\mesg"
RMDir "$INSTDIR\oracore\"
Delete "G:\OLEDB\oracore\zoneinfo\*.*"
RMDir "$INSTDIR\oracore\zoneinfo"
RMDir "$INSTDIR\oracore\"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd