From 8898c94ab9950d42ddf5039d9fca6ad60ca784ba Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Tue, 7 Nov 2023 21:13:46 +0200 Subject: [PATCH] lxd-migrate: remove support for upstart AFAIK, upstart was used by CentOS before 7 and Ubuntu before 15.10. According to https://en.wikipedia.org/wiki/Upstart_(software) only ChromeOS and ChromiumOS are still using upstart but those are not something distrobuilder support building. Signed-off-by: Simon Deziel --- lxd-migrate/lxd.go | 12 ------------ lxd-migrate/utils.go | 14 -------------- 2 files changed, 26 deletions(-) diff --git a/lxd-migrate/lxd.go b/lxd-migrate/lxd.go index 3cfe68edc..171e8879d 100644 --- a/lxd-migrate/lxd.go +++ b/lxd-migrate/lxd.go @@ -218,10 +218,6 @@ func (d *lxdDaemon) reload() error { return systemdCtl("reload", "snap.lxd.daemon.service") } - if osInit() == "upstart" { - return upstartCtl("restart", "lxd") - } - return systemdCtl("restart", "lxd.service", "lxd.socket") } @@ -231,10 +227,6 @@ func (d *lxdDaemon) start() error { return systemdCtl("start", "snap.lxd.daemon.service") } - if osInit() == "upstart" { - return upstartCtl("start", "lxd") - } - return systemdCtl("start", "lxd.service", "lxd.socket") } @@ -248,10 +240,6 @@ func (d *lxdDaemon) stop() error { return systemdCtl("stop", "snap.lxd.daemon.service") } - if osInit() == "upstart" { - return upstartCtl("stop", "lxd") - } - return systemdCtl("stop", "lxd.service", "lxd.socket") } diff --git a/lxd-migrate/utils.go b/lxd-migrate/utils.go index 95e9bafa6..4d703c680 100644 --- a/lxd-migrate/utils.go +++ b/lxd-migrate/utils.go @@ -72,16 +72,6 @@ func systemdCtl(action string, units ...string) error { return err } -func upstartCtl(action string, units ...string) error { - args := []string{} - args = append(args, action) - args = append(args, units...) - - // Run initctl - _, err := shared.RunCommand("initctl", args...) - return err -} - func convertPath(path string, src string, dst string) string { // Relative paths are handled by LXD if !strings.HasPrefix(path, "/") { @@ -134,10 +124,6 @@ func osInit() string { fields := strings.Split(initExe, " ") init := filepath.Base(fields[0]) - if init == "init" { - init = "upstart" - } - return init }