lib/sd-activation: wrap coreos/go-systemd

It fails to build on plan9, which is part of the rclone CI matrix, and
the PR fixing it upstream doesn't seem to be getting traction.

Stub it on our side, we can still remove this once it gets merged.
This commit is contained in:
Florian Klink 2024-05-13 21:13:10 +02:00 committed by Nick Craig-Wood
parent 156feff9f2
commit e3b09211b8
4 changed files with 50 additions and 2 deletions

View file

@ -21,13 +21,13 @@ import (
"path/filepath"
"strings"
sdActivation "github.com/coreos/go-systemd/v22/activation"
"github.com/rclone/rclone/cmd/serve/proxy"
"github.com/rclone/rclone/cmd/serve/proxy/proxyflags"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config"
"github.com/rclone/rclone/lib/env"
"github.com/rclone/rclone/lib/file"
sdActivation "github.com/rclone/rclone/lib/sdactivation"
"github.com/rclone/rclone/vfs"
"github.com/rclone/rclone/vfs/vfscommon"
"golang.org/x/crypto/ssh"

View file

@ -17,11 +17,11 @@ import (
"sync"
"time"
sdActivation "github.com/coreos/go-systemd/v22/activation"
"github.com/go-chi/chi/v5"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config/flags"
"github.com/rclone/rclone/lib/atexit"
sdActivation "github.com/rclone/rclone/lib/sdactivation"
"github.com/spf13/pflag"
)

View file

@ -0,0 +1,24 @@
//go:build windows || plan9
// +build windows plan9
// Package sdactivation provides support for systemd socket activation,
// wrapping the coreos/go-systemd package.
// This wraps the underlying go-systemd binary, as it fails to build on plan9
// https://github.com/coreos/go-systemd/pull/440
package sdactivation
import (
"net"
)
// ListenersWithNames maps a listener name to a set of net.Listener instances.
// This wraps the underlying go-systemd binary, as it fails to build on plan9
// https://github.com/coreos/go-systemd/pull/440
func ListenersWithNames() (map[string][]net.Listener, error) {
return make(map[string][]net.Listener), nil
}
// Listeners returns a slice containing a net.Listener for each matching socket type passed to this process.
func Listeners() ([]net.Listener, error) {
return nil, nil
}

View file

@ -0,0 +1,24 @@
//go:build !windows && !plan9
// +build !windows,!plan9
// Package sdactivation provides support for systemd socket activation, wrapping
// the coreos/go-systemd package.
// This wraps the underlying go-systemd library, as it fails to build on plan9
// https://github.com/coreos/go-systemd/pull/440
package sdactivation
import (
"net"
sdActivation "github.com/coreos/go-systemd/v22/activation"
)
// ListenersWithNames maps a listener name to a set of net.Listener instances.
func ListenersWithNames() (map[string][]net.Listener, error) {
return sdActivation.ListenersWithNames()
}
// Listeners returns a slice containing a net.Listener for each matching socket type passed to this process.
func Listeners() ([]net.Listener, error) {
return sdActivation.Listeners()
}