Skip to content

🎧 Your Personal Streaming Service

feat: Windows MSI installer and service support (#3125)

Rob Emery768160b05e99
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index faa06a7f7..9b1f943ea 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -39,7 +39,6 @@ jobs:
echo 'To fix this check, run "make format" and commit the changes'
exit 1
fi
-
go:
name: Test Go code
runs-on: ubuntu-latest
@@ -156,6 +155,51 @@ jobs:
!dist/*.zip
retention-days: 7
+ msi:
+ name: Build and publish MSI files
+ needs: [binaries]
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/download-artifact@v4
+ with:
+ name: binaries
+ path: dist
+
+ - name: Build MSI
+ run: |
+ sudo apt-get install -y wixl jq
+
+ NAVIDROME_BUILD_VERSION=$(jq -r '.version' < $GITHUB_WORKSPACE/dist/metadata.json | sed -e 's/^v//' -e 's/-SNAPSHOT/.1/' )
+
+ mkdir -p $GITHUB_WORKSPACE/wix/386
+ cp $GITHUB_WORKSPACE/LICENSE $GITHUB_WORKSPACE/wix/386
+ cp $GITHUB_WORKSPACE/README.md $GITHUB_WORKSPACE/wix/386
+
+ cp -r $GITHUB_WORKSPACE/wix/386 $GITHUB_WORKSPACE/wix/amd64
+
+ cp $GITHUB_WORKSPACE/dist/navidrome_windows_386_windows_386/navidrome.exe $GITHUB_WORKSPACE/wix/386
+ cp $GITHUB_WORKSPACE/dist/navidrome_windows_amd64_windows_amd64_v1/navidrome.exe $GITHUB_WORKSPACE/wix/amd64
+
+ # workaround for wixl WixVariable not working to override bmp locations
+ sudo cp $GITHUB_WORKSPACE/wix/bmp/banner.bmp /usr/share/wixl-*/ext/ui/bitmaps/bannrbmp.bmp
+ sudo cp $GITHUB_WORKSPACE/wix/bmp/dialogue.bmp /usr/share/wixl-*/ext/ui/bitmaps/dlgbmp.bmp
+
+ cd $GITHUB_WORKSPACE/wix/386
+ wixl ../navidrome.wxs -D Version=$NAVIDROME_BUILD_VERSION -D Platform=x86 --arch x86 --ext ui --output ../navidrome_386.msi
+
+ cd $GITHUB_WORKSPACE/wix/amd64
+ wixl ../navidrome.wxs -D Version=$NAVIDROME_BUILD_VERSION -D Platform=x64 --arch x64 --ext ui --output ../navidrome_amd64.msi
+
+ ls -la $GITHUB_WORKSPACE/wix/*.msi
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: installers
+ path: wix/*.msi
+ retention-days: 7
+
docker:
name: Build and publish Docker images
needs: [binaries]
diff --git a/cmd/root.go b/cmd/root.go
index b6aa0d708..f623b408f 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -2,7 +2,6 @@ package cmd
import (
"context"
- "fmt"
"os"
"os/signal"
"strings"
@@ -37,7 +36,7 @@ Complete documentation is available at https://www.navidrome.org/docs`,
preRun()
},
Run: func(cmd *cobra.Command, args []string) {
- runNavidrome()
+ runNavidrome(cmd.Context())
},
PostRun: func(cmd *cobra.Command, args []string) {
postRun()
@@ -50,8 +49,7 @@ Complete documentation is available at https://www.navidrome.org/docs`,
func Execute() {
rootCmd.SetVersionTemplate(`{{println .Version}}`)
if err := rootCmd.Execute(); err != nil {
- fmt.Println(err)
- os.Exit(1)
+ log.Fatal(err)
}
}
@@ -69,10 +67,10 @@ func postRun() {
// runNavidrome is the main entry point for the Navidrome server. It starts all the services and blocks.
// If any of the services returns an error, it will log it and exit. If the process receives a signal to exit,
// it will cancel the context and exit gracefully.
-func runNavidrome() {
+func runNavidrome(ctx context.Context) {
defer db.Init()()
- ctx, cancel := mainContext()
+ ctx, cancel := mainContext(ctx)
defer cancel()
g, ctx := errgroup.WithContext(ctx)
@@ -88,8 +86,8 @@ func runNavidrome() {
}
// mainContext returns a context that is cancelled when the process receives a signal to exit.
-func mainContext() (context.Context, context.CancelFunc) {
- return signal.NotifyContext(context.Background(),
+func mainContext(ctx context.Context) (context.Context, context.CancelFunc) {
+ return signal.NotifyContext(ctx,
os.Interrupt,
syscall.SIGHUP,
syscall.SIGTERM,
diff --git a/cmd/svc.go b/cmd/svc.go
new file mode 100644
index 000000000..21c9b64cc
--- /dev/null
+++ b/cmd/svc.go
@@ -0,0 +1,209 @@
+package cmd
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "path/filepath"
+ "sync"
+ "time"
+
+ "github.com/kardianos/service"
+ "github.com/navidrome/navidrome/conf"
+ "github.com/navidrome/navidrome/log"
+ "github.com/spf13/cobra"
+)
+
+var (
+ svcStatusLabels = map[service.Status]string{
+ service.StatusUnknown: "Unknown",
+ service.StatusStopped: "Stopped",
+ service.StatusRunning: "Running",
+ }
+)
+
+func init() {
+ svcCmd.AddCommand(buildInstallCmd())
+ svcCmd.AddCommand(buildUninstallCmd())
+ svcCmd.AddCommand(buildStartCmd())
+ svcCmd.AddCommand(buildStopCmd())
+ svcCmd.AddCommand(buildStatusCmd())
+ svcCmd.AddCommand(buildExecuteCmd())
+ rootCmd.AddCommand(svcCmd)
+}
+
+var svcCmd = &cobra.Command{
+ Use: "service",
+ Aliases: []string{"svc"},
+ Short: "Manage Navidrome as a service",
+ Long: fmt.Sprintf("Manage Navidrome as a service, using the OS service manager (%s)", service.Platform()),
+ Run: runServiceCmd,
+}
+
+type svcControl struct {
+ ctx context.Context
+ cancel context.CancelFunc
+ done chan struct{}
+}
+
+func (p *svcControl) Start(service.Service) error {
+ p.done = make(chan struct{})
+ p.ctx, p.cancel = context.WithCancel(context.Background())
+ go func() {
+ runNavidrome(p.ctx)
+ close(p.done)
+ }()
+ return nil
+}
+
+func (p *svcControl) Stop(service.Service) error {
+ log.Info("Stopping service")
+ p.cancel()
+ select {
+ case <-p.done:
+ log.Info("Service stopped gracefully")
+ case <-time.After(10 * time.Second):
+ log.Error("Service did not stop in time. Killing it.")
+ }
+ return nil
+}
+
+var svcInstance = sync.OnceValue(func() service.Service {
+ options := make(service.KeyValue)
+ options["Restart"] = "on-success"
+ options["SuccessExitStatus"] = "1 2 8 SIGKILL"
+ options["UserService"] = false
+ options["LogDirectory"] = conf.Server.DataFolder
+ svcConfig := &service.Config{
+ Name: "navidrome",
+ DisplayName: "Navidrome",
+ Description: "Your Personal Streaming Service",
+ Dependencies: []string{
+ "Requires=",
+ "After="},
+ WorkingDirectory: executablePath(),
+ Option: options,
+ }
+ arguments := []string{"service", "execute"}
+ if conf.Server.ConfigFile != "" {
+ arguments = append(arguments, "-c", conf.Server.ConfigFile)
+ }
+ svcConfig.Arguments = arguments
+
+ prg := &svcControl{}
+ svc, err := service.New(prg, svcConfig)
+ if err != nil {
+ log.Fatal(err)
+ }
+ return svc
+})
+
+func runServiceCmd(cmd *cobra.Command, _ []string) {
+ _ = cmd.Help()
+}
+
+func executablePath() string {
+ ex, err := os.Executable()
+ if err != nil {
+ log.Fatal(err)
+ }
+ return filepath.Dir(ex)
+}
+
+func buildInstallCmd() *cobra.Command {
+ runInstallCmd := func(_ *cobra.Command, _ []string) {
+ var err error
+ println("Installing service with:")
+ println(" working directory: " + executablePath())
+ println(" music folder: " + conf.Server.MusicFolder)
+ println(" data folder: " + conf.Server.DataFolder)
+ println(" logs folder: " + conf.Server.DataFolder)
+ if cfgFile != "" {
+ conf.Server.ConfigFile, err = filepath.Abs(cfgFile)
+ if err != nil {
+ log.Fatal(err)
+ }
+ println(" config file: " + conf.Server.ConfigFile)
+ }
+ err = svcInstance().Install()
+ if err != nil {
+ log.Fatal(err)
+ }
+ println("Service installed. Use 'navidrome svc start' to start it.")
+ }
+
+ return &cobra.Command{
+ Use: "install",
+ Short: "Install Navidrome service.",
+ Run: runInstallCmd,
+ }
+}
+
+func buildUninstallCmd() *cobra.Command {
+ return &cobra.Command{
+ Use: "uninstall",
+ Short: "Uninstall Navidrome service. Does not delete the music or data folders",
+ Run: func(cmd *cobra.Command, args []string) {
+ err := svcInstance().Uninstall()
+ if err != nil {
+ log.Fatal(err)
+ }
+ println("Service uninstalled. Music and data folders are still intact.")
+ },
+ }
+}
+
+func buildStartCmd() *cobra.Command {
+ return &cobra.Command{
+ Use: "start",
+ Short: "Start Navidrome service",
+ Run: func(cmd *cobra.Command, args []string) {
+ err := svcInstance().Start()
+ if err != nil {
+ log.Fatal(err)
+ }
+ println("Service started. Use 'navidrome svc status' to check its status.")
+ },
+ }
+}
+
+func buildStopCmd() *cobra.Command {
+ return &cobra.Command{
+ Use: "stop",
+ Short: "Stop Navidrome service",
+ Run: func(cmd *cobra.Command, args []string) {
+ err := svcInstance().Stop()
+ if err != nil {
+ log.Fatal(err)
+ }
+ println("Service stopped. Use 'navidrome svc status' to check its status.")
+ },
+ }
+}
+
+func buildStatusCmd() *cobra.Command {
+ return &cobra.Command{
+ Use: "status",
+ Short: "Show Navidrome service status",
+ Run: func(cmd *cobra.Command, args []string) {
+ status, err := svcInstance().Status()
+ if err != nil {
+ log.Fatal(err)
+ }
+ fmt.Printf("Navidrome is %s.\n", svcStatusLabels[status])
+ },
+ }
+}
+
+func buildExecuteCmd() *cobra.Command {
+ return &cobra.Command{
+ Use: "execute",
+ Short: "Run navidrome as a service in the foreground (it is very unlikely you want to run this, you are better off running just navidrome)",
+ Run: func(cmd *cobra.Command, args []string) {
+ err := svcInstance().Run()
+ if err != nil {
+ log.Fatal(err)
+ }
+ },
+ }
+}
diff --git a/go.mod b/go.mod
index 44a90c477..396e96e88 100644
--- a/go.mod
+++ b/go.mod
@@ -27,6 +27,7 @@ require (
github.com/google/wire v0.6.0
github.com/hashicorp/go-multierror v1.1.1
github.com/jellydator/ttlcache/v3 v3.3.0
+ github.com/kardianos/service v1.2.2
github.com/kr/pretty v0.3.1
github.com/lestrrat-go/jwx/v2 v2.1.1
github.com/matoous/go-nanoid/v2 v2.1.0
diff --git a/go.sum b/go.sum
index 1413e2529..c1a05298c 100644
--- a/go.sum
+++ b/go.sum
@@ -96,6 +96,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
+github.com/kardianos/service v1.2.2 h1:ZvePhAHfvo0A7Mftk/tEzqEZ7Q4lgnR8sGz4xu1YX60=
+github.com/kardianos/service v1.2.2/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
@@ -255,6 +257,7 @@ golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/wix/Navidrome_UI_Flow.wxs b/wix/Navidrome_UI_Flow.wxs
new file mode 100644
index 000000000..2ea38e172
--- /dev/null
+++ b/wix/Navidrome_UI_Flow.wxs
@@ -0,0 +1,41 @@
+<Fragment>
+ <UI Id="Navidrome_UI_Flow">
+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
+
+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
+ <Property Id="WixUI_Mode" Value="Minimal" />
+
+ <DialogRef Id="ErrorDlg" />
+ <DialogRef Id="FatalError" />
+ <DialogRef Id="FilesInUse" />
+ <DialogRef Id="MsiRMFilesInUse" />
+ <DialogRef Id="PrepareDlg" />
+ <DialogRef Id="ProgressDlg" />
+ <DialogRef Id="ResumeDlg" />
+ <DialogRef Id="UserExit" />
+ <DialogRef Id="WelcomeDlg" />
+
+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" />
+
+ <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" />
+
+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg" />
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg" />
+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg" />
+
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="Installed AND PATCH" />
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" Condition="Installed AND PATCH" />
+
+ <InstallUISequence>
+ <Show Dialog="WelcomeDlg" Before="ProgressDlg" Condition="Installed AND PATCH" />
+ </InstallUISequence>
+
+ <Property Id="ARPNOMODIFY" Value="1" />
+ </UI>
+
+ <UIRef Id="WixUI_Common" />
+</Fragment>
diff --git a/wix/SettingsDlg.wxs b/wix/SettingsDlg.wxs
new file mode 100644
index 000000000..4a83f91da
--- /dev/null
+++ b/wix/SettingsDlg.wxs
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Fragment>
+ <UI>
+ <Dialog Id="MyCustomPropertiesDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <!--Header-->
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Configuration</Text>
+ </Control>
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Please enter configuration settings</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+
+ <!--Properties-->
+
+ <!-- Install directory -->
+ <Control Id="NameLabel1" Type="Text" X="30" Y="60" Width="220" Height="15" TabSkip="no" Text="&amp;Installation Folder (executable and configuration file):" />
+ <Control Id="NameEdit1" Type="Edit" X="30" Y="75" Width="220" Height="18" Property="INSTALLDIR" Text="[INSTALLDIR]" />
+
+ <!-- NAVIDROME_PORT -->
+ <Control Id="NameLabel2" Type="Text" X="30" Y="93" Width="100" Height="15" TabSkip="no" Text="&amp;Port:" />
+ <Control Id="NameEdit2" Type="Edit" X="30" Y="108" Width="220" Height="18" Property="ND_PORT" Text="[ND_PORT]" />
+
+ <!-- NAVIDROME_MUSICDIR -->
+ <Control Id="NameLabel3" Type="Text" X="30" Y="126" Width="100" Height="15" TabSkip="no" Text="&amp;Music Folder:" />
+ <Control Id="NameEdit3" Type="Edit" X="30" Y="141" Width="220" Height="18" Property="ND_MUSICFOLDER" Text="[ND_MUSICFOLDER]" />
+
+ <!-- NAVIDROME_DATADIR -->
+ <Control Id="NameLabel4" Type="Text" X="30" Y="159" Width="100" Height="15" TabSkip="no" Text="&amp;Data Folder:" />
+ <Control Id="NameEdit5" Type="Edit" X="30" Y="174" Width="220" Height="18" Property="ND_DATAFOLDER" Text="[ND_DATAFOLDER]" />
+
+ <!--Footer-->
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
+ <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg"></Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ </Dialog>
+ </UI>
+ </Fragment>
diff --git a/wix/bmp/banner.bmp b/wix/bmp/banner.bmp
new file mode 100644
index 000000000..bbaa0fc2b
Binary files /dev/null and b/wix/bmp/banner.bmp differ
diff --git a/wix/bmp/dialogue.bmp b/wix/bmp/dialogue.bmp
new file mode 100644
index 000000000..56f3db55b
Binary files /dev/null and b/wix/bmp/dialogue.bmp differ
diff --git a/wix/convertIniToToml.vbs b/wix/convertIniToToml.vbs
new file mode 100644
index 000000000..1feb7d6d5
--- /dev/null
+++ b/wix/convertIniToToml.vbs
@@ -0,0 +1,17 @@
+Const ForReading = 1
+Const ForWriting = 2
+
+sSourceFilename = Wscript.Arguments(0)
+sTargetFilename = Wscript.Arguments(1)
+
+Set oFSO = CreateObject("Scripting.FileSystemObject")
+Set oFile = oFSO.OpenTextFile(sSourceFilename, ForReading)
+sFileContent = oFile.ReadAll
+oFile.Close
+
+sNewFileContent = Replace(sFileContent, "[MSI_PLACEHOLDER_SECTION]" & vbCrLf, "")
+If Not ( oFSO.FileExists(sTargetFilename) ) Then
+ Set oFile = oFSO.CreateTextFile(sTargetFilename)
+ oFile.Write sNewFileContent
+ oFile.Close
+End If
diff --git a/wix/navidrome.wxs b/wix/navidrome.wxs
new file mode 100644
index 000000000..ad923a0a4
--- /dev/null
+++ b/wix/navidrome.wxs
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='windows-1252'?>
+<?if $(var.Platform) = x64 ?>
+ <?define ProductName = "Navidrome" ?>
+ <?define UpgradeCode = "2f154974-1443-41b6-b808-b8be530291b3" ?>
+ <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
+ <?define Win64 = 'yes' ?>
+<?else ?>
+ <?define ProductName = "Navidrome (x86)" ?>
+ <?define UpgradeCode = "2f0572e4-7e8c-42e7-a186-77f70ec0911a" ?>
+ <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
+ <?define Win64 = "no" ?>
+<?endif ?>
+<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
+ <?include SettingsDlg.wxs?>
+ <?include Navidrome_UI_Flow.wxs?>
+ <Product Name="$(var.ProductName)" Id="*" UpgradeCode="$(var.UpgradeCode)" Language='1033' Codepage='1252' Version='$(var.Version)' Manufacturer='Deluan'>
+
+ <Package Id='*' Keywords='Installer' Description="$(var.ProductName)" Comments='' Manufacturer='Deluan' InstallerVersion='200' Languages='1033' Compressed='yes' SummaryCodepage='1252' InstallScope='perMachine' />
+
+ <MajorUpgrade AllowDowngrades="no" DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." />
+
+ <Media Id='1' Cabinet='main.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
+ <Property Id='DiskPrompt' Value="Navidrome Install [1]" />
+ <Property Id="REBOOT" Value="ReallySuppress" />
+
+ <Property Id="ND_PORT" Value="4533" />
+ <Property Id="ND_MUSICFOLDER" Value="C:\Music" />
+ <Property Id="ND_DATAFOLDER" Value="C:\ProgramData\Navidrome" />
+
+ <UIRef Id="Navidrome_UI_Flow"/>
+
+ <Property Id="CSCRIPT_LOCATION" Value="C:\Windows\System32\cscript.exe" />
+
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id="$(var.PlatformProgramFilesFolder)">
+ <Directory Id='INSTALLDIR' Name='Navidrome'>
+
+ <Component Id='LICENSEFile' Guid='eb5610a4-e3f3-4f36-ae2c-e96914e460c2' Win64="$(var.Win64)">
+ <File Id='LICENSE' Name='LICENSE' DiskId='1' Source='LICENSE' KeyPath='yes' />
+ </Component>
+
+ <Component Id='README.mdFile' Guid='d1ee412b-2ebc-4b0b-9fa7-0228ab707686' Win64="$(var.Win64)">
+ <File Id='README.md' Name='README.md' DiskId='1' Source='README.md' KeyPath='yes' />
+ </Component>
+
+ <Component Id='convertIniToToml.vbsFile' Guid='2a5d3241-9a8b-4a8c-9edc-fbef1a030d4d' Win64="$(var.Win64)">
+ <File Id='convertIniToToml.vbs' Name='convertIniToToml.vbs' DiskId='1' Source='convertIniToToml.vbs' KeyPath='yes' />
+ </Component>
+
+ <Component Id="Configuration" Guid="9e17ed4b-ef13-44bf-a605-ed4132cff7f6" Win64="$(var.Win64)">
+ <IniFile Id="ConfigurationPort" Name="navidrome-msi.ini" Action="createLine" Directory="INSTALLDIR" Key="Port" Section="MSI_PLACEHOLDER_SECTION" Value="&apos;[ND_PORT]&apos;" />
+ <IniFile Id="ConfigurationMusicDir" Name="navidrome-msi.ini" Action="addLine" Directory="INSTALLDIR" Key="MusicFolder" Section="MSI_PLACEHOLDER_SECTION" Value="&apos;[ND_MUSICFOLDER]&apos;" />
+ <IniFile Id="ConfigurationDataDir" Name="navidrome-msi.ini" Action="addLine" Directory="INSTALLDIR" Key="DataFolder" Section="MSI_PLACEHOLDER_SECTION" Value="&apos;[ND_DATAFOLDER]&apos;" />
+ </Component>
+
+ <Component Id='MainExecutable' Guid='e645aa06-8bbc-40d6-8d3c-73b4f5b76fd7' Win64="$(var.Win64)">
+ <File Id='NavidromeExe' Name='Navidrome.exe' DiskId='1' Source='navidrome.exe' KeyPath='yes' />
+ <ServiceInstall
+ Description='Navidrome is a self-hosted music server and streamer'
+ ErrorControl='ignore'
+ Name = '$(var.ProductName)'
+ Id='NavidromeService'
+ Start='auto'
+ Type='ownProcess'
+ Vital='yes'
+ Arguments='service execute --configfile &quot;[INSTALLDIR]navidrome.toml&quot;'
+ />
+ <ServiceControl Id='StartNavidromeService' Start='install' Stop='both' Remove='uninstall' Name='$(var.ProductName)' Wait='yes' />
+ </Component>
+
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <CustomAction Id="HackIniIntoTOML" Impersonate="no" Property="CSCRIPT_LOCATION" Execute="deferred" ExeCommand='&quot;[INSTALLDIR]convertIniToToml.vbs&quot; &quot;[INSTALLDIR]navidrome-msi.ini&quot; &quot;[INSTALLDIR]navidrome.toml&quot;' />
+
+ <InstallUISequence>
+ <Show Dialog="MyCustomPropertiesDlg" After="WelcomeDlg">Not Installed AND NOT WIX_UPGRADE_DETECTED</Show>
+ </InstallUISequence>
+
+ <InstallExecuteSequence>
+ <Custom Action="HackIniIntoTOML" After="WriteIniValues">NOT Installed AND NOT REMOVE</Custom>
+ </InstallExecuteSequence>
+
+ <Feature Id='Complete' Level='1'>
+ <ComponentRef Id='convertIniToToml.vbsFile' />
+ <ComponentRef Id='LICENSEFile' />
+ <ComponentRef Id='README.mdFile' />
+ <ComponentRef Id='Configuration'/>
+ <ComponentRef Id='MainExecutable' />
+ </Feature>
+ </Product>
+</Wix>