Bläddra i källkod

fix: windows bits and pieces

jamesread 4 dagar sedan
förälder
incheckning
5092d9f3f8
4 ändrade filer med 79 tillägg och 14 borttagningar
  1. 2 2
      .github/workflows/build-and-release.yml
  2. 12 0
      var/windows/License.rtf
  3. 46 2
      var/windows/OliveTin.wxs
  4. 19 10
      var/windows/build-msi.sh

+ 2 - 2
.github/workflows/build-and-release.yml

@@ -114,9 +114,9 @@ jobs:
             integration-tests
             !integration-tests/node_modules
 
-      - name: Install wixl
+      - name: Install wixl and msitools
         if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
-        run: sudo apt-get update && sudo apt-get install -y wixl
+        run: sudo apt-get update && sudo apt-get install -y wixl msitools
 
       - name: Install goreleaser
         if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false

+ 12 - 0
var/windows/License.rtf

@@ -0,0 +1,12 @@
+{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}
+\f0\fs22
+OliveTin License Agreement\par
+\par
+OliveTin is free software licensed under the GNU Affero General Public License version 3 (AGPL-3.0).\par
+\par
+By installing OliveTin you agree to the terms of the AGPL-3.0. The full license text is available in the OliveTin source repository:\par
+\par
+https://github.com/OliveTin/OliveTin/blob/main/LICENSE\par
+\par
+Copyright (C) OliveTin contributors\par
+}

+ 46 - 2
var/windows/OliveTin.wxs

@@ -2,10 +2,10 @@
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
   <Product
     Id="*"
-    Name="OliveTin $(var.Version)"
+    Name="OliveTin"
     Language="1033"
     Version="$(var.Version)"
-    Manufacturer="James Read"
+    Manufacturer="OliveTin contributors"
     UpgradeCode="8B5E3F2A-1C4D-4E6F-9A0B-2D3C4E5F6071">
     <Package
       InstallerVersion="500"
@@ -19,9 +19,14 @@
       DowngradeErrorMessage="A newer version of OliveTin is already installed." />
     <MediaTemplate EmbedCab="yes" />
 
+    <Icon Id="OliveTinIcon" SourceFile="$(var.SourceDir)/OliveTin.exe" />
+
+    <UIRef Id="WixUI_Minimal" />
+
     <Feature Id="ProductFeature" Title="OliveTin" Level="1">
       <ComponentGroupRef Id="CG.AppFiles" />
       <ComponentRef Id="ConfigFile" />
+      <ComponentRef Id="StartMenuShortcuts" />
     </Feature>
 
     <Directory Id="TARGETDIR" Name="SourceDir">
@@ -31,6 +36,9 @@
       <Directory Id="CommonAppDataFolder">
         <Directory Id="ConfigDir" Name="OliveTin" />
       </Directory>
+      <Directory Id="ProgramMenuFolder">
+        <Directory Id="ApplicationProgramsFolder" Name="OliveTin" />
+      </Directory>
     </Directory>
 
     <DirectoryRef Id="ConfigDir">
@@ -42,5 +50,41 @@
           KeyPath="yes" />
       </Component>
     </DirectoryRef>
+
+    <DirectoryRef Id="ApplicationProgramsFolder">
+      <Component Id="StartMenuShortcuts" Guid="C3D4E5F6-A7B8-9012-CDEF-345678901234" Win64="yes">
+        <Shortcut
+          Id="OliveTinExeShortcut"
+          Name="OliveTin"
+          Description="OliveTin web interface for running shell commands"
+          Target="[INSTALLDIR]OliveTin.exe"
+          WorkingDirectory="INSTALLDIR"
+          Icon="OliveTinIcon"
+          IconIndex="0" />
+        <Shortcut
+          Id="ConfigYamlShortcut"
+          Name="config.yaml"
+          Description="OliveTin configuration file"
+          Target="[#ConfigYaml]"
+          Icon="OliveTinIcon"
+          IconIndex="0" />
+        <Shortcut
+          Id="ProgramDataDirShortcut"
+          Name="OliveTin Data"
+          Description="Open the OliveTin ProgramData directory"
+          Target="[System64Folder]explorer.exe"
+          Arguments="[ConfigDir]"
+          WorkingDirectory="ConfigDir" />
+        <Shortcut
+          Id="ProgramFilesDirShortcut"
+          Name="OliveTin Program Files"
+          Description="Open the OliveTin installation directory"
+          Target="[System64Folder]explorer.exe"
+          Arguments="&quot;[INSTALLDIR]&quot;"
+          WorkingDirectory="INSTALLDIR" />
+        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
+        <RegistryValue Root="HKLM" Key="Software\OliveTin" Name="StartMenuShortcuts" Type="integer" Value="1" KeyPath="yes" />
+      </Component>
+    </DirectoryRef>
   </Product>
 </Wix>

+ 19 - 10
var/windows/build-msi.sh

@@ -20,6 +20,11 @@ if ! command -v wixl >/dev/null || ! command -v wixl-heat >/dev/null; then
   exit 1
 fi
 
+if [[ ! -f "${SCRIPT_DIR}/License.rtf" ]]; then
+  echo "License.rtf not found: ${SCRIPT_DIR}/License.rtf" >&2
+  exit 1
+fi
+
 normalize_msi_version() {
   local raw="${1#v}"
   raw="${raw%%-*}"
@@ -87,16 +92,20 @@ cp -a "${SOURCE_ROOT}/webui/." "${APP_STAGING}/webui/"
   --win64 \
   > "${HEAT_WXS}"
 
-wixl \
-  -v \
-  -a x64 \
-  -D "Version=${MSI_VERSION}" \
-  -D "Win64=yes" \
-  -D "SourceDir=${APP_STAGING}" \
-  -D "ConfigSource=${SOURCE_ROOT}/config.yaml" \
-  -o "${MSI_PATH}" \
-  "${SCRIPT_DIR}/OliveTin.wxs" \
-  "${HEAT_WXS}"
+(
+  cd "${SCRIPT_DIR}"
+  wixl \
+    -v \
+    -a x64 \
+    --ext ui \
+    -D "Version=${MSI_VERSION}" \
+    -D "Win64=yes" \
+    -D "SourceDir=${APP_STAGING}" \
+    -D "ConfigSource=${SOURCE_ROOT}/config.yaml" \
+    -o "${MSI_PATH}" \
+    OliveTin.wxs \
+    "${HEAT_WXS}"
+)
 
 if ! msiinfo export "${MSI_PATH}" Media 2>/dev/null | grep -q '#cab1.cab'; then
   echo "MSI cabinet is not embedded (expected #cab1.cab in Media table); check EmbedCab in OliveTin.wxs" >&2