Created
April 1, 2011 08:19
-
-
Save EdwardIII/897877 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!macro CheckGtkSharp GTKSHARP_REQ | |
!define GTKSHARP_FILE "gtk-sharp-2.12.9-2.win32.msi" | |
!define GTKSHARP_BASE_URL "http://ftp.novell.com/pub/mono/gtk-sharp/" | |
!define GTKSHARP_DOWNLOAD_URL "${GTKSHARP_BASE_URL}${GTKSHARP_FILE}" | |
!define GTKSHARP_TEMP_FILE "$TEMP\${GTKSHARP_FILE}" | |
DetailPrint "Checking your GTK# version..." | |
Var /GLOBAL GTKSHARP_FOUND_VERSION | |
ReadRegStr $GTKSHARP_FOUND_VERSION HKLM \ | |
"SOFTWARE\Novell\GtkSharp\Version" "" | |
${VersionCompare} $GTKSHARP_FOUND_VERSION ${GTKSHARP_REQ} $R0 | |
${If} $GTKSHARP_FOUND_VERSION == "" | |
goto InstallGtkSharpConfirmation | |
${ElseIf} $R0 == "0" | |
DetailPrint "GTK# already installed" | |
goto End | |
${ElseIf} $R0 == "1" | |
DetailPrint "Newer GTK# already installed" | |
goto End | |
${ElseIf} $R0 == "2" | |
DetailPrint "Older GTK# found" | |
goto InstallGtkSharpConfirmation | |
${EndIf} | |
InstallGtkSharpConfirmation: | |
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ | |
"Your GTK# version: $GTKSHARP_FOUND_VERSION $\nRequired Version: ${GTKSHARP_REQ} or greater.$\n$\nDownload GTK# from ftp.novell.com?" \ | |
/SD IDYES IDYES InstallGtkSharp IDNO End | |
goto GiveUp ;IDCANCEL | |
InstallGtkSharp: | |
SetOutPath "$TEMP" | |
SetOverwrite on | |
DetailPrint "Beginning download of GTK#..." | |
NSISDL::download "${GTKSHARP_DOWNLOAD_URL}" "${GTKSHARP_TEMP_FILE}" | |
Pop $0 | |
${If} $0 == "cancel" | |
DetailPrint "Download failed." | |
MessageBox MB_YESNO|MB_ICONEXCLAMATION \ | |
"Download cancelled. Continue Installation?" \ | |
IDYES End IDNO GiveUp | |
${ElseIf} $0 != "success" | |
DetailPrint "Download failed." | |
MessageBox MB_YESNO|MB_ICONEXCLAMATION \ | |
"Download failed:$\n$0$\n$\nContinue Installation?" \ | |
IDYES End IDNO GiveUp | |
${EndIf} | |
DetailPrint "Download completed." | |
DetailPrint "Pausing installation while downloaded GTK# installer runs." | |
ExecWait 'msiexec /i "${GTKSHARP_TEMP_FILE}" /passive' $0 | |
DetailPrint "Completed GTK# install. Exit code = '$0'. Removing GTK# installer." | |
Delete "${GTKSHARP_TEMP_FILE}" | |
DetailPrint "GTK# installer removed." | |
# HACK: force reloading the PATH environment variable for the installer | |
Var /GLOBAL PATH | |
ReadRegStr $PATH HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" | |
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", "$PATH")' | |
# HACK: announce the PATH change to all other applications | |
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 | |
goto End | |
GiveUp: | |
Abort "Installation cancelled by user." | |
End: | |
!macroend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment