|
| 1 | +!define APP_NAME "Skaffold" |
| 2 | +!define COMP_NAME "Google" |
| 3 | +!define WEB_SITE "https://skaffold.dev" |
| 4 | +!define VERSION "$%SKAFFOLD_VERSION%" |
| 5 | +!define COPYRIGHT "Google Skaffold Authors, 2021" |
| 6 | +!define DESCRIPTION "Fast. Repeatable. Simple. Local Kubernetes Development" |
| 7 | +!define INSTALLER_NAME "skaffold_installer.exe" |
| 8 | +!define MAIN_APP_EXE "skaffold.exe" |
| 9 | +!define ICON "..\..\docs\static\favicons\favicon.ico" |
| 10 | +!define BANNER "..\..\logo\skaffold.jpg" |
| 11 | +!define LICENSE_TXT "..\..\LICENSE" |
| 12 | + |
| 13 | +!define INSTALL_DIR "$PROGRAMFILES64\${APP_NAME}" |
| 14 | +!define INSTALL_TYPE "SetShellVarContext all" |
| 15 | +!define REG_ROOT "HKLM" |
| 16 | +!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}" |
| 17 | +!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" |
| 18 | + |
| 19 | +###################################################################### |
| 20 | + |
| 21 | +VIProductVersion "${VERSION}" |
| 22 | +VIAddVersionKey "ProductName" "${APP_NAME}" |
| 23 | +VIAddVersionKey "CompanyName" "${COMP_NAME}" |
| 24 | +VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" |
| 25 | +VIAddVersionKey "FileDescription" "${DESCRIPTION}" |
| 26 | +VIAddVersionKey "FileVersion" "${VERSION}" |
| 27 | + |
| 28 | +###################################################################### |
| 29 | + |
| 30 | +SetCompressor /SOLID Lzma |
| 31 | +Name "${APP_NAME}" |
| 32 | +Caption "${APP_NAME}" |
| 33 | +OutFile "${INSTALLER_NAME}" |
| 34 | +BrandingText "${APP_NAME}" |
| 35 | +InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" "" |
| 36 | +InstallDir "${INSTALL_DIR}" |
| 37 | + |
| 38 | +###################################################################### |
| 39 | + |
| 40 | +!define MUI_ICON "${ICON}" |
| 41 | +!define MUI_UNICON "${ICON}" |
| 42 | +!define MUI_WELCOMEFINISHPAGE_BITMAP "${BANNER}" |
| 43 | +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${BANNER}" |
| 44 | + |
| 45 | +###################################################################### |
| 46 | + |
| 47 | +!include "MUI2.nsh" |
| 48 | + |
| 49 | +!define MUI_ABORTWARNING |
| 50 | +!define MUI_UNABORTWARNING |
| 51 | + |
| 52 | +!insertmacro MUI_PAGE_WELCOME |
| 53 | + |
| 54 | +!ifdef LICENSE_TXT |
| 55 | +!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}" |
| 56 | +!endif |
| 57 | + |
| 58 | +!insertmacro MUI_PAGE_DIRECTORY |
| 59 | + |
| 60 | +!insertmacro MUI_PAGE_INSTFILES |
| 61 | + |
| 62 | +!insertmacro MUI_PAGE_FINISH |
| 63 | + |
| 64 | +!insertmacro MUI_UNPAGE_CONFIRM |
| 65 | + |
| 66 | +!insertmacro MUI_UNPAGE_INSTFILES |
| 67 | + |
| 68 | +!insertmacro MUI_UNPAGE_FINISH |
| 69 | + |
| 70 | +!insertmacro MUI_LANGUAGE "English" |
| 71 | + |
| 72 | +###################################################################### |
| 73 | + |
| 74 | +Section -MainProgram |
| 75 | + ${INSTALL_TYPE} |
| 76 | + |
| 77 | + SetOverwrite ifnewer |
| 78 | + SetOutPath "$INSTDIR" |
| 79 | + File /r "out\\" |
| 80 | + |
| 81 | + Rename "$INSTDIR\\skaffold-windows-amd64.exe" "$INSTDIR\\skaffold.exe" |
| 82 | + |
| 83 | + EnVar::AddValue "PATH" "$INSTDIR" |
| 84 | + Pop $0 |
| 85 | + DetailPrint "EnVar::AddValue returned=|$0|" |
| 86 | + |
| 87 | +SectionEnd |
| 88 | + |
| 89 | +###################################################################### |
| 90 | + |
| 91 | +Section -Icons_Reg |
| 92 | +SetOutPath "$INSTDIR" |
| 93 | +WriteUninstaller "$INSTDIR\uninstall.exe" |
| 94 | + |
| 95 | +CreateDirectory "$SMPROGRAMS\${APP_NAME}" |
| 96 | +CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" |
| 97 | +CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" |
| 98 | +CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" |
| 99 | + |
| 100 | +!ifdef WEB_SITE |
| 101 | +WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}" |
| 102 | +CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url" |
| 103 | +!endif |
| 104 | + |
| 105 | +WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}" |
| 106 | +WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}" |
| 107 | +WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe" |
| 108 | +WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}" |
| 109 | +WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}" |
| 110 | +WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}" |
| 111 | + |
| 112 | +!ifdef WEB_SITE |
| 113 | +WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}" |
| 114 | +!endif |
| 115 | +SectionEnd |
| 116 | + |
| 117 | +###################################################################### |
| 118 | + |
| 119 | +Section Uninstall |
| 120 | +${INSTALL_TYPE} |
| 121 | + |
| 122 | +RmDir /r "$INSTDIR" |
| 123 | + |
| 124 | +; Delete a value from a variable |
| 125 | +EnVar::DeleteValue "PATH" "$INSTDIR" |
| 126 | +Pop $0 |
| 127 | +DetailPrint "EnVar::DeleteValue returned=|$0|" |
| 128 | + |
| 129 | +Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" |
| 130 | +Delete "$SMPROGRAMS\${APP_NAME}\Uninstall ${APP_NAME}.lnk" |
| 131 | +!ifdef WEB_SITE |
| 132 | +Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Website.lnk" |
| 133 | +!endif |
| 134 | +Delete "$DESKTOP\${APP_NAME}.lnk" |
| 135 | + |
| 136 | +RmDir "$SMPROGRAMS\${APP_NAME}" |
| 137 | + |
| 138 | +DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}" |
| 139 | +DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}" |
| 140 | +SectionEnd |
0 commit comments