mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-21 23:35:22 +03:00
Better update system adding remove info
This commit is contained in:
parent
8d87914aeb
commit
69f7af5a96
3 changed files with 44 additions and 9 deletions
|
@ -1,4 +1,6 @@
|
||||||
!include "MUI2.nsh"
|
!include "MUI2.nsh"
|
||||||
|
!include "FileFunc.nsh"
|
||||||
|
!include "LogicLib.nsh"
|
||||||
|
|
||||||
# Receives variables from the command line
|
# Receives variables from the command line
|
||||||
# ${VERSION} - Version to generate (x.y.z)
|
# ${VERSION} - Version to generate (x.y.z)
|
||||||
|
@ -11,7 +13,7 @@
|
||||||
!define COMPANY_NAME "The Betaflight open source project."
|
!define COMPANY_NAME "The Betaflight open source project."
|
||||||
!define GROUP_NAME "Betaflight"
|
!define GROUP_NAME "Betaflight"
|
||||||
!define FOLDER_NAME "Betaflight-Configurator"
|
!define FOLDER_NAME "Betaflight-Configurator"
|
||||||
!define FILE_NAME_INSTALLER "betaflight-configurator-installer-${VERSION}-${PLATFORM}.exe"
|
!define FILE_NAME_INSTALLER "betaflight-configurator-installer_${VERSION}_${PLATFORM}.exe"
|
||||||
!define FILE_NAME_UNINSTALLER "uninstall-betaflight-configurator.exe"
|
!define FILE_NAME_UNINSTALLER "uninstall-betaflight-configurator.exe"
|
||||||
!define FILE_NAME_EXECUTABLE "betaflight-configurator.exe"
|
!define FILE_NAME_EXECUTABLE "betaflight-configurator.exe"
|
||||||
!define LICENSE "..\..\LICENSE"
|
!define LICENSE "..\..\LICENSE"
|
||||||
|
@ -50,11 +52,20 @@ OutFile "..\..\${DEST_FOLDER}\${FILE_NAME_INSTALLER}"
|
||||||
!insertmacro MUI_LANGUAGE "Korean"
|
!insertmacro MUI_LANGUAGE "Korean"
|
||||||
!insertmacro MUI_LANGUAGE "Spanish"
|
!insertmacro MUI_LANGUAGE "Spanish"
|
||||||
|
|
||||||
|
# default install dir, readed from registry from latest installation
|
||||||
|
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "InstallLocation"
|
||||||
|
|
||||||
# default section start
|
# default section start
|
||||||
Section
|
Section
|
||||||
|
|
||||||
# delete the installed files
|
# remove the older version
|
||||||
RMDir /r $INSTDIR
|
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
|
# define the path to which the installer should install
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR
|
||||||
|
@ -71,6 +82,27 @@ Section
|
||||||
CreateShortCut "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME} (English).lnk" "$INSTDIR\${FILE_NAME_EXECUTABLE}" "--lang=en"
|
CreateShortCut "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME} (English).lnk" "$INSTDIR\${FILE_NAME_EXECUTABLE}" "--lang=en"
|
||||||
CreateShortCut "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\Uninstall ${APP_NAME}.lnk" "$INSTDIR\${FILE_NAME_UNINSTALLER}"
|
CreateShortCut "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\Uninstall ${APP_NAME}.lnk" "$INSTDIR\${FILE_NAME_UNINSTALLER}"
|
||||||
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${FILE_NAME_EXECUTABLE}"
|
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
|
SectionEnd
|
||||||
|
|
||||||
|
@ -83,9 +115,12 @@ Section "Uninstall"
|
||||||
# delete the shortcuts
|
# delete the shortcuts
|
||||||
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME}.lnk"
|
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME}.lnk"
|
||||||
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME} (English).lnk"
|
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\${APP_NAME} (English).lnk"
|
||||||
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\Uninstall ${APP_NAME}.lnk"
|
Delete "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}\Uninstall ${APP_NAME}.lnk"
|
||||||
RMDir "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}"
|
RMDir "$SMPROGRAMS\${GROUP_NAME}\${FOLDER_NAME}"
|
||||||
RMDir "$SMPROGRAMS\${GROUP_NAME}"
|
RMDir "$SMPROGRAMS\${GROUP_NAME}"
|
||||||
Delete "$DESKTOP\${APP_NAME}.lnk"
|
Delete "$DESKTOP\${APP_NAME}.lnk"
|
||||||
|
|
||||||
|
# remove from add/remove programs
|
||||||
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
|
@ -340,7 +340,7 @@ gulp.task('debug', ['dist', 'clean-debug'], function (done) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create installer package for windows platforms
|
// Create installer package for windows platforms
|
||||||
function releaseWin(arch) {
|
function release_win(arch) {
|
||||||
|
|
||||||
// Create the output directory, with write permissions
|
// Create the output directory, with write permissions
|
||||||
fs.mkdir(releaseDir, '0775', function(err) {
|
fs.mkdir(releaseDir, '0775', function(err) {
|
||||||
|
@ -454,11 +454,11 @@ gulp.task('release', ['apps', 'clean-release'], function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platforms.indexOf('win32') !== -1) {
|
if (platforms.indexOf('win32') !== -1) {
|
||||||
releaseWin('win32');
|
release_win('win32');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platforms.indexOf('win64') !== -1) {
|
if (platforms.indexOf('win64') !== -1) {
|
||||||
releaseWin('win64');
|
release_win('win64');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,12 @@
|
||||||
"gulp-install": "^1.1.0",
|
"gulp-install": "^1.1.0",
|
||||||
"inflection": "1.12.0",
|
"inflection": "1.12.0",
|
||||||
"jquery-ui-npm": "1.12.0",
|
"jquery-ui-npm": "1.12.0",
|
||||||
|
"makensis": "^0.9.0",
|
||||||
"nw-builder": "^3.4.1",
|
"nw-builder": "^3.4.1",
|
||||||
"os": "^0.1.1",
|
"os": "^0.1.1",
|
||||||
"platform-dependent-modules": "0.0.14",
|
"platform-dependent-modules": "0.0.14",
|
||||||
"run-sequence": "^2.2.0",
|
"run-sequence": "^2.2.0",
|
||||||
"temp": "^0.8.3",
|
"temp": "^0.8.3"
|
||||||
"makensis": "^0.9.0"
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"platformDependentModules": {
|
"platformDependentModules": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue