-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83f522a
commit ee0ed30
Showing
6 changed files
with
822 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
!include "MUI2.nsh" | ||
!include "FileFunc.nsh" | ||
!include "LogicLib.nsh" | ||
|
||
# Receives variables from the command line | ||
# ${VERSION} - Version to generate (x.y.z) | ||
# ${PLATFORM} - Platform to generate (win32 or win64) | ||
# ${DEST_FOLDER} - Destination folder for the installer files | ||
|
||
# Some definitions | ||
!define SOURCE_FILES "..\..\apps\cleanflight-blackbox-explorer\${PLATFORM}\*" | ||
!define APP_NAME "Cleanflight Blackbox Explorer" | ||
!define COMPANY_NAME "Cleanflight Team" | ||
!define GROUP_NAME "Cleanflight" | ||
!define FOLDER_NAME "Cleanflight-Blackbox-Explorer" | ||
!define FILE_NAME_INSTALLER "cleanflight-blackbox-explorer-installer_${VERSION}_${PLATFORM}.exe" | ||
!define FILE_NAME_UNINSTALLER "uninstall-cleanflight-blackbox-explorer.exe" | ||
!define FILE_NAME_EXECUTABLE "cleanflight-blackbox-explorer.exe" | ||
!define LICENSE "..\..\LICENSE" | ||
!define MUI_ICON ".\cf_installer_icon.ico" | ||
!define MUI_UNICON ".\cf_uninstaller_icon.ico" | ||
|
||
Name "${APP_NAME}" | ||
BrandingText "${COMPANY_NAME}" | ||
|
||
# set the icon | ||
|
||
# define the resulting installer's name: | ||
OutFile "..\..\${DEST_FOLDER}\${FILE_NAME_INSTALLER}" | ||
|
||
# set the default installation directory | ||
!if ${PLATFORM} == 'win64' | ||
InstallDir "$PROGRAMFILES64\${GROUP_NAME}\${FOLDER_NAME}\" | ||
!else | ||
InstallDir "$PROGRAMFILES\${GROUP_NAME}\${FOLDER_NAME}\" | ||
!endif | ||
|
||
# app dialogs | ||
!insertmacro MUI_PAGE_WELCOME | ||
!insertmacro MUI_PAGE_LICENSE ${LICENSE} | ||
!insertmacro MUI_PAGE_DIRECTORY | ||
!insertmacro MUI_PAGE_INSTFILES | ||
|
||
!define MUI_FINISHPAGE_RUN "$INSTDIR\${FILE_NAME_EXECUTABLE}" | ||
|
||
!insertmacro MUI_PAGE_FINISH | ||
!insertmacro MUI_LANGUAGE "English" | ||
|
||
# default install dir, readed from registry from latest installation | ||
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "InstallLocation" | ||
|
||
# default section start | ||
Section | ||
|
||
# remove the older version | ||
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"InstallLocation" | ||
|
||
${If} $R0 != "" | ||
# delete the installed files of the older version | ||
RMDir /r $R0 | ||
${EndIf} | ||
|
||
# define the path to which the installer should install | ||
SetOutPath $INSTDIR | ||
|
||
# specify the files to go in the output path | ||
File /r ${SOURCE_FILES} | ||
|
||
# create the uninstaller | ||
WriteUninstaller "$INSTDIR\${FILE_NAME_UNINSTALLER}" | ||
|
||
# create shortcuts in the start menu and on the desktop | ||
CreateDirectory "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}" | ||
CreateShortCut "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME}.lnk" "$INSTDIR\${FILE_NAME_EXECUTABLE}" | ||
CreateShortCut "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\Uninstall ${APP_NAME}.lnk" "$INSTDIR\${FILE_NAME_UNINSTALLER}" | ||
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${FILE_NAME_EXECUTABLE}" | ||
|
||
# include in add/remove programs | ||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"Publisher" "${COMPANY_NAME}" | ||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"DisplayName" "${APP_NAME}" | ||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"DisplayIcon" "$\"$INSTDIR\${FILE_NAME_EXECUTABLE}$\"" | ||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"UninstallString" "$\"$INSTDIR\${FILE_NAME_UNINSTALLER}$\"" | ||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"InstallLocation" "$INSTDIR" | ||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"DisplayVersion" "${VERSION}" | ||
|
||
# estimate the size | ||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 | ||
IntFmt $0 "0x%08X" $0 | ||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \ | ||
"EstimatedSize" "$0" | ||
|
||
|
||
SectionEnd | ||
|
||
# create a section to define what the uninstaller does | ||
Section "Uninstall" | ||
|
||
# delete the installed files | ||
RMDir /r $INSTDIR | ||
|
||
# delete the shortcuts | ||
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME}.lnk" | ||
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\Uninstall ${APP_NAME}.lnk" | ||
RMDir "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}" | ||
RMDir "$SMPROGRAMS\${GROUP_NAME}" | ||
Delete "$DESKTOP\${APP_NAME}.lnk" | ||
|
||
# remove from add/remove programs | ||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" | ||
|
||
SectionEnd |
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
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