-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve windows installer and relocate backrest on Windows to %localappdata%\programs #568
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
!define APP_NAME "Backrest" | ||
!define COMP_NAME "garethgeorge" | ||
!define WEB_SITE "https://github.com/garethgeorge/backrest" | ||
!define VERSION "00.00.00.00" | ||
!define VERSION "1.6.1.0" | ||
!define COPYRIGHT "garethgeorge 2024" | ||
!define DESCRIPTION "Application" | ||
!define LICENSE_TXT "${BUILD_DIR}\LICENSE" | ||
|
@@ -29,14 +29,16 @@ VIAddVersionKey "FileVersion" "${VERSION}" | |
|
||
###################################################################### | ||
|
||
RequestExecutionLevel user | ||
SetCompressor ZLIB | ||
Name "${APP_NAME}" | ||
Caption "${APP_NAME}" | ||
OutFile "${INSTALLER_NAME}" | ||
BrandingText "${APP_NAME}" | ||
XPStyle on | ||
InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" "" | ||
InstallDir "$PROGRAMFILES64\Backrest" | ||
InstallDir "$LOCALAPPDATA\Programs\Backrest" | ||
ManifestDPIAware true | ||
|
||
###################################################################### | ||
|
||
|
@@ -83,13 +85,14 @@ SetOutPath "$INSTDIR" | |
File "${BUILD_DIR}\backrest.exe" | ||
File "${BUILD_DIR}\backrest-windows-tray.exe" | ||
File "${BUILD_DIR}\LICENSE" | ||
File "${BUILD_DIR}\icon.ico" | ||
SectionEnd | ||
|
||
###################################################################### | ||
|
||
Section "Run at startup" | ||
CreateDirectory $SMSTARTUP | ||
CreateShortcut "$SMSTARTUP\$(^Name).lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortcut "$SMSTARTUP\$(^Name).lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "$INSTDIR\icon.ico" 0 | ||
SectionEnd | ||
|
||
Section -Icons_Reg | ||
|
@@ -99,34 +102,34 @@ WriteUninstaller "$INSTDIR\uninstall.exe" | |
!ifdef REG_START_MENU | ||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application | ||
CreateDirectory "$SMPROGRAMS\$SM_Folder" | ||
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$DESKTOP\${APP_NAME} Console.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$DESKTOP\${APP_NAME} UI.lnk" "http://localhost:9898/" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "$INSTDIR\icon.ico" 0 | ||
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "$INSTDIR\icon.ico" 0 | ||
CreateShortCut "$DESKTOP\${APP_NAME} UI.lnk" "http://localhost:9898/" "" "$INSTDIR\icon.ico" 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. neat! |
||
CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\icon.ico" 0 | ||
|
||
!ifdef WEB_SITE | ||
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}" | ||
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url" "" "$INSTDIR\icon.ico" 0 | ||
!endif | ||
!insertmacro MUI_STARTMENU_WRITE_END | ||
!endif | ||
|
||
!ifndef REG_START_MENU | ||
CreateDirectory "$SMPROGRAMS\Backrest" | ||
CreateShortCut "$SMPROGRAMS\Backrest\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$SMPROGRAMS\Backrest\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$SMPROGRAMS\Backrest\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${INSTDIR}\icon.ico" 0 | ||
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${INSTDIR}\icon.ico" 0 | ||
CreateShortCut "$SMPROGRAMS\Backrest\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" "" "${INSTDIR}\icon.ico" 0 | ||
|
||
!ifdef WEB_SITE | ||
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}" | ||
CreateShortCut "$SMPROGRAMS\Backrest\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url" "" "${BUILD_DIR}\icon.ico" 0 | ||
CreateShortCut "$SMPROGRAMS\Backrest\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url" "" "${INSTDIR}\icon.ico" 0 | ||
!endif | ||
!endif | ||
|
||
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}" | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}" | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe" | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}" | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\icon.ico" | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}" | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}" | ||
|
||
|
@@ -139,9 +142,14 @@ SectionEnd | |
|
||
Section Uninstall | ||
${INSTALL_TYPE} | ||
ExecWait "TASKKILL /IM backrest-windows-tray.exe" | ||
Sleep 1000 | ||
Delete "$INSTDIR\LICENSE" | ||
Delete "$INSTDIR\icon.ico" | ||
Delete "$INSTDIR\install.lock" | ||
Delete "$INSTDIR\restic*.exe" | ||
Delete "$INSTDIR\backrest.exe" | ||
Delete "$INSTDIR\backrest-windows-tray.exe" | ||
Delete "$INSTDIR\LICENSE" | ||
Delete "$INSTDIR\uninstall.exe" | ||
Delete "$SMSTARTUP\$(^Name).lnk" | ||
!ifdef WEB_SITE | ||
|
@@ -154,11 +162,14 @@ RmDir "$INSTDIR" | |
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder | ||
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" | ||
Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" | ||
Delete "$DESKTOP\${APP_NAME}.lnk" | ||
Delete "$DESKTOP\${APP_NAME} UI.lnk" | ||
!ifdef WEB_SITE | ||
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" | ||
!endif | ||
Delete "$DESKTOP\${APP_NAME}.lnk" | ||
|
||
|
||
RmDir "$SMPROGRAMS\$SM_Folder" | ||
!endif | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this will actually be out of date immediately with the next version, the first version of this installer will ship as 1.6.2.
I'll merge as is since it's not really a blocker, but I think I need to followup up re: automatically passing in the version from the release workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out NSIS is quite flexible and already had such a scenario covered. I will submit a new PR to have the installer grab the version from the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! Is that a built in capability of NSIS? My original thinking had been to stamp the version based on the git tag’s on the current commit — the release workflow tags a release commit with the current version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, built-in functionality. Given the format and structure of changelog.md, this should work well.