forked from garethgeorge/backrest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add windows installer and tray app (garethgeorge#294)
- Loading branch information
1 parent
73c8612
commit 8a7543c
Showing
12 changed files
with
613 additions
and
43 deletions.
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
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
backrest | ||
backrest-* | ||
dist | ||
backrest.exe | ||
__debug_bin | ||
cmd/backrest/backrest | ||
*.exe |
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
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,178 @@ | ||
!define BUILD_DIR "." | ||
!define OUT_DIR "." | ||
!define APP_NAME "Backrest" | ||
!define COMP_NAME "garethgeorge" | ||
!define WEB_SITE "https://github.com/garethgeorge/backrest" | ||
!define VERSION "00.00.00.00" | ||
!define COPYRIGHT "garethgeorge 2024" | ||
!define DESCRIPTION "Application" | ||
!define LICENSE_TXT "${BUILD_DIR}\LICENSE" | ||
!define INSTALLER_NAME "${OUT_DIR}\Backrest-setup.exe" | ||
!define MAIN_APP_EXE "backrest-windows-tray.exe" | ||
!define INSTALL_TYPE "SetShellVarContext current" | ||
!define REG_ROOT "HKCU" | ||
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}" | ||
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" | ||
|
||
!define REG_START_MENU "Start Menu Folder" | ||
|
||
var SM_Folder | ||
|
||
###################################################################### | ||
|
||
VIProductVersion "${VERSION}" | ||
VIAddVersionKey "ProductName" "${APP_NAME}" | ||
VIAddVersionKey "CompanyName" "${COMP_NAME}" | ||
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" | ||
VIAddVersionKey "FileDescription" "${DESCRIPTION}" | ||
VIAddVersionKey "FileVersion" "${VERSION}" | ||
|
||
###################################################################### | ||
|
||
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" | ||
|
||
###################################################################### | ||
|
||
!include "MUI.nsh" | ||
|
||
!define MUI_ABORTWARNING | ||
!define MUI_UNABORTWARNING | ||
|
||
!insertmacro MUI_PAGE_WELCOME | ||
|
||
!ifdef LICENSE_TXT | ||
!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}" | ||
!endif | ||
|
||
!insertmacro MUI_PAGE_DIRECTORY | ||
|
||
!ifdef REG_START_MENU | ||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Backrest" | ||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}" | ||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}" | ||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}" | ||
!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder | ||
!endif | ||
|
||
!insertmacro MUI_PAGE_INSTFILES | ||
|
||
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAIN_APP_EXE}" | ||
!insertmacro MUI_PAGE_FINISH | ||
|
||
!insertmacro MUI_UNPAGE_CONFIRM | ||
|
||
!insertmacro MUI_UNPAGE_INSTFILES | ||
|
||
!insertmacro MUI_UNPAGE_FINISH | ||
|
||
!insertmacro MUI_LANGUAGE "English" | ||
|
||
###################################################################### | ||
|
||
Section -MainProgram | ||
${INSTALL_TYPE} | ||
SetOverwrite ifnewer | ||
SetOutPath "$INSTDIR" | ||
File "${BUILD_DIR}\backrest.exe" | ||
File "${BUILD_DIR}\backrest-windows-tray.exe" | ||
File "${BUILD_DIR}\LICENSE" | ||
SectionEnd | ||
|
||
###################################################################### | ||
|
||
Section "Run at startup" | ||
CreateDirectory $SMSTARTUP | ||
CreateShortcut "$SMSTARTUP\$(^Name).lnk" "$INSTDIR\${MAIN_APP_EXE}" "" "${BUILD_DIR}\icon.ico" 0 | ||
SectionEnd | ||
|
||
Section -Icons_Reg | ||
SetOutPath "$INSTDIR" | ||
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 | ||
|
||
!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 | ||
!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 | ||
|
||
!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 | ||
!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}" "DisplayVersion" "${VERSION}" | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}" | ||
|
||
!ifdef WEB_SITE | ||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}" | ||
!endif | ||
SectionEnd | ||
|
||
###################################################################### | ||
|
||
Section Uninstall | ||
${INSTALL_TYPE} | ||
Delete "$INSTDIR\backrest.exe" | ||
Delete "$INSTDIR\backrest-windows-tray.exe" | ||
Delete "$INSTDIR\LICENSE" | ||
Delete "$INSTDIR\uninstall.exe" | ||
Delete "$SMSTARTUP\$(^Name).lnk" | ||
!ifdef WEB_SITE | ||
Delete "$INSTDIR\${APP_NAME} website.url" | ||
!endif | ||
|
||
RmDir "$INSTDIR" | ||
|
||
!ifdef REG_START_MENU | ||
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder | ||
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" | ||
Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" | ||
!ifdef WEB_SITE | ||
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" | ||
!endif | ||
Delete "$DESKTOP\${APP_NAME}.lnk" | ||
|
||
RmDir "$SMPROGRAMS\$SM_Folder" | ||
!endif | ||
|
||
!ifndef REG_START_MENU | ||
Delete "$SMPROGRAMS\Backrest\${APP_NAME}.lnk" | ||
Delete "$SMPROGRAMS\Backrest\Uninstall ${APP_NAME}.lnk" | ||
!ifdef WEB_SITE | ||
Delete "$SMPROGRAMS\Backrest\${APP_NAME} Website.lnk" | ||
!endif | ||
Delete "$DESKTOP\${APP_NAME}.lnk" | ||
|
||
RmDir "$SMPROGRAMS\Backrest" | ||
!endif | ||
|
||
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}" | ||
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}" | ||
SectionEnd |
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
Oops, something went wrong.