diff options
Diffstat (limited to 'app-containers/incus/files/incus-0.2-lxd-to-incus-openrc-support.patch')
-rw-r--r-- | app-containers/incus/files/incus-0.2-lxd-to-incus-openrc-support.patch | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/app-containers/incus/files/incus-0.2-lxd-to-incus-openrc-support.patch b/app-containers/incus/files/incus-0.2-lxd-to-incus-openrc-support.patch deleted file mode 100644 index 9ab26752f9f8..000000000000 --- a/app-containers/incus/files/incus-0.2-lxd-to-incus-openrc-support.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 73f22c10770ba07ffe55e37480c5d50beb3c0c35 Mon Sep 17 00:00:00 2001 -From: xsoalokinx <soalokin@live.com> -Date: Sun, 29 Oct 2023 07:42:02 +0000 -Subject: [PATCH] cmd/lxd-to-incus: Add OpenRC target support - -Signed-off-by: xsoalokinx <soalokin@live.com> ---- - cmd/lxd-to-incus/targets.go | 46 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 45 insertions(+), 1 deletion(-) - -diff --git a/cmd/lxd-to-incus/targets.go b/cmd/lxd-to-incus/targets.go -index ed84d3ebc..0940e1597 100644 ---- a/cmd/lxd-to-incus/targets.go -+++ b/cmd/lxd-to-incus/targets.go -@@ -16,7 +16,7 @@ type Target interface { - Paths() (*DaemonPaths, error) - } - --var targets = []Target{&targetSystemd{}} -+var targets = []Target{&targetSystemd{}, &targetOpenRC{}} - - type targetSystemd struct{} - -@@ -61,3 +61,47 @@ func (s *targetSystemd) Paths() (*DaemonPaths, error) { - Cache: "/var/cache/incus/", - }, nil - } -+ -+type targetOpenRC struct{} -+ -+func (s *targetOpenRC) Present() bool { -+ if !util.PathExists("/var/lib/incus/") { -+ return false -+ } -+ -+ _, err := subprocess.RunCommand("rc-service", "--exists", "incus") -+ if err != nil { -+ return false -+ } -+ -+ return true -+} -+ -+func (s *targetOpenRC) Stop() error { -+ _, err := subprocess.RunCommand("rc-service", "incus", "stop") -+ return err -+} -+ -+func (s *targetOpenRC) Start() error { -+ _, err := subprocess.RunCommand("rc-service", "incus", "start") -+ if err != nil { -+ return err -+ } -+ -+ // Wait for the socket to become available. -+ time.Sleep(5 * time.Second) -+ -+ return nil -+} -+ -+func (s *targetOpenRC) Connect() (incus.InstanceServer, error) { -+ return incus.ConnectIncusUnix("/var/lib/incus/unix.socket", nil) -+} -+ -+func (s *targetOpenRC) Paths() (*DaemonPaths, error) { -+ return &DaemonPaths{ -+ Daemon: "/var/lib/incus/", -+ Logs: "/var/log/incus/", -+ Cache: "/var/cache/incus/", -+ }, nil -+} |