home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 June / CHIP_CD_2004-06.iso / software / miranda_hit / files / mirinstsetup.exe / Miranda Installer 0.0.1.2 / MirInst.nsi < prev    next >
Encoding:
Text File  |  2004-04-20  |  6.7 KB  |  192 lines

  1. ; NSIS Script For Miranda Installer
  2. ; requires MakeNSIS v2.0b0
  3.  
  4. ; Script by Kai Blankenhorn <kai_b@users.sourceforge.net>
  5.  
  6. !include "${NSISDIR}\Contrib\Modern UI\System.nsh"
  7.  
  8. !define LONGNAME "Miranda Installer"
  9. !define SHORTNAME "MirInst"
  10.  
  11. !define MUI_PRODUCT  "${LONGNAME}"
  12. !define MUI_VERSION "0.0.1.2"
  13. Name "${MUI_PRODUCT} ${MUI_VERSION}"
  14.  
  15. !define MUI_WELCOMEPAGE
  16. !define MUI_LICENSEPAGE
  17. !define MUI_COMPONENTSPAGE
  18. !define MUI_DIRECTORYPAGE
  19. !define MUI_STARTMENUPAGE
  20. !define MUI_FINISHPAGE
  21. !define MUI_FINISHPAGE_NOAUTOCLOSE
  22. !define MUI_FINISHPAGE_RUN "$INSTDIR\${SHORTNAME}.exe"
  23. !define MUI_UNINSTALLER
  24. !define MUI_UNCONFIRMPAGE
  25. !define MUI_ABORTWARNING
  26.  
  27. !insertmacro MUI_LANGUAGE "English"
  28. ; not needed anymore (inserted automatically)
  29. ; !insertmacro MUI_SYSTEM
  30.  
  31. LangString DESC_SecProgFiles ${LANG_ENGLISH} "Copy program files and the readme file."
  32. LangString DESC_SecFileExts ${LANG_ENGLISH} "Register file types to ${LONGNAME}. This can also be done later in the program."
  33. LangString DESC_SecSource ${LANG_ENGLISH} "Copy detailed instructions on how to use ${LONGNAME} for your Miranda addon. Also contains the ${LONGNAME} source code and translation strings."
  34.  
  35. CRCCheck On
  36. OutFile "${SHORTNAME}_${MUI_VERSION}_Setup.exe"
  37. ;LicenseData "gpl.rtf"
  38. LicenseData "copying.txt"
  39.  
  40. InstType "Typical"
  41. InstType "Minimal"
  42. InstType "Developer"
  43.  
  44.  
  45.  
  46. Function .onInit
  47.   SetCompress Auto
  48.   SetOverwrite IfNewer
  49.   SetShellVarContext "all"
  50.  
  51.   StrCpy $INSTDIR ""
  52.   ;if Miranda Installer has been installed before, use old location
  53.   ReadRegStr $INSTDIR HKLM "SOFTWARE\${LONGNAME}" "Install_Dir"
  54.   StrCmp $INSTDIR "" +1 EndDetectInstallPath
  55.  
  56.   ;if Miranda is installed, use its directory as install directory
  57.   ReadRegStr $1 HKLM "SOFTWARE\Miranda" "Install_Dir"
  58.   StrCmp $1 "" NotInstalled
  59.   StrCpy $INSTDIR "$1\Tools\${SHORTNAME}"
  60.   Goto EndDetectInstallPath
  61.  
  62.   ;otherwise, use generic install directory
  63.   NotInstalled:
  64.   StrCpy $INSTDIR "$PROGRAMFILES\Miranda\Tools\${SHORTNAME}"
  65.  
  66.   EndDetectInstallPath:
  67. FunctionEnd
  68.  
  69. Section "Program files (required)" SecProgFiles
  70.   SectionIn 1 2 3 RO
  71.   SetOutPath $INSTDIR
  72.   WriteRegStr HKLM "SOFTWARE\${LONGNAME}" "Install_Dir" $INSTDIR
  73.   File "release\${SHORTNAME}.exe"
  74.   File "copying.txt"
  75. SectionEnd
  76.  
  77. Section "-Start Menu shortcuts"
  78.   SectionIn 1 3
  79.   !insertmacro MUI_STARTMENU_WRITE_BEGIN
  80.   ;Create shortcuts
  81.   CreateDirectory "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
  82.   CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\${LONGNAME}.lnk" "$INSTDIR\${SHORTNAME}.exe"
  83.   CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  84.  
  85.   ;Write shortcut location to the registry (for Uninstaller)
  86.   WriteRegStr HKLM "Software\${LONGNAME}" "Start Menu Folder" "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
  87.  
  88.   !insertmacro MUI_STARTMENU_WRITE_END
  89. SectionEnd
  90.  
  91. Section "Register file extensions" SecFileExts
  92.   SectionIn 1 3
  93.   DetailPrint "Registering application"
  94.   WriteRegStr HKCR "${SHORTNAME}" "" "${LONGNAME}"
  95.   WriteRegBin HKCR "${SHORTNAME}" "EditFlags" 00000100
  96.   WriteRegStr HKCR "${SHORTNAME}\DefaultIcon" "" "$INSTDIR\${SHORTNAME}.exe,1"
  97.   WriteRegStr HKCR "${SHORTNAME}\shell\open" "" "&Install"
  98.   WriteRegStr HKCR "${SHORTNAME}\shell\open\command" "" '"$INSTDIR\${SHORTNAME}.exe" "%1"'
  99.   ReadRegStr $0 HKCR ".zip" ""
  100.   StrCmp $0 "" NoZIP
  101.   ReadRegStr $1 HKCR "$0\shell\open\command" ""
  102.   StrCmp $0 "" NoZIP
  103.   WriteRegStr HKCR "${SHORTNAME}\shell\openZIP" "" "Open as &ZIP"
  104.   WriteRegStr HKCR "${SHORTNAME}\shell\openZIP\command" "" $1
  105.  
  106. NoZIP:
  107.   DetailPrint "Registering extensions"
  108.   WriteRegStr HKCR ".mir" "" "${SHORTNAME}"
  109.   WriteRegStr HKCR ".mir" "Content Type" "application/x-zip-mirandainstaller"
  110.   WriteRegStr HKCR ".mii" "" "${SHORTNAME}"
  111.   WriteRegStr HKCR ".mii" "Content Type" "application/x-zip-mirandainstaller"
  112.   WriteRegStr HKCR ".mis" "" "${SHORTNAME}"
  113.   WriteRegStr HKCR ".mis" "Content Type" "application/x-zip-mirandainstaller"
  114.   WriteRegStr HKCR ".mil" "" "${SHORTNAME}"
  115.   WriteRegStr HKCR ".mil" "Content Type" "application/x-zip-mirandainstaller"
  116.   WriteRegStr HKCR ".mit" "" "${SHORTNAME}"
  117.   WriteRegStr HKCR ".mit" "Content Type" "application/x-zip-mirandainstaller"
  118.   WriteRegStr HKCR ".mio" "" "${SHORTNAME}"
  119.   WriteRegStr HKCR ".mio" "Content Type" "application/x-zip-mirandainstaller"
  120.   WriteRegStr HKCR ".mic" "" "${SHORTNAME}"
  121.   WriteRegStr HKCR ".mic" "Content Type" "application/x-zip-mirandainstaller"
  122.   WriteRegStr HKCR ".mik" "" "${SHORTNAME}"
  123.   WriteRegStr HKCR ".mik" "Content Type" "application/x-zip-mirandainstaller"
  124.   WriteRegStr HKCR ".min" "" "${SHORTNAME}"
  125.   WriteRegStr HKCR ".min" "Content Type" "application/x-zip-mirandainstaller"
  126. SectionEnd
  127.  
  128. Section "Developer information" SecSource
  129.   SectionIn 3
  130.   SetOutPath $INSTDIR
  131.   File "Syntax.txt"
  132.   File "devinfo.txt"
  133.   File "Strings.txt"
  134.   SetOutPath "$INSTDIR\Source"
  135.   File "*.cpp"
  136.   File "*.h"
  137.   File "*.ico"
  138.   File "mirandainstaller.manifest"
  139.   File "Resource.rc"
  140.   File "copying.txt"
  141.   File "notes.txt"
  142.   File "MirandaInstaller.ds*"
  143.   File "MirInst.nsi"
  144.   File "hand.cur"
  145.   File /r "zlib"
  146.   File /r "langpack"
  147.   SetOutPath $INSTDIR
  148. SectionEnd
  149.  
  150. Section "Uninstall"
  151.   Delete "$INSTDIR\uninstall.exe"
  152.   Delete "$INSTDIR\${SHORTNAME}.exe"
  153.   Delete "$INSTDIR\copying.txt"
  154.   Delete "$INSTDIR\devinfo.txt"
  155.   Delete "$INSTDIR\strings.txt"
  156.   Delete "$INSTDIR\Syntax.txt"
  157.   Delete "$INSTDIR\Options.dat"
  158.   RMDir /r "$INSTDIR\Source"
  159.  
  160.   ReadRegStr $0 HKLM "SOFTWARE\${LONGNAME}" "Start Menu Folder"
  161.   StrCmp $0 "" NoStartMenu
  162.   RMDir /r "$0"
  163.  
  164. NoStartMenu:
  165.   RMDir /r $INSTDIR
  166.   DeleteRegKey HKCR "${SHORTNAME}"
  167.   DeleteRegKey HKCR ".mir"
  168.   DeleteRegKey HKCR ".mii"
  169.   DeleteRegKey HKCR ".mis"
  170.   DeleteRegKey HKCR ".mil"
  171.   DeleteRegKey HKCR ".mit"
  172.   DeleteRegKey HKCR ".mio"
  173.   DeleteRegKey HKCR ".mic"
  174.   DeleteRegKey HKCR ".mik"
  175.   DeleteRegKey HKCR ".min"
  176.   ;DeleteRegKey HKCU "SOFTWARE\${LONGNAME}"
  177.   DeleteRegKey HKLM "SOFTWARE\${LONGNAME}"
  178.   DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${LONGNAME}"
  179. SectionEnd
  180.  
  181. Section "-Uninstall Support" SecUninstall
  182.   WriteUninstaller "$INSTDIR\uninstall.exe"
  183.   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${LONGNAME}" "DisplayName" "${LONGNAME}"
  184.   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${LONGNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
  185. SectionEnd
  186.  
  187.  
  188. !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
  189.   !insertmacro MUI_DESCRIPTION_TEXT ${SecProgFiles} $(DESC_SecProgFiles)
  190.   !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExts} $(DESC_SecFileExts)
  191.   !insertmacro MUI_DESCRIPTION_TEXT ${SecSource} $(DESC_SecSource)
  192. !insertmacro MUI_FUNCTIONS_DESCRIPTION_END