summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoonas Niilola <juippis@gentoo.org>2022-02-02 10:45:41 +0200
committerJoonas Niilola <juippis@gentoo.org>2022-02-02 10:53:06 +0200
commit5bd04ef5dc1514fe99e65550f7e72bcf7ab993eb (patch)
tree79d560048a1acea6e17dc47b8e3b1ca6a3e73ae9 /app-containers/lxd/files
parentapp-containers/lxc: add 4.0.12 (diff)
downloadgentoo-5bd04ef5dc1514fe99e65550f7e72bcf7ab993eb.tar.gz
gentoo-5bd04ef5dc1514fe99e65550f7e72bcf7ab993eb.tar.bz2
gentoo-5bd04ef5dc1514fe99e65550f7e72bcf7ab993eb.zip
app-containers/lxd: add 4.0.9
- inherit go-module.eclass; upstream uses go.mod now, - new documentation offered by upstream, e.g. a handy cheatsheet, - openrc init file and systemd service file now manages the log directory (#817287), - virtfs-proxy-helper bin path isn't hardcoded anymore (#798924), - -Werror patch turned into sed for easier maintainability. Bug: https://bugs.gentoo.org/798924 Closes: https://bugs.gentoo.org/817287 Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'app-containers/lxd/files')
-rw-r--r--app-containers/lxd/files/lxd-4.0.9.initd49
-rw-r--r--app-containers/lxd/files/lxd-4.0.9.service25
2 files changed, 74 insertions, 0 deletions
diff --git a/app-containers/lxd/files/lxd-4.0.9.initd b/app-containers/lxd/files/lxd-4.0.9.initd
new file mode 100644
index 000000000000..7b3d464ea367
--- /dev/null
+++ b/app-containers/lxd/files/lxd-4.0.9.initd
@@ -0,0 +1,49 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+DAEMON=/usr/sbin/lxd
+PIDFILE=/run/lxd.pid
+
+depend() {
+ need net
+ need lxcfs
+}
+
+start() {
+ ebegin "Starting lxd service"
+
+ modprobe -f loop > /dev/null 2>&1
+
+ # Fix permissions on /var/lib/lxd and make sure it exists.
+ # Create a log directory for lxd with correct permissions.
+ install -d /var/lib/lxd --group lxd --owner root --mode 0775
+ install -d /var/log/lxd --group lxd --owner root
+ start-stop-daemon --start \
+ --pidfile ${PIDFILE} \
+ --exec ${DAEMON} \
+ --background \
+ --make-pidfile \
+ -- \
+ ${LXD_OPTIONS}
+ eend ${?}
+}
+
+stop() {
+ if [ "${RC_CMD}" = restart ]; then
+ ebegin "Stopping lxd service (but not containers)"
+ # start-stop-daemon sends SIGTERM with a timeout of 5s by default.
+ # SIGTERM indicates to LXD that it will be stopped temporarily.
+ # Instances will keep running.
+ start-stop-daemon --stop --quiet -p "${PIDFILE}"
+ eend ${?}
+ else
+ ebegin "Stopping lxd service and containers, waiting 40s"
+ # SIGPWR indicates to LXD that the host is going down.
+ # LXD will do a clean shutdown of all instances.
+ # After 30s all remaining instances will be killed.
+ # We wait up to 40s for LXD.
+ start-stop-daemon --stop --quiet -R SIGPWR/40 -p "${PIDFILE}"
+ eend ${?}
+ fi
+}
diff --git a/app-containers/lxd/files/lxd-4.0.9.service b/app-containers/lxd/files/lxd-4.0.9.service
new file mode 100644
index 000000000000..6a218d2c43a7
--- /dev/null
+++ b/app-containers/lxd/files/lxd-4.0.9.service
@@ -0,0 +1,25 @@
+[Unit]
+Description=LXD - main daemon
+After=network-online.target lxcfs.service lxd.socket
+Requires=network-online.target lxcfs.service lxd.socket
+Documentation=man:lxd(1)
+
+[Service]
+Group=lxd
+User=root
+EnvironmentFile=-/etc/environment
+ExecStart=/usr/sbin/lxd --group lxd --syslog
+ExecStartPost=/usr/sbin/lxd waitready --timeout=600
+ExecStartPre=/bin/mkdir -p /var/log/lxd
+ExecStartPre=/bin/chown -R root:lxd /var/log/lxd
+KillMode=process
+PermissionsStartOnly=true
+TimeoutStartSec=600s
+TimeoutStopSec=30s
+Restart=on-failure
+LimitNOFILE=1048576
+LimitNPROC=infinity
+TasksMax=infinity
+
+[Install]
+Also=lxd-containers.service lxd.socket