Better update system adding remove info

10.3.x-maintenance
Miguel Angel Mulero Martinez 2018-01-02 17:19:02 +01:00
parent 8d87914aeb
commit 69f7af5a96
3 changed files with 44 additions and 9 deletions

View File

@ -1,4 +1,6 @@
!include "MUI2.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
# Receives variables from the command line
# ${VERSION} - Version to generate (x.y.z)
@ -11,7 +13,7 @@
!define COMPANY_NAME "The Betaflight open source project."
!define GROUP_NAME "Betaflight"
!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_EXECUTABLE "betaflight-configurator.exe"
!define LICENSE "..\..\LICENSE"
@ -50,11 +52,20 @@ OutFile "..\..\${DEST_FOLDER}\${FILE_NAME_INSTALLER}"
!insertmacro MUI_LANGUAGE "Korean"
!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
Section
# delete the installed files
RMDir /r $INSTDIR
# 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
@ -72,6 +83,27 @@ Section
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
@ -88,4 +120,7 @@ Section "Uninstall"
RMDir "$SMPROGRAMS\${GROUP_NAME}"
Delete "$DESKTOP\${APP_NAME}.lnk"
# remove from add/remove programs
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
SectionEnd

View File

@ -340,7 +340,7 @@ gulp.task('debug', ['dist', 'clean-debug'], function (done) {
});
// Create installer package for windows platforms
function releaseWin(arch) {
function release_win(arch) {
// Create the output directory, with write permissions
fs.mkdir(releaseDir, '0775', function(err) {
@ -454,11 +454,11 @@ gulp.task('release', ['apps', 'clean-release'], function () {
}
if (platforms.indexOf('win32') !== -1) {
releaseWin('win32');
release_win('win32');
}
if (platforms.indexOf('win64') !== -1) {
releaseWin('win64');
release_win('win64');
}
});

View File

@ -30,12 +30,12 @@
"gulp-install": "^1.1.0",
"inflection": "1.12.0",
"jquery-ui-npm": "1.12.0",
"makensis": "^0.9.0",
"nw-builder": "^3.4.1",
"os": "^0.1.1",
"platform-dependent-modules": "0.0.14",
"run-sequence": "^2.2.0",
"temp": "^0.8.3",
"makensis": "^0.9.0"
"temp": "^0.8.3"
},
"config": {
"platformDependentModules": {