NSIS office补丁

!include "LogicLib.nsh"
; 安装程序初始定义常量
!define PRODUCT_NAME "office 2003 sp3后续补丁集"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Flan, Inc."


SetCompressor lzma
; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------
!include "MUI.nsh"
!define MUI_WELCOMEFINISHPAGE_BITMAP "侧边栏.bmp"

!define MUI_HEADERIMAGE_BITMAP "右上角.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_COMPONENTSPAGE_SMALLDESC
; MUI 预定义常量
!define MUI_ABORTWARNING
!define MUI_ICON "setup.ico"
;!define MUI_UNICON "unistall.ico"
;注册表判断组件(自已定义的)
!define MUI_PAGE_CUSTOMFUNCTION_Pre ComponentsPre

; 欢迎页面
!insertmacro MUI_PAGE_WELCOME
; 许可协议页面
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "xp.txt"
!include "FileFunc.nsh"
!insertmacro GetFileVersion
; 组件选择页面
!insertmacro MUI_PAGE_COMPONENTS

; 安装目录选择页面
!insertmacro MUI_PAGE_DIRECTORY
; 安装过程页面
!insertmacro MUI_PAGE_INSTFILES
; 安装完成页面
!insertmacro MUI_PAGE_FINISH
; 安装卸载过程页面
;!insertmacro MUI_UNPAGE_INSTFILES
; 安装界面包含的语言设置
!insertmacro MUI_LANGUAGE "SimpChinese"
; 安装预释放文件
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; ------ MUI 现代界面定义结束 ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "officepatch.exe"
InstallDir "$TEMP"
ShowInstDetails show
InstType "自动检测安装"
SectionGroup /e "Office 2003 sp3后续补丁"
Section "Office 2003安全更新程序(KB959995)" SECof1
SectionIn 1
SetOutPath "$TEMP"
File "pat\office2003-KB959995-FullFile-CHS.exe"
 ExecWait '"$TEMP\office2003-KB959995-FullFile-CHS.exe" /Q'
SectionEnd
Section "Office 2003安全更新程序(KB953404)" SECof2
SectionIn 1
SetOutPath "$TEMP"
File "pat\office2003-KB953404-FullFile-CHS.exe"
 ExecWait '"$TEMP\office2003-KB953404-FullFile-CHS.exe" /Q'
SectionEnd
Section "Office 2003安全更新程序(KB954478)" SECof3
SectionIn 1
SetOutPath "$TEMP"
File "pat\office2003-KB954478-FullFile-CHS.exe"
 ExecWait '"$TEMP\office2003-KB954478-FullFile-CHS.exe" /Q'
SectionEnd
Section "Office 2003安全更新程序(KB956357)" SECof4
SectionIn 1
SetOutPath "$TEMP"
File "pat\office2003-KB956357-FullFile-CHS.exe"
 ExecWait '"$TEMP\office2003-KB956357-FullFile-CHS.exe" /Q'
SectionEnd

Section "Office 2003安全更新程序(KB948988)" SECof5
SectionIn 1
SetOutPath "$TEMP"
File "pat\office2003-KB948988-FullFile-CHS.exe"
 ExecWait '"$TEMP\office2003-KB948988-FullFile-CHS.exe" /Q'
SectionEnd

SectionGroupEnd

Function ComponentsPre
;下面为Office 2003 Sp3更新补丁判断,如果已经安装就不勾选相应补丁
${GetFileVersion} "$PROGRAMFILES\Microsoft Office\OFFICE11\EXCEL.EXE" $0
${If} $0 >= '11.0.8302.0'
SectionSetFlags ${secof1} 16
${Else}
 StrCmp $0 0 0 +1
${EndIf}

${GetFileVersion} "$COMMONFILES\Microsoft Shared\OFFICE11\MSO.dll" $0
${If} $0 >= '11.0.8221.0'
SectionSetFlags ${secof2} 16
${Else}
 StrCmp $0 0 0 +1
${EndIf}
${GetFileVersion} "$PROGRAMFILES\Microsoft Office\OFFICE11\GDIPLUS.DLL" $0
${If} $0 >= '11.0.8230.0'
SectionSetFlags ${secof3} 16
${Else}
 StrCmp $0 0 0 +1
${EndIf}
${GetFileVersion} "$PROGRAMFILES\Microsoft Office\OFFICE11\WINWORD.EXE" $0
${If} $0 >= '11.0.8237.0'
SectionSetFlags ${secof4} 16
${Else}
 StrCmp $0 0 0 +1
${EndIf}
${GetFileVersion} "$PROGRAMFILES\Microsoft Office\OFFICE11\POWERPNT.EXE" $0
${If} $0 >= '11.0.8227.0'
SectionSetFlags ${secof5} 16
${Else}
 StrCmp $0 0 0 +1
${EndIf}

Functionend
THE END
喜欢就支持一下吧
点赞10 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容