?? filezilla.nsi
字號:
;FileZilla install script
;written by Tim Kosse (mailto:tim.kosse@gmx.de)
;Compatible with NSIS Modern UI version 1.67
;Based upon example scripts from Joost Verburg
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
!include "Sections.nsh"
!define MUI_LICENSEPAGE_BGCOLOR /grey
;--------------------------------
;Product information
!define MUI_PRODUCT "FileZilla" ;Define your own software name here
!define MUI_VERSION "2.2.18" ;Define your own software version here
Name "${MUI_PRODUCT} ${MUI_VERSION}"
!define SOURCE_LOCATION "http://filezilla.sourceforge.net/install_data/mirror.php?v=2_2_18&t=src"
!define SOURCE_PACKAGE_FILE "FileZilla_2_2_18_src.zip"
!define FRENCH_DOCUMENTATION_LOCATION "http://filezilla.sourceforge.net/install_data/french_documentation/mirror.php"
!define FRENCH_DOCUMENTATION_PACKAGE_FILE "french_documentation.zip"
;--------------------------------
;Configuration
SetCompressor /SOLID lzma
;General
OutFile "../../FileZilla_setup.exe"
SetOverwrite on
AutoCloseWindow false
ShowInstDetails show
ShowUninstDetails show
;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
InstallDirRegKey HKCU "Software\${MUI_PRODUCT}" "Install_Dir"
;Remember the Start Menu Folder
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${MUI_PRODUCT}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "FileZilla"
; !define MUI_LANGDLL_ALWAYSSHOW
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "software\${MUI_PRODUCT}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
!define TEMP $R0
;--------------------------------
;Modern UI Configuration
!define MUI_ICON "..\res\filezilla.ico"
!define MUI_UNICON "uninstall.ico"
!define MUI_ABORTWARNING
;--------------------------------
; Variables
Var STARTMENU_FOLDER
Var MUI_TEMP
VAR IO_HWND
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
Page custom Settings SettingsEnd
Page custom DownloadOptions DownloadOptionsEnd
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
;English
!insertmacro MUI_LANGUAGE "English"
!include "..\LanguageDLLs\English\fz_english.nsh"
;Bulgarian
!insertmacro MUI_LANGUAGE "Bulgarian"
!include "..\LanguageDLLs\Bulgarian\fz_bulgarian.nsh"
;Catalan
!insertmacro MUI_LANGUAGE "Catalan"
!include "..\LanguageDLLs\Catalan\fz_catalan.nsh"
;Czech
!insertmacro MUI_LANGUAGE "Czech"
!include "..\LanguageDLLs\Czech\fz_czech.nsh"
;French
!insertmacro MUI_LANGUAGE "French"
!include "..\LanguageDLLs\French\fz_french.nsh"
;German
!insertmacro MUI_LANGUAGE "German"
!include "..\LanguageDLLs\German\fz_german.nsh"
;Hungarian
!insertmacro MUI_LANGUAGE "Hungarian"
!include "..\LanguageDLLs\Hungarian\fz_hungarian.nsh"
;Italian
!insertmacro MUI_LANGUAGE "Italian"
!include "..\LanguageDLLs\Italian\fz_italian.nsh"
;Japanese
!insertmacro MUI_LANGUAGE "Japanese"
!include "..\LanguageDLLs\Japanese\fz_japanese.nsh"
;Japanese
!insertmacro MUI_LANGUAGE "Korean"
!include "..\LanguageDLLs\Korean\fz_korean.nsh"
;Norwegian
!insertmacro MUI_LANGUAGE "Norwegian"
!include "..\LanguageDLLs\Norwegian\fz_norwegian.nsh"
;Polish
!insertmacro MUI_LANGUAGE "Polish"
!include "..\LanguageDLLs\Polish\fz_polish.nsh"
;Simplified Chinese
!insertmacro MUI_LANGUAGE "SimpChinese"
!include "..\LanguageDLLs\SimplifiedChinese\fz_simplifiedchinese.nsh"
;Traditional Chinese
!insertmacro MUI_LANGUAGE "TradChinese"
!include "..\LanguageDLLs\TraditionalChinese\fz_traditionalchinese.nsh"
;Russian
!insertmacro MUI_LANGUAGE "Russian"
!include "..\LanguageDLLs\Russian\fz_russian.nsh"
;Slovak
!insertmacro MUI_LANGUAGE "Slovak"
!include "..\LanguageDLLs\Slovak\fz_slovak.nsh"
;--------------------------------
;Reserve Files
;Things that need to be extracted on first (keep these lines before any File command!)
;Only useful for BZIP2 compression
!insertmacro MUI_RESERVEFILE_LANGDLL
ReserveFile "download.ini"
ReserveFile "settings.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
ReserveFile "${NSISDIR}\Plugins\NSISdl.dll"
ReserveFile "${NSISDIR}\Plugins\ZipDLL.dll"
;--------------------------------
;Installer Sections
InstType $(InstTypeStandardName)
InstType $(InstTypeFullName)
Section !$(SecFileZillaName) SecFileZilla
SectionIn 1 2 RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "..\release\FileZilla.exe"
;Delete gssapi.dll if it belongs to an old FileZilla version
IfFileExists "$INSTDIR\FileZilla.exe" "" +2
Delete "$INSTDIR\GSSApi.dll"
File "FzGSS.dll"
File "dbghelp.dll"
File "..\openssl\ssleay32.dll"
File "..\openssl\libeay32.dll"
File "..\FzSFtp\Release\FzSFtp.exe"
File "..\..\readme.htm"
File "..\..\GPL.html"
File "..\..\puttylicense.html"
File "..\..\legal.htm"
; Write the installation path into the registry
WriteRegStr HKCU SOFTWARE\FileZilla "Install_Dir" "$INSTDIR"
WriteRegStr HKLM SOFTWARE\FileZilla "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla" "DisplayName" "FileZilla (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FileZilla" "UninstallString" '"$INSTDIR\uninstall.exe"'
;Create the uninstaller
WriteUninstaller uninstall.exe
; Check for /secure parameter
Call GetParameters
Push "/secure"
Call StrStr
Pop $R1
StrCpy $R1 $R1 7
StrCmp $R1 "/secure" secure
; Skip "run in secure mode" question if running in silent mode
IfSilent NoSecure
!insertmacro MUI_INSTALLOPTIONS_READ $R1 settings.ini "Field 2" State
strcmp $R1 "1" "" NoSecure
secure:
WriteRegStr HKLM "Software\FileZilla" "Run in Secure Mode" 1
WriteRegStr HKCU "Software\FileZilla" "Run in Secure Mode" 1
goto SecureDone
NoSecure:
WriteRegStr HKLM "Software\FileZilla" "Run in Secure Mode" 0
WriteRegStr HKCU "Software\FileZilla" "Run in Secure Mode" 0
SecureDone:
; Check for /registry parameter
Call GetParameters
Push "/registry"
Call StrStr
Pop $R1
StrCpy $R1 $R1 9
StrCmp $R1 "/registry" useregistry
; Check for /forceregistry parameter
Call GetParameters
Push "/forceregistry"
Call StrStr
Pop $R1
StrCpy $R1 $R1 14
StrCmp $R1 "/forceregistry" forceregistry
; Skip storage question if running in silent mode
IfSilent usexml
!insertmacro MUI_INSTALLOPTIONS_READ $R1 settings.ini "Field 5" State
strcmp $R1 "1" usexml
!insertmacro MUI_INSTALLOPTIONS_READ $R1 settings.ini "Field 7" State
strcmp $R1 "1" forceregistry
useregistry:
WriteRegStr HKLM "Software\FileZilla" "Use Registry" 1
WriteRegStr HKCU "Software\FileZilla" "Use Registry" 1
goto storagedone
forceregistry:
WriteRegStr HKLM "Software\FileZilla" "Use Registry" 2
WriteRegStr HKCU "Software\FileZilla" "Use Registry" 2
goto storagedone
usexml:
WriteRegStr HKLM "Software\FileZilla" "Use Registry" 0
WriteRegStr HKCU "Software\FileZilla" "Use Registry" 0
storagedone:
SectionEnd
SubSection /e $(SecDocumentationName) SecDocumentation
Section $(SecEnglishDocumentationName) SecEnglishDocumentation
SectionIn 1 2
SetOutPath $INSTDIR
File "..\documentation\FileZilla.chm"
StrCpy $1 "documentation"
SectionEnd
Section $(SecFrenchDocumentationName) SecFrenchDocumentation
SectionIn 2
AddSize 241
Push $0
Push $1
SetOutPath $INSTDIR
StrCpy $0 ${FRENCH_DOCUMENTATION_PACKAGE_FILE}
StrCpy $1 ${FRENCH_DOCUMENTATION_LOCATION}
StrCpy $2 $INSTDIR
call DownloadAndExtract
Pop $2
StrCmp $2 success "" french_documentation_failure
StrCpy $2 "french_documentation"
goto french_documentation_end
french_documentation_failure:
StrCpy $2 ""
french_documentation_end:
Pop $1
Pop $0
SectionEnd
SubSectionEnd
Section $(SecLangFilesName) SecLangFiles
SectionIn 1 2
SetOutPath $INSTDIR
File "..\LanguageDLLs\Bulgarian\release\FzResBu.dll"
File "..\LanguageDLLs\Breton\release\FzResBr.dll"
File "..\LanguageDLLs\Catalan\release\FzResCa.dll"
File "..\LanguageDLLs\Czech\release\FzResCze.dll"
File "..\LanguageDLLs\SimplifiedChinese\release\FzResChs.dll"
File "..\LanguageDLLs\TraditionalChinese\release\FzResCh.dll"
File "..\LanguageDLLs\German\release\FzResDe.dll"
File "..\LanguageDLLs\Spanish\release\FzResEs.dll"
File "..\LanguageDLLs\French\release\FzResFr.dll"
File "..\LanguageDLLs\Hungarian\release\FzResHu.dll"
File "..\LanguageDLLs\Italian\release\FzResIt.dll"
File "..\LanguageDLLs\Japanese\release\FzResJp.dll"
File "..\LanguageDLLs\Korean\release\FzResKr.dll"
File "..\LanguageDLLs\Norwegian\release\FzResNor.dll"
File "..\LanguageDLLs\Polish\release\FzResPo.dll"
File "..\LanguageDLLs\Russian\release\FzResRu.dll"
File "..\LanguageDLLs\Slovak\release\FzResSk.dll"
;Write language for FileZilla into the registry
Call WriteLanguage
SectionEnd
Section $(SecSourceCodeName) SecSourceCode
SectionIn 2
AddSize 4300
Push $1
Push $2
SetOutPath $INSTDIR
StrCpy $0 ${SOURCE_PACKAGE_FILE}
StrCpy $1 ${SOURCE_LOCATION}
StrCpy $2 $INSTDIR
call DownloadAndExtract
Pop $0
StrCmp $0 success "" source_failure
StrCpy $0 "source"
goto source_end
source_failure:
StrCpy $0 ""
source_end:
Pop $2
Pop $1
SectionEnd
Section $(SecStartMenuName) SecStartMenu
SectionIn 1 2
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\FileZilla.lnk" "$INSTDIR\FileZilla.exe" "" "$INSTDIR\FileZilla.exe" 0
StrCmp $0 "source" "" +2
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\FileZilla Source Project.lnk" "$INSTDIR\source\FileZilla.sln" "" "$INSTDIR\source\FileZilla.sln" 0
StrCmp $1 "documentation" "" +2
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\FileZilla Documentation.lnk" "$INSTDIR\FileZilla.chm" "" "$INSTDIR\FileZilla.chm" 0
StrCmp $2 "french_documentation" "" +2
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\FileZilla Documentation (French).lnk" "$INSTDIR\FileZillaFrench.chm" "" "$INSTDIR\FileZillaFrench.chm" 0
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section $(SecDesktopIconName) SecDesktopIcon
SectionIn 1 2
CreateShortCut "$DESKTOP\FileZilla.lnk" "$INSTDIR\FileZilla.exe" "" "$INSTDIR\FileZilla.exe" 0
SectionEnd
Section $(SecDebugName) SecDebug
SectionIn 1 2
SetOutPath $INSTDIR
File ..\release\FIleZilla.pdb
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
;Language selection
!insertmacro MUI_LANGDLL_DISPLAY
;Init InstallOptions
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "download.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "settings.ini"
push $R0
StrCmp $LANGUAGE ${LANG_FRENCH} "" skip_preselect_french
!insertmacro SelectSection ${SecFrenchDocumentation}
skip_preselect_french:
pop $R0
FunctionEnd
Function DownloadOptions
StrCpy $R1 ""
SectionGetFlags ${SecFrenchDocumentation} $R0
Intop $R0 $R0 & "0x1"
StrCmp $R0 0 +5
StrCmp $R1 "" +2
StrCpy $R1 "$R1, "
StrCpy $R0 $(SecFrenchDocumentationName)
StrCpy $R1 "$R1$R0"
SectionGetFlags ${SecSourceCode} $R0
Intop $R0 $R0 & "0x1"
StrCmp $R0 0 +5
StrCmp $R1 "" +2
StrCpy $R1 "$R1, "
StrCpy $R0 $(SecSourceCodeName)
StrCpy $R1 "$R1$R0"
StrCmp $R1 "" "" +2
Return
!insertmacro MUI_HEADER_TEXT $(PageDownloadTitle) $(PageDownloadSubTitle)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 1" text $(DownloadDialog1)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 3" text $(DownloadDialog3)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 4" text $(DownloadDialog4)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 5" text $(DownloadDialog5)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 6" text $(DownloadDialog6)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 8" text $(DownloadDialog8)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 2" text $R1
IfSilent NoDownloadOptions
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "download.ini"
Pop $IO_HWND
!insertmacro MUI_INSTALLOPTIONS_SHOW
NoDownloadOptions:
FunctionEnd
Function DownloadOptionsEnd
; At this point the user has either pressed Next or one of our custom buttons
; We find out which by reading from the INI file
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "download.ini" "Settings" "State"
StrCmp $R0 0 validate_dldialog ; Next button?
StrCmp $R0 4 onchange_dldialog
StrCmp $R0 5 onchange_dldialog
StrCmp $R0 6 onchange_dldialog
Abort ; Return to the page
onchange_dldialog:
; Check state of the packagedir checkbox and DirRequest fields
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "download.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "download.ini" "Field 6" "State"
GetDlgItem $R2 $IO_HWND 1205 ; Use package directory checkbox
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -