From c0ade132e6e8712c899ef03303ef135f5c238636 Mon Sep 17 00:00:00 2001 From: Andrew Lytvynov Date: Tue, 12 Sep 2023 11:08:00 -0700 Subject: [PATCH] clientupdate: restart tailscale after install on DSM6 (#9363) DSM6 does not automatically restart packages on install, we have to do it explicitly. Also, DSM6 has a filter for publishers in Package Center. Make the error message more helpful when update fails because of this filter not allowing our package. Fixes #9361 Signed-off-by: Andrew Lytvynov --- clientupdate/clientupdate.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/clientupdate/clientupdate.go b/clientupdate/clientupdate.go index 9d3e14326..b788c7321 100644 --- a/clientupdate/clientupdate.go +++ b/clientupdate/clientupdate.go @@ -219,7 +219,8 @@ func (up *Updater) updateSynology() error { } // Get the latest version and list of SPKs from pkgs.tailscale.com. - osName := fmt.Sprintf("dsm%d", distro.DSMVersion()) + dsmVersion := distro.DSMVersion() + osName := fmt.Sprintf("dsm%d", dsmVersion) arch, err := synoArch(runtime.GOARCH, synoinfoConfPath) if err != nil { return err @@ -260,8 +261,20 @@ func (up *Updater) updateSynology() error { // just spits out a JSON result when done. out, err := cmd.CombinedOutput() if err != nil { + if dsmVersion == 6 && bytes.Contains(out, []byte("error = [290]")) { + return fmt.Errorf("synopkg install failed: %w\noutput:\n%s\nplease make sure that packages from 'Any publisher' are allowed in the Package Center (Package Center -> Settings -> Trust Level -> Any publisher)", err, out) + } return fmt.Errorf("synopkg install failed: %w\noutput:\n%s", err, out) } + if dsmVersion == 6 { + // DSM6 does not automatically restart the package on install. Do it + // manually. + cmd := exec.Command("nohup", "synopkg", "start", "Tailscale") + out, err := cmd.CombinedOutput() + if err != nil { + return fmt.Errorf("synopkg start failed: %w\noutput:\n%s", err, out) + } + } return nil }