diff options
author | Brahmajit Das <brahmajit.xyz@gmail.com> | 2024-06-01 14:53:55 +0530 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2024-06-01 12:30:28 +0300 |
commit | ed2270179584f39d12cbb8aa0d181c7a26f009f9 (patch) | |
tree | 3afc119c82f9c9b0989e4178ebce849476fc64a8 /app-containers/lxd | |
parent | kde-apps/konqueror: Disable build of webarchive thumbnailer plugin (diff) | |
download | gentoo-ed2270179584f39d12cbb8aa0d181c7a26f009f9.tar.gz gentoo-ed2270179584f39d12cbb8aa0d181c7a26f009f9.tar.bz2 gentoo-ed2270179584f39d12cbb8aa0d181c7a26f009f9.zip |
app-containers/lxd: restore init files from 5763c7144b46
Wit commit 5763c7144b46, some of the older files were dropped that
are still needed. This commit restores them.
Fixes: 5763c7144b46
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/36943
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'app-containers/lxd')
-rw-r--r-- | app-containers/lxd/files/lxd-4.0.0.confd | 23 | ||||
-rw-r--r-- | app-containers/lxd/files/lxd-4.0.0.socket | 12 | ||||
-rw-r--r-- | app-containers/lxd/files/lxd-4.0.9-r1.service | 23 | ||||
-rw-r--r-- | app-containers/lxd/files/lxd-5.0.2-r1.initd | 59 | ||||
-rw-r--r-- | app-containers/lxd/files/lxd-containers-4.0.0.service | 16 |
5 files changed, 133 insertions, 0 deletions
diff --git a/app-containers/lxd/files/lxd-4.0.0.confd b/app-containers/lxd/files/lxd-4.0.0.confd new file mode 100644 index 000000000000..68cf344995be --- /dev/null +++ b/app-containers/lxd/files/lxd-4.0.0.confd @@ -0,0 +1,23 @@ +# Group which owns the shared socket +LXD_OPTIONS+=" --group lxd" + +# Enable cpu profiling into the specified file +#LXD_OPTIONS+=" --cpuprofile /tmp/lxc_cpu_profile" + +# Enable memory profiling into the specified file +#LXD_OPTIONS+=" --memprofile /tmp/lxc_mem_profile" + +# Enable debug mode +#LXD_OPTIONS+=" --debug" + +# For debugging, print a complete stack trace every n seconds +#LXD_OPTIONS+=" --print-goroutines-every 5" + +# Enable verbose mode +#LXD_OPTIONS+=" -v" + +# Logfile to log to +#LXD_OPTIONS+=" --logfile /var/log/lxd/lxd.log" + +# Enable syslog logging +#LXD_OPTIONS+=" --syslog" diff --git a/app-containers/lxd/files/lxd-4.0.0.socket b/app-containers/lxd/files/lxd-4.0.0.socket new file mode 100644 index 000000000000..3207c9453d11 --- /dev/null +++ b/app-containers/lxd/files/lxd-4.0.0.socket @@ -0,0 +1,12 @@ +[Unit] +Description=LXD - unix socket +Documentation=man:lxd(1) + +[Socket] +ListenStream=/var/lib/lxd/unix.socket +SocketGroup=lxd +SocketMode=0660 +Service=lxd.service + +[Install] +WantedBy=sockets.target diff --git a/app-containers/lxd/files/lxd-4.0.9-r1.service b/app-containers/lxd/files/lxd-4.0.9-r1.service new file mode 100644 index 000000000000..480940dab7a3 --- /dev/null +++ b/app-containers/lxd/files/lxd-4.0.9-r1.service @@ -0,0 +1,23 @@ +[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] +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 diff --git a/app-containers/lxd/files/lxd-5.0.2-r1.initd b/app-containers/lxd/files/lxd-5.0.2-r1.initd new file mode 100644 index 000000000000..7c74c0fdc308 --- /dev/null +++ b/app-containers/lxd/files/lxd-5.0.2-r1.initd @@ -0,0 +1,59 @@ +#!/sbin/openrc-run +# Copyright 1999-2023 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 ${?} + + # Create necessary systemd paths in order for systemd containers to work on openrc host. + # /etc/rc.conf should have following values: + # rc_cgroup_mode="hybrid" + if [ -d /sys/fs/cgroup/unified ] && + [ ! -d /sys/fs/cgroup/systemd ]; then + install -d /sys/fs/cgroup/systemd --group lxd --owner root + mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd + fi +} + +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-containers-4.0.0.service b/app-containers/lxd/files/lxd-containers-4.0.0.service new file mode 100644 index 000000000000..894760c3506b --- /dev/null +++ b/app-containers/lxd/files/lxd-containers-4.0.0.service @@ -0,0 +1,16 @@ +[Unit] +Description=LXD - container startup/shutdown +Documentation=man:lxd(1) +After=lxd.socket lxd.service +Requires=lxd.socket + +[Service] +Type=oneshot +ExecStart=/usr/sbin/lxd activateifneeded +ExecStop=/usr/sbin/lxd shutdown +TimeoutStartSec=600s +TimeoutStopSec=600s +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target |