Racketified windows installer

original commit: 72b1a3aafa63ac6536cee2a9c130468bfcd73bee
This commit is contained in:
Eli Barzilay 2010-05-25 14:50:30 -04:00
parent ab24f83a2d
commit 3d078efa5f

View File

@ -5,24 +5,24 @@
;; ==================== Configuration
;; The following should define:
;; PLTVersion, PLTVersionLong, PLTHumanName,
;; PLTDirName, PLTRegName
;; RKTVersion, RKTVersionLong, RKTHumanName,
;; RKTDirName, RKTRegName
!include plt-defs.nsh
!include racket-defs.nsh
Name "${PLTHumanName}"
Name "${RKTHumanName}"
OutFile "installer.exe"
BrandingText "${PLTHumanName}"
BrandingText "${RKTHumanName}"
BGGradient 4040A0 101020
SetCompressor /SOLID "LZMA"
InstallDir "$PROGRAMFILES\${PLTDirName}"
InstallDir "$PROGRAMFILES\${RKTDirName}"
!ifndef SimpleInstaller
InstallDirRegKey HKLM "Software\${PLTRegName}" ""
InstallDirRegKey HKLM "Software\${RKTRegName}" ""
!endif
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${PLTStartName}"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${RKTStartName}"
!define MUI_ICON "plt-installer.ico"
!define MUI_UNICON "plt-uninstaller.ico"
!define MUI_HEADERIMAGE
@ -33,16 +33,16 @@ InstallDir "$PROGRAMFILES\${PLTDirName}"
!define MUI_WELCOMEFINISHPAGE_BITMAP "plt-welcome.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "plt-welcome.bmp"
!define MUI_WELCOMEPAGE_TITLE "${PLTHumanName} Setup"
!define MUI_UNWELCOMEPAGE_TITLE "${PLTHumanName} Uninstall"
!define MUI_WELCOMEPAGE_TITLE "${RKTHumanName} Setup"
!define MUI_UNWELCOMEPAGE_TITLE "${RKTHumanName} Uninstall"
!ifdef SimpleInstaller
!define MUI_WELCOMEPAGE_TEXT "This is a simple installer for ${PLTHumanName}.$\r$\n$\r$\nIt will only create the PLT folder. To uninstall, simply remove the folder.$\r$\n$\r$\n$_CLICK"
!define MUI_WELCOMEPAGE_TEXT "This is a simple installer for ${RKTHumanName}.$\r$\n$\r$\nIt will only create the Racket folder. To uninstall, simply remove the folder.$\r$\n$\r$\n$_CLICK"
!else
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PLTHumanName}.$\r$\n$\r$\nPlease close other PLT applications (DrScheme, MrEd, MzScheme) so the installer can update relevant system files.$\r$\n$\r$\n$_CLICK"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${RKTHumanName}.$\r$\n$\r$\nPlease close other Racket applications so the installer can update relevant system files.$\r$\n$\r$\n$_CLICK"
!endif
!define MUI_UNWELCOMEPAGE_TEXT "This wizard will guide you through the removal of ${PLTHumanName}.$\r$\n$\r$\nBefore starting, make sure PLT applications (DrScheme, MrEd, MzScheme) are not running.$\r$\n$\r$\n$_CLICK"
!define MUI_UNWELCOMEPAGE_TEXT "This wizard will guide you through the removal of ${RKTHumanName}.$\r$\n$\r$\nBefore starting, make sure no Racket applications are running.$\r$\n$\r$\n$_CLICK"
!define MUI_FINISHPAGE_TITLE "${PLTHumanName}"
!define MUI_FINISHPAGE_TITLE "${RKTHumanName}"
!ifdef SimpleInstaller
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION OpenInstDir
@ -51,8 +51,8 @@ InstallDir "$PROGRAMFILES\${PLTDirName}"
FunctionEnd
!define MUI_FINISHPAGE_RUN_TEXT "Open the installation folder"
!else
!define MUI_FINISHPAGE_RUN "$INSTDIR\DrScheme.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Run DrScheme"
!define MUI_FINISHPAGE_RUN "$INSTDIR\DrRacket.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Run DrRacket"
!endif
!define MUI_FINISHPAGE_LINK "Visit the Racket web site"
!define MUI_FINISHPAGE_LINK_LOCATION "http://racket-lang.org/"
@ -60,19 +60,19 @@ InstallDir "$PROGRAMFILES\${PLTDirName}"
; !define MUI_UNFINISHPAGE_NOAUTOCLOSE ; to allow users see what was erased
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PLTRegName}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${RKTRegName}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
; Doesn't work on some non-xp machines
; !define MUI_INSTFILESPAGE_PROGRESSBAR colored
VIProductVersion "${PLTVersionLong}"
VIAddVersionKey "ProductName" "PLT Scheme"
VIAddVersionKey "Comments" "This is PLT Scheme, including DrScheme which is based on MrEd and MzScheme."
VIProductVersion "${RKTVersionLong}"
VIAddVersionKey "ProductName" "Racket"
VIAddVersionKey "Comments" "This is the Racket language, see http://racket-lang.org/."
VIAddVersionKey "CompanyName" "PLT"
VIAddVersionKey "LegalCopyright" "© PLT"
VIAddVersionKey "FileDescription" "PLT Scheme Installer"
VIAddVersionKey "FileVersion" "${PLTVersion}"
VIAddVersionKey "FileDescription" "Racket Installer"
VIAddVersionKey "FileVersion" "${RKTVersion}"
;; ==================== Variables
@ -137,36 +137,36 @@ Function myTestInstDir
FunctionEnd
!else
Function myTestInstDir
; The assumption is that users might have all kinds of ways to get a PLT
; The assumption is that users might have all kinds of ways to get a Racket
; tree, plus, they might have an old wise-based installation, so it is better
; to rely on files rather than test registry keys. Note: no version check.
; if any of these exist, then we assume it's an old installation
IfFileExists "$INSTDIR\MzScheme.exe" plt_is_installed
IfFileExists "$INSTDIR\MrEd.exe" plt_is_installed
IfFileExists "$INSTDIR\DrScheme.exe" plt_is_installed
IfFileExists "$INSTDIR\collects" plt_is_installed
Goto plt_is_not_installed
plt_is_installed:
IfFileExists "$INSTDIR\Racket.exe" racket_is_installed
IfFileExists "$INSTDIR\GRacket.exe" racket_is_installed
IfFileExists "$INSTDIR\DrRacket.exe" racket_is_installed
IfFileExists "$INSTDIR\collects" racket_is_installed
Goto racket_is_not_installed
racket_is_installed:
IfFileExists "${UNINSTEXE}" we_have_uninstall
MessageBox MB_YESNO "It appears that there is an existing PLT Scheme installation in '$INSTDIR', but no Uninstaller was found.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES maybe_remove_tree
MessageBox MB_YESNO "It appears that there is an existing Racket installation in '$INSTDIR', but no Uninstaller was found.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES maybe_remove_tree
Abort
we_have_uninstall:
MessageBox MB_YESNO "It appears that there is an existing PLT Scheme installation in '$INSTDIR'.$\r$\nDo you want to uninstall it first (recommended)?" /SD IDNO IDNO maybe_remove_tree
MessageBox MB_YESNO "It appears that there is an existing Racket installation in '$INSTDIR'.$\r$\nDo you want to uninstall it first (recommended)?" /SD IDNO IDNO maybe_remove_tree
HideWindow
ClearErrors
ExecWait '"${UNINSTEXE}" _?=$INSTDIR'
IfErrors uninstaller_problematic
IfFileExists "$INSTDIR\MzScheme.exe" uninstaller_problematic
IfFileExists "$INSTDIR\MrEd.exe" uninstaller_problematic
IfFileExists "$INSTDIR\Racket.exe" uninstaller_problematic
IfFileExists "$INSTDIR\GRacket.exe" uninstaller_problematic
BringToFront
Goto plt_is_not_installed
Goto racket_is_not_installed
uninstaller_problematic:
MessageBox MB_YESNO "Errors in uninstallation!$\r$\nDo you want to quit and sort things out now (highly recommended)?" /SD IDNO IDNO maybe_remove_tree
Quit
maybe_remove_tree:
MessageBox MB_YESNO "Since you insist, do you want to simply remove the previous directory now?$\r$\n(It is really better if you sort this out manually.)" /SD IDYES IDNO plt_is_not_installed
MessageBox MB_YESNO "Since you insist, do you want to simply remove the previous directory now?$\r$\n(It is really better if you sort this out manually.)" /SD IDYES IDNO racket_is_not_installed
RMDir /r $INSTDIR
plt_is_not_installed:
racket_is_not_installed:
FunctionEnd
!endif
@ -174,7 +174,7 @@ Section ""
SetShellVarContext all
SetDetailsPrint both
DetailPrint "Installing PLT Scheme..."
DetailPrint "Installing Racket..."
SetDetailsPrint listonly
SetOutPath "$INSTDIR"
File /a /r "plt\*.*"
@ -189,43 +189,46 @@ Section ""
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath "$INSTDIR" ; Make installed links run in INSTDIR
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\DrScheme.lnk" "$INSTDIR\DrScheme.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\PLT Documentation.lnk" "$INSTDIR\plt-help.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MrEd.lnk" "$INSTDIR\MrEd.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MzScheme.lnk" "$INSTDIR\MzScheme.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\PLT Folder.lnk" "$INSTDIR"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\DrRacket.lnk" "$INSTDIR\DrRacket.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket Documentation.lnk" "$INSTDIR\Racket Documentation.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GRacket.lnk" "$INSTDIR\GRacket.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket.lnk" "$INSTDIR\Racket.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket Folder.lnk" "$INSTDIR"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "${UNINSTEXE}"
!insertmacro MUI_STARTMENU_WRITE_END
SetDetailsPrint both
DetailPrint "Setting Registry Keys..."
SetDetailsPrint listonly
WriteRegStr HKLM "Software\${PLTRegName}" "" "$INSTDIR" ; Save folder location
WriteRegStr HKCR ".ss" "" "Scheme.Document"
WriteRegStr HKCR ".scm" "" "Scheme.Document"
WriteRegStr HKCR ".scrbl" "" "Scheme.Document"
WriteRegStr HKCR "Scheme.Document" "" "PLT Scheme Document"
WriteRegStr HKCR "Scheme.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico"
WriteRegStr HKCR "Scheme.Document\shell\open\command" "" '"$INSTDIR\DrScheme.exe" "%1"'
WriteRegStr HKLM "Software\${RKTRegName}" "" "$INSTDIR" ; Save folder location
WriteRegStr HKCR ".rkt" "" "Racket.Document"
WriteRegStr HKCR ".rktl" "" "Racket.Document"
WriteRegStr HKCR ".rktd" "" "Racket.Document"
WriteRegStr HKCR ".ss" "" "Racket.Document"
WriteRegStr HKCR ".scm" "" "Racket.Document"
WriteRegStr HKCR ".scrbl" "" "Racket.Document"
WriteRegStr HKCR "Racket.Document" "" "Racket Document"
WriteRegStr HKCR "Racket.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico"
WriteRegStr HKCR "Racket.Document\shell\open\command" "" '"$INSTDIR\DrRacket.exe" "%1"'
; Example, in case we want some things like this in the future
; WriteRegStr HKCR "Scheme.Document\shell\mzscheme" "" "Run with MzScheme"
; WriteRegStr HKCR "Scheme.Document\shell\mzscheme\command" "" '"$INSTDIR\MzScheme.exe" "-r" "%1"'
WriteRegStr HKCR ".plt" "" "Setup PLT.Document"
WriteRegStr HKCR "Setup PLT.Document" "" "PLT Scheme Package"
WriteRegStr HKCR "Setup PLT.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico"
WriteRegStr HKCR "Setup PLT.Document\shell\open\command" "" '"$INSTDIR\Setup PLT.exe" -p "%1"'
; WriteRegStr HKCR "Racket.Document\shell\racket" "" "Run with Racket"
; WriteRegStr HKCR "Racket.Document\shell\racket\command" "" '"$INSTDIR\Racket.exe" "-r" "%1"'
WriteRegStr HKCR ".plt" "" "Racket Setup.Document"
WriteRegStr HKCR "Racket Setup.Document" "" "Racket Package"
WriteRegStr HKCR "Racket Setup.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico"
WriteRegStr HKCR "Racket Setup.Document\shell\open\command" "" '"$INSTDIR\raco.exe" setup -p "%1"'
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "UninstallString" '"${UNINSTEXE}"'
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "DisplayName" "${PLTHumanName}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "DisplayIcon" "$INSTDIR\DrScheme.exe,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "DisplayVersion" "${PLTVersion}"
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "UninstallString" '"${UNINSTEXE}"'
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayName" "${RKTHumanName}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayIcon" "$INSTDIR\DrRacket.exe,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayVersion" "${RKTVersion}"
; used to also have "VersionMajor" & "VersionMinor" but looks like it's not needed
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "HelpLink" "http://racket-lang.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "URLInfoAbout" "http://racket-lang.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "Publisher" "PLT Scheme Inc."
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "NoRepair" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "HelpLink" "http://racket-lang.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "URLInfoAbout" "http://racket-lang.org/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "Publisher" "PLT Scheme Inc."
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "NoRepair" "1"
!endif
SetDetailsPrint both
@ -238,20 +241,20 @@ SectionEnd
Function un.myGUIInit
; if any of these exist, then we're fine
IfFileExists "$INSTDIR\MzScheme.exe" plt_is_installed_un
IfFileExists "$INSTDIR\MrEd.exe" plt_is_installed_un
IfFileExists "$INSTDIR\DrScheme.exe" plt_is_installed_un
IfFileExists "$INSTDIR\collects" plt_is_installed_un
MessageBox MB_YESNO "It does not appear that PLT Scheme is installed in '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES plt_is_installed_un
IfFileExists "$INSTDIR\Racket.exe" racket_is_installed_un
IfFileExists "$INSTDIR\GRacket.exe" racket_is_installed_un
IfFileExists "$INSTDIR\DrRacket.exe" racket_is_installed_un
IfFileExists "$INSTDIR\collects" racket_is_installed_un
MessageBox MB_YESNO "It does not appear that Racket is installed in '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES racket_is_installed_un
Abort "Uninstall aborted by user"
plt_is_installed_un:
racket_is_installed_un:
FunctionEnd
Section "Uninstall"
SetShellVarContext all
SetDetailsPrint both
DetailPrint "Removing the PLT Scheme installation..."
DetailPrint "Removing the Racket installation..."
SetDetailsPrint listonly
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\README*.*"
@ -259,7 +262,7 @@ Section "Uninstall"
RMDir /r "$INSTDIR\include"
RMDir /r "$INSTDIR\lib"
RMDir /r "$INSTDIR\doc"
;; these exist in PLT-Full installations
;; these exist in Racket-Full installations
RMDir /r "$INSTDIR\man"
RMDir /r "$INSTDIR\src"
Delete "${UNINSTEXE}"
@ -267,7 +270,7 @@ Section "Uninstall"
;; if the directory is opened, it will take some time to remove
Sleep 1000
IfErrors +1 uninstall_inst_dir_ok
MessageBox MB_YESNO "The PLT Scheme installation at '$INSTDIR' was not completely removed.$\r$\nForce deletion?$\r$\n(Make sure no PLT applications are running.)" /SD IDYES IDNO uninstall_inst_dir_ok
MessageBox MB_YESNO "The Racket installation at '$INSTDIR' was not completely removed.$\r$\nForce deletion?$\r$\n(Make sure no Racket applications are running.)" /SD IDYES IDNO uninstall_inst_dir_ok
RMDir /r "$INSTDIR"
IfErrors +1 uninstall_inst_dir_ok
MessageBox MB_OK "Forced deletion did not work either, you will need to clean up '$INSTDIR' manually." /SD IDOK
@ -290,13 +293,16 @@ Section "Uninstall"
SetDetailsPrint both
DetailPrint "Removing Registry Keys..."
SetDetailsPrint listonly
DeleteRegKey /ifempty HKLM "Software\${PLTRegName}\Start Menu Folder"
DeleteRegKey /ifempty HKLM "Software\${PLTRegName}"
DeleteRegKey /ifempty HKLM "Software\${RKTRegName}\Start Menu Folder"
DeleteRegKey /ifempty HKLM "Software\${RKTRegName}"
DeleteRegKey HKCR ".rkt"
DeleteRegKey HKCR ".rktl"
DeleteRegKey HKCR ".rktd"
DeleteRegKey HKCR ".ss"
DeleteRegKey HKCR ".scm"
DeleteRegKey HKCR ".scrbl"
DeleteRegKey HKCR "Scheme.Document"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}"
DeleteRegKey HKCR "Racket.Document"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}"
SetDetailsPrint both
DetailPrint "Uninstallation complete."