Skip to content

Instantly share code, notes, and snippets.

@HybridEidolon
Created July 23, 2010 23:15
Show Gist options
  • Save HybridEidolon/488201 to your computer and use it in GitHub Desktop.
Save HybridEidolon/488201 to your computer and use it in GitHub Desktop.
# Minecraft NSIS Installer Script
# Maintainer: Furyhunter <furyhunter600@gmail.com>
#
# Files:
# Minecraft.exe
Name "Minecraft"
OutFile "minecraft-win32-install.exe"
InstallDir "$PROGRAMFILES\Minecraft"
Section Minecraft
SetShellVarContext all
MessageBox MB_YESNO|MB_ICONQUESTION \
"This will install Minecraft. Do you wish to continue?" \
IDNO End
SetOutPath "$INSTDIR"
File "Minecraft.exe"
CreateDirectory "$SMPROGRAMS\Minecraft"
CreateShortCut "$SMPROGRAMS\Minecraft\Minecraft.lnk" "$INSTDIR\minecraft.exe"
# Add uninstaller information
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft" "DisplayName" "Minecraft"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft" "Publisher" "Mojang Software"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft" "NoRepair" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft" "InstallLocation" "$\"$INSTDIR$\""
WriteUninstaller "$INSTDIR\Uninstall.exe"
Goto Success
End:
Quit
Success:
SectionEnd
Section Uninstall
SetShellVarContext all
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\minecraft.exe"
Delete "$SMPROGRAMS\Minecraft\Minecraft.lnk"
RMDir "$SMPROGRAMS\Minecraft"
RMDir "$INSTDIR"
# Delete user information?
MessageBox MB_YESNO|MB_ICONQUESTION \
"Uninstall user game data? This will delete all world saves and downloaded content from the current Windows user account." \
IDNO FinishUninstall IDYES RemoveUserData
RemoveUserData:
SetShellVarContext current
RMDir /r "$APPDATA\.minecraft"
Goto FinishUninstall
# Remove uninstaller information
FinishUninstall:
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Minecraft"
SectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment