⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pidgin-installer.nsi

📁 Linux下的多协议即时通讯程序源代码
💻 NSI
📖 第 1 页 / 共 4 页
字号:
; Installer script for win32 Pidgin; Original Author: Herman Bloggs <hermanator12002@yahoo.com>; Updated By: Daniel Atallah <daniel_atallah@yahoo.com>; NOTE: this .NSI script is intended for NSIS 2.27;;--------------------------------;Global VariablesVar nameVar GTK_FOLDERVar ISSILENTVar STARTUP_RUN_KEYVar SPELLCHECK_SEL;--------------------------------;Configuration;The name var is set in .onInitName $name!ifdef WITH_GTKOutFile "pidgin-${PIDGIN_VERSION}.exe"!else!ifdef DEBUGOutFile "pidgin-${PIDGIN_VERSION}-debug.exe"!elseOutFile "pidgin-${PIDGIN_VERSION}-no-gtk.exe"!endif!endifSetCompressor /SOLID lzmaShowInstDetails showShowUninstDetails showSetDateSave on; $name and $INSTDIR are set in .onInit function..!include "MUI.nsh"!include "Sections.nsh"!include "WinVer.nsh"!include "LogicLib.nsh"!include "FileFunc.nsh"!insertmacro GetParameters!insertmacro GetOptions!insertmacro GetParent!include "WordFunc.nsh"!insertmacro VersionCompare!insertmacro WordFind;--------------------------------;Defines!define PIDGIN_NSIS_INCLUDE_PATH		"."!define PIDGIN_INSTALLER_DEPS			"..\..\..\..\win32-dev\pidgin-inst-deps"; Remove these and the stuff that uses them at some point!define OLD_GAIM_REG_KEY			"SOFTWARE\gaim"!define OLD_GAIM_UNINSTALL_KEY			"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"!define OLD_GAIM_UNINST_EXE			"gaim-uninst.exe"!define PIDGIN_REG_KEY				"SOFTWARE\pidgin"!define PIDGIN_UNINSTALL_KEY			"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Pidgin"!define HKLM_APP_PATHS_KEY			"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\pidgin.exe"!define STARTUP_RUN_KEY				"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"!define PIDGIN_UNINST_EXE			"pidgin-uninst.exe"!define GTK_MIN_VERSION				"2.6.10"!define GTK_REG_KEY				"SOFTWARE\GTK\2.0"!define PERL_REG_KEY				"SOFTWARE\Perl"!define PERL_DLL				"perl58.dll"!define GTK_DEFAULT_INSTALL_PATH		"$COMMONFILES\GTK\2.0"!define GTK_RUNTIME_INSTALLER			"..\..\..\..\gtk_installer\gtk-runtime*.exe"!define ASPELL_REG_KEY				"SOFTWARE\Aspell"!define DOWNLOADER_URL				"http://pidgin.im/win32/download_redir.php";--------------------------------;Version resourceVIProductVersion "${PIDGIN_PRODUCT_VERSION}"VIAddVersionKey "ProductName" "Pidgin"VIAddVersionKey "FileVersion" "${PIDGIN_VERSION}"VIAddVersionKey "ProductVersion" "${PIDGIN_VERSION}"VIAddVersionKey "LegalCopyright" ""!ifdef WITH_GTKVIAddVersionKey "FileDescription" "Pidgin Installer (w/ GTK+ Installer)"!else!ifdef DEBUGVIAddVersionKey "FileDescription" "Pidgin Installer (Debug Version)"!elseVIAddVersionKey "FileDescription" "Pidgin Installer (w/o GTK+ Installer)"!endif!endif;--------------------------------;Reserve files used in .onInit;for faster start-upReserveFile "${NSISDIR}\Plugins\System.dll"!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS!insertmacro MUI_RESERVEFILE_LANGDLL;--------------------------------;Modern UI Configuration  !define MUI_ICON				".\pixmaps\pidgin-install.ico"  !define MUI_UNICON				".\pixmaps\pidgin-install.ico"  !define MUI_WELCOMEFINISHPAGE_BITMAP		".\pixmaps\pidgin-intro.bmp"  !define MUI_HEADERIMAGE  !define MUI_HEADERIMAGE_BITMAP		".\pixmaps\pidgin-header.bmp"  ; Alter License section  !define MUI_LICENSEPAGE_BUTTON		$(PIDGIN_LICENSE_BUTTON)  !define MUI_LICENSEPAGE_TEXT_BOTTOM		$(PIDGIN_LICENSE_BOTTOM_TEXT)  !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"  !define MUI_LANGDLL_REGISTRY_KEY ${PIDGIN_REG_KEY}  !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"  !define MUI_COMPONENTSPAGE_SMALLDESC  !define MUI_ABORTWARNING  ;Finish Page config  !define MUI_FINISHPAGE_NOAUTOCLOSE  !define MUI_FINISHPAGE_RUN			"$INSTDIR\pidgin.exe"  !define MUI_FINISHPAGE_RUN_NOTCHECKED  !define MUI_FINISHPAGE_LINK			$(PIDGIN_FINISH_VISIT_WEB_SITE)  !define MUI_FINISHPAGE_LINK_LOCATION		"http://pidgin.im/win32";--------------------------------;Pages  !define MUI_PAGE_CUSTOMFUNCTION_PRE		preWelcomePage  !insertmacro MUI_PAGE_WELCOME  !insertmacro MUI_PAGE_LICENSE			"../../../COPYING"  !insertmacro MUI_PAGE_COMPONENTS!ifdef WITH_GTK  ; GTK+ install dir page  !define MUI_PAGE_CUSTOMFUNCTION_PRE		preGtkDirPage  !define MUI_PAGE_CUSTOMFUNCTION_LEAVE		postGtkDirPage  !define MUI_DIRECTORYPAGE_VARIABLE		$GTK_FOLDER  !insertmacro MUI_PAGE_DIRECTORY!endif  ; Pidgin install dir page  !insertmacro MUI_PAGE_DIRECTORY  !insertmacro MUI_PAGE_INSTFILES  !insertmacro MUI_PAGE_FINISH  !insertmacro MUI_UNPAGE_WELCOME  !insertmacro MUI_UNPAGE_CONFIRM  !insertmacro MUI_UNPAGE_INSTFILES  !insertmacro MUI_UNPAGE_FINISH;--------------------------------;Languages  ;; English goes first because its the default. The rest are  ;; in alphabetical order (at least the strings actually displayed  ;; will be).  !insertmacro MUI_LANGUAGE "English"  !insertmacro MUI_LANGUAGE "Afrikaans"  !insertmacro MUI_LANGUAGE "Albanian"  !insertmacro MUI_LANGUAGE "Bulgarian"  !insertmacro MUI_LANGUAGE "Catalan"  !insertmacro MUI_LANGUAGE "Czech"  !insertmacro MUI_LANGUAGE "Danish"  !insertmacro MUI_LANGUAGE "SimpChinese"  !insertmacro MUI_LANGUAGE "TradChinese"  !insertmacro MUI_LANGUAGE "German"  !insertmacro MUI_LANGUAGE "Spanish"  !insertmacro MUI_LANGUAGE "French"  !insertmacro MUI_LANGUAGE "Hebrew"  !insertmacro MUI_LANGUAGE "Italian"  !insertmacro MUI_LANGUAGE "Japanese"  !insertmacro MUI_LANGUAGE "Korean"  !insertmacro MUI_LANGUAGE "Kurdish"  !insertmacro MUI_LANGUAGE "Lithuanian"  !insertmacro MUI_LANGUAGE "Hungarian"  !insertmacro MUI_LANGUAGE "Dutch"  !insertmacro MUI_LANGUAGE "Norwegian"  !insertmacro MUI_LANGUAGE "Polish"  !insertmacro MUI_LANGUAGE "PortugueseBR"  !insertmacro MUI_LANGUAGE "Portuguese"  !insertmacro MUI_LANGUAGE "Romanian"  !insertmacro MUI_LANGUAGE "Russian"  !insertmacro MUI_LANGUAGE "Serbian"  !insertmacro MUI_LANGUAGE "Slovak"  !insertmacro MUI_LANGUAGE "Slovenian"  !insertmacro MUI_LANGUAGE "Finnish"  !insertmacro MUI_LANGUAGE "Swedish";--------------------------------;Translations  !define PIDGIN_DEFAULT_LANGFILE "${PIDGIN_NSIS_INCLUDE_PATH}\translations\english.nsh"  !include "${PIDGIN_NSIS_INCLUDE_PATH}\langmacros.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "AFRIKAANS"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\afrikaans.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "ALBANIAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\albanian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "BULGARIAN"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\bulgarian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "CATALAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\catalan.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "CZECH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\czech.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "DANISH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\danish.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "DUTCH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\dutch.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "ENGLISH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\english.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "FINNISH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\finnish.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "FRENCH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\french.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "GERMAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\german.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "HEBREW"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\hebrew.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "HUNGARIAN"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\hungarian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "ITALIAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\italian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "JAPANESE"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\japanese.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "KOREAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\korean.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "KURDISH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\kurdish.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "LITHUANIAN"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\lithuanian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "NORWEGIAN"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\norwegian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "POLISH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\polish.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "PORTUGUESE"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\portuguese.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "PORTUGUESEBR"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\portuguese-br.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "ROMANIAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\romanian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "RUSSIAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\russian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "SERBIAN"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\serbian-latin.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "SIMPCHINESE"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\simp-chinese.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "SLOVAK"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\slovak.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "SLOVENIAN"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\slovenian.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "SPANISH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\spanish.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "SWEDISH"		"${PIDGIN_NSIS_INCLUDE_PATH}\translations\swedish.nsh"  !insertmacro PIDGIN_MACRO_INCLUDE_LANGFILE "TRADCHINESE"	"${PIDGIN_NSIS_INCLUDE_PATH}\translations\trad-chinese.nsh";--------------------------------;Reserve Files  ; Only need this if using bzip2 compression  !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS  !insertmacro MUI_RESERVEFILE_LANGDLL  ReserveFile "${NSISDIR}\Plugins\UserInfo.dll";;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Start Install Sections ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------;Uninstall any old version of Pidgin (or Gaim)Section -SecUninstallOldPidgin  ; Check install rights..  Call CheckUserInstallRights  Pop $R0  ;First try to uninstall Pidgin  StrCpy $R4 ${PIDGIN_REG_KEY}  StrCpy $R5 ${PIDGIN_UNINSTALL_KEY}  StrCpy $R6 ${PIDGIN_UNINST_EXE}  StrCpy $R7 "Pidgin"  start_comparison:  ;If pidgin is currently set to run on startup,  ;  save the section of the Registry where the setting is before uninstalling,  ;  so we can put it back after installing the new version  ClearErrors  ReadRegStr $STARTUP_RUN_KEY HKCU "${STARTUP_RUN_KEY}" $R7  IfErrors +3  StrCpy $STARTUP_RUN_KEY "HKCU"  Goto +5  ClearErrors  ReadRegStr $STARTUP_RUN_KEY HKLM "${STARTUP_RUN_KEY}" $R7  IfErrors +2  StrCpy $STARTUP_RUN_KEY "HKLM"  StrCmp $R0 "HKLM" compare_hklm  StrCmp $R0 "HKCU" compare_hkcu done  compare_hkcu:      ReadRegStr $R1 HKCU $R4 ""      ReadRegStr $R2 HKCU $R4 "Version"      ReadRegStr $R3 HKCU "$R5" "UninstallString"      Goto try_uninstall  compare_hklm:      ReadRegStr $R1 HKLM $R4 ""      ReadRegStr $R2 HKLM $R4 "Version"      ReadRegStr $R3 HKLM "$R5" "UninstallString"  ; If a previous version exists, remove it  try_uninstall:    StrCmp $R1 "" no_version_found      ; Version key started with 0.60a3. Prior versions can't be      ; automatically uninstalled.      StrCmp $R2 "" uninstall_problem        ; Check if we have uninstall string..        IfFileExists $R3 0 uninstall_problem          ; Have uninstall string, go ahead and uninstall.          SetOverwrite on          ; Need to copy uninstaller outside of the install dir          ClearErrors          CopyFiles /SILENT $R3 "$TEMP\$R6"          SetOverwrite off          IfErrors uninstall_problem            ; Ready to uninstall..            ClearErrors            ExecWait '"$TEMP\$R6" /S _?=$R1'            IfErrors exec_error              Delete "$TEMP\$R6"            Goto done            exec_error:              Delete "$TEMP\$R6"              Goto uninstall_problem        no_version_found:          ;We've already tried to fallback to an old gaim instance          StrCmp $R7 "Gaim" done          ; If we couldn't uninstall Pidgin, try to uninstall Gaim          StrCpy $STARTUP_RUN_KEY "NONE"          StrCpy $R4 ${OLD_GAIM_REG_KEY}          StrCpy $R5 ${OLD_GAIM_UNINSTALL_KEY}          StrCpy $R6 ${OLD_GAIM_UNINST_EXE}          StrCpy $R7 "Gaim"          Goto start_comparison        uninstall_problem:          ; We can't uninstall.  Either the user must manually uninstall or we ignore and reinstall over it.          MessageBox MB_OKCANCEL $(PIDGIN_PROMPT_CONTINUE_WITHOUT_UNINSTALL) /SD IDOK IDOK done          Quit  done:SectionEnd;--------------------------------;GTK+ Runtime Install Section!ifdef WITH_GTKSection $(GTK_SECTION_TITLE) SecGtk  Call CheckUserInstallRights  Pop $R1  SetOutPath $TEMP  SetOverwrite on  File /oname=gtk-runtime.exe ${GTK_RUNTIME_INSTALLER}  SetOverwrite off  Call DoWeNeedGtk  Pop $R0  Pop $R6  StrCmp $R0 "0" have_gtk  StrCmp $R0 "1" upgrade_gtk  StrCmp $R0 "2" upgrade_gtk  ;StrCmp $R0 "3" no_gtk no_gtk  no_gtk:    StrCmp $R1 "NONE" gtk_no_install_rights    ClearErrors    ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT /D=$GTK_FOLDER'    IfErrors gtk_install_error done  upgrade_gtk:    StrCpy $GTK_FOLDER $R6    StrCmp $R0 "2" +2 ; Upgrade isn't optional    MessageBox MB_YESNO $(GTK_UPGRADE_PROMPT) /SD IDYES IDNO done    ClearErrors    ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE /S /D=$GTK_FOLDER'    IfErrors gtk_install_error done    gtk_install_error:      Delete "$TEMP\gtk-runtime.exe"      MessageBox MB_OK $(GTK_INSTALL_ERROR) /SD IDOK      Quit  have_gtk:    StrCpy $GTK_FOLDER $R6    StrCmp $R1 "NONE" done ; If we have no rights, we can't re-install    ; Even if we have a sufficient version of GTK+, we give user choice to re-install.    ClearErrors    ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT'    IfErrors gtk_install_error    Goto done  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ; end got_install rights  gtk_no_install_rights:    ; Install GTK+ to Pidgin install dir    StrCpy $GTK_FOLDER $INSTDIR    ClearErrors    ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT /D=$GTK_FOLDER'    IfErrors gtk_install_error      SetOverwrite on      ClearErrors      CopyFiles /FILESONLY "$GTK_FOLDER\bin\*.dll" $GTK_FOLDER      SetOverwrite off      IfErrors gtk_install_error        Delete "$GTK_FOLDER\bin\*.dll"        Goto done  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ; end gtk_no_install_rights  done:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -