Ignore:
Timestamp:
2014-08-13T02:48:01+02:00 (11 years ago)
Author:
donvip
Message:

[josm_nsis] fix #josm9587 - JOSM runs with elevated permissions when run from the end of the installer:

  • update to MUI2
  • proper UAC handling (requires admin privileges)
  • locale update, proper use of $\r and $\n
  • fix typo in French translation
  • use of stdutils nsis plugin to launch JOSM as user in MUI_FINISHPAGE (ansi version until we switch to unicode installer later with NSIS 3)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/nsis/josm.nsi

    r30580 r30581  
    44
    55; Set the compression mechanism first.
    6 ; If you get an error here, please update to at least NSIS 2.07!
    76SetCompressor /SOLID lzma
     7
     8; Load StdUtils plugin (ANSI until we switch to Unicode installer with NSIS 3)
     9!addplugindir plugins/stdutils/Plugins/Release_ANSI
     10!addincludedir plugins/stdutils/Include
     11
     12!include "StdUtils.nsh"
     13
     14; make sure the installer will get elevated rights on UAC-enabled system (Vista+)
     15RequestExecutionLevel admin
    816
    917; Used to refresh the display of file association
     
    1826; ============================================================================
    1927; The name of the installer
    20 !define PROGRAM_NAME "JOSM"
    21 
    22 Name "${PROGRAM_NAME} ${VERSION}"
     28Name "JOSM ${VERSION}"
    2329
    2430; The file to write
     
    3339; ============================================================================
    3440
    35 !include "MUI.nsh"
     41!include "MUI2.nsh"
    3642
    3743; Icon of installer and uninstaller
     
    4551!define MUI_WELCOMEPAGE_TEXT $(JOSM_WELCOME_TEXT)
    4652
    47 !define MUI_FINISHPAGE_RUN "$INSTDIR\${DEST}.exe"
    48 
     53!define MUI_FINISHPAGE_RUN
     54!define MUI_FINISHPAGE_RUN_FUNCTION LaunchJOSM
     55
     56; Function used to Launch JOSM in user (non-elevated) mode
     57Function LaunchJOSM
     58  ${StdUtils.ExecShellAsUser} $0 "$INSTDIR\${DEST}.exe" "open" ""
     59FunctionEnd
    4960
    5061; ============================================================================
     
    5566!insertmacro MUI_PAGE_LICENSE "..\core\LICENSE"
    5667!insertmacro MUI_PAGE_COMPONENTS
    57 ;Page custom DisplayAdditionalTasksPage
    5868!insertmacro MUI_PAGE_DIRECTORY
    5969!insertmacro MUI_PAGE_INSTFILES
     
    7282  ;Remember the installer language
    7383  !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
    74   !define MUI_LANGDLL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM"
     84  !define MUI_LANGDLL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM"
    7585  !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
    7686 
     
    105115InstType "un.$(un.JOSM_DEFAULT_UNINSTALL)"
    106116InstType "un.$(un.JOSM_FULL_UNINSTALL)"
    107 
    108 ; ============================================================================
    109 ; Reserve Files
    110 ; ============================================================================
    111 
    112   ;Things that need to be extracted on first (keep these lines before any File command!)
    113   ;Only useful for BZIP2 compression
    114 
    115 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
    116117
    117118; ============================================================================
     
    235236
    236237Function .onInit
    237   ;Extract InstallOptions INI files
    238 ;  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "AdditionalTasksPage.ini"
    239238  !insertmacro MUI_LANGDLL_DISPLAY
    240239FunctionEnd
    241240
    242241Function un.onInit
    243 
    244242  !insertmacro MUI_UNGETLANGUAGE
    245  
    246243FunctionEnd
    247244
     
    262259
    263260; Write the uninstall keys for Windows
    264 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "DisplayVersion" "${VERSION}"
    265 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "DisplayName" "JOSM ${VERSION}"
    266 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "UninstallString" '"$INSTDIR\uninstall.exe"'
    267 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "Publisher" "The OpenStreetMap JOSM developers team, https://josm.openstreetmap.de"
    268 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "HelpLink" "mailto:josm-dev@openstreetmap.org."
    269 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "URLInfoAbout" "https://josm.openstreetmap.de"
    270 WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "URLUpdateInfo" "https://josm.openstreetmap.de"
    271 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "NoModify" 1
    272 WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM" "NoRepair" 1
     261WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "DisplayVersion" "${VERSION}"
     262WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "DisplayName" "JOSM ${VERSION}"
     263WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "UninstallString" '"$INSTDIR\uninstall.exe"'
     264WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "Publisher" "OpenStreetMap JOSM team"
     265WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "HelpLink" "mailto:josm-dev@openstreetmap.org."
     266WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "URLInfoAbout" "https://josm.openstreetmap.de"
     267WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "URLUpdateInfo" "https://josm.openstreetmap.de"
     268WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "NoModify" 1
     269WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM" "NoRepair" 1
    273270WriteUninstaller "uninstall.exe"
    274271
     
    360357SectionEnd
    361358
    362 
    363359Section "-PluginSetting"
    364360;-------------------------------------------
     
    374370FileClose $R0
    375371settings_exists:
    376 
    377 SectionEnd
    378 
     372SectionEnd
    379373
    380374Section "un.$(un.JOSM_SEC_UNINSTALL)" un.SecUinstall
     
    403397Delete "$INSTDIR\uninstall.exe"
    404398
    405 DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM"
     399DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\JOSM"
    406400DeleteRegKey HKEY_LOCAL_MACHINE "Software\${DEST}.exe"
    407401DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\${DEST}.exe"
     
    446440SectionEnd
    447441
    448 
    449442Section "-Un.Finally"
    450443;-------------------------------------------
     
    455448NoFinalErrorMsg:
    456449SectionEnd
    457 
    458450
    459451; ============================================================================
     
    469461  !insertmacro MUI_DESCRIPTION_TEXT ${SecQuickLaunchIcon} $(JOSM_SECDESC_QUICKLAUNCH_ICON)
    470462  !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExtensions} $(JOSM_SECDESC_FILE_EXTENSIONS)
    471  
    472 
    473463!insertmacro MUI_FUNCTION_DESCRIPTION_END
    474464
Note: See TracChangeset for help on using the changeset viewer.