Merge pull request #844 from McGiverGim/bf-windows_rights
Win installer with/without admin rights10.3.x-maintenance
commit
8c9ca07b3f
|
@ -26,16 +26,12 @@ BrandingText "${COMPANY_NAME}"
|
||||||
!define MUI_ICON ".\bf_installer_icon.ico"
|
!define MUI_ICON ".\bf_installer_icon.ico"
|
||||||
!define MUI_UNICON ".\bf_uninstaller_icon.ico"
|
!define MUI_UNICON ".\bf_uninstaller_icon.ico"
|
||||||
|
|
||||||
|
# Request rights user level
|
||||||
|
RequestExecutionLevel highest
|
||||||
|
|
||||||
# define the resulting installer's name:
|
# define the resulting installer's name:
|
||||||
OutFile "..\..\${DEST_FOLDER}\${FILE_NAME_INSTALLER}"
|
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
|
# app dialogs
|
||||||
!insertmacro MUI_PAGE_WELCOME
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
!insertmacro MUI_PAGE_LICENSE ${LICENSE}
|
!insertmacro MUI_PAGE_LICENSE ${LICENSE}
|
||||||
|
@ -52,19 +48,62 @@ 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
|
Function .onInit
|
||||||
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" "InstallLocation"
|
|
||||||
|
|
||||||
# default section start
|
# Check if older version
|
||||||
Section
|
|
||||||
|
|
||||||
# remove the older version
|
|
||||||
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
|
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
|
||||||
"InstallLocation"
|
"InstallLocation"
|
||||||
|
|
||||||
${If} $R0 != ""
|
${If} $R0 != ""
|
||||||
|
StrCpy $INSTDIR $R0
|
||||||
|
${Else}
|
||||||
|
|
||||||
|
# Check if older version without administrative rights
|
||||||
|
ReadRegStr $R1 HKCU "Software\${GROUP_NAME}\${APP_NAME}" \
|
||||||
|
"InstallLocation"
|
||||||
|
|
||||||
|
${If} $R1 != ""
|
||||||
|
StrCpy $INSTDIR $R1
|
||||||
|
${Else}
|
||||||
|
|
||||||
|
# New version, select default folder
|
||||||
|
UserInfo::GetAccountType
|
||||||
|
Pop $R2
|
||||||
|
|
||||||
|
${If} $R2 == "Admin"
|
||||||
|
# set the default installation directory
|
||||||
|
!if ${PLATFORM} == 'win64'
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES64\${GROUP_NAME}\${FOLDER_NAME}\"
|
||||||
|
!else
|
||||||
|
StrCpy $INSTDIR "$PROGRAMFILES\${GROUP_NAME}\${FOLDER_NAME}\"
|
||||||
|
!endif
|
||||||
|
${Else}
|
||||||
|
StrCpy $INSTDIR "$DOCUMENTS\${GROUP_NAME}\${FOLDER_NAME}\"
|
||||||
|
${Endif}
|
||||||
|
${Endif}
|
||||||
|
${Endif}
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
# default section start
|
||||||
|
Section
|
||||||
|
|
||||||
|
# remove the older version, users with admin rights
|
||||||
|
ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
|
||||||
|
"InstallLocation"
|
||||||
|
|
||||||
|
${If} $R3 != ""
|
||||||
# delete the installed files of the older version
|
# delete the installed files of the older version
|
||||||
RMDir /r $R0
|
RMDir /r $R3
|
||||||
|
${Else}
|
||||||
|
# remove the older version, users without admin rights
|
||||||
|
ReadRegStr $R4 HKCU "Software\${GROUP_NAME}\${APP_NAME}" \
|
||||||
|
"InstallLocation"
|
||||||
|
|
||||||
|
${If} $R4 != ""
|
||||||
|
# delete the installed files of the older version
|
||||||
|
RMDir /r $R4
|
||||||
|
${EndIf}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
# define the path to which the installer should install
|
# define the path to which the installer should install
|
||||||
|
@ -97,6 +136,10 @@ Section
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" \
|
||||||
"DisplayVersion" "${VERSION}"
|
"DisplayVersion" "${VERSION}"
|
||||||
|
|
||||||
|
# include for users without admin rights
|
||||||
|
WriteRegStr HKCU "Software\${GROUP_NAME}\${APP_NAME}" \
|
||||||
|
"InstallLocation" "$INSTDIR"
|
||||||
|
|
||||||
# estimate the size
|
# estimate the size
|
||||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||||
IntFmt $0 "0x%08X" $0
|
IntFmt $0 "0x%08X" $0
|
||||||
|
@ -122,5 +165,7 @@ Section "Uninstall"
|
||||||
|
|
||||||
# remove from add/remove programs
|
# remove from add/remove programs
|
||||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
||||||
|
DeleteRegKey HKCU "Software\${GROUP_NAME}\${APP_NAME}"
|
||||||
|
DeleteRegKey /ifempty HKCU "Software\${GROUP_NAME}"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
Loading…
Reference in New Issue