Added initial lxd ebuild.
This commit is contained in:
parent
cb9bb53abc
commit
955c0c676e
9 changed files with 333 additions and 0 deletions
23
app-emulation/lxd/files/lxd-4.0.0.confd
Normal file
23
app-emulation/lxd/files/lxd-4.0.0.confd
Normal file
|
@ -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"
|
47
app-emulation/lxd/files/lxd-4.0.0.initd
Normal file
47
app-emulation/lxd/files/lxd-4.0.0.initd
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2021 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
|
||||
install -d /var/lib/lxd --group lxd --owner root --mode 0775
|
||||
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
|
||||
}
|
20
app-emulation/lxd/files/lxd-4.0.0.service
Normal file
20
app-emulation/lxd/files/lxd-4.0.0.service
Normal file
|
@ -0,0 +1,20 @@
|
|||
[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 --logfile=/var/log/lxd/lxd.log
|
||||
ExecStartPost=/usr/sbin/lxd waitready --timeout=600
|
||||
KillMode=process
|
||||
TimeoutStartSec=600s
|
||||
TimeoutStopSec=30s
|
||||
Restart=on-failure
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=infinity
|
||||
TasksMax=infinity
|
||||
|
||||
[Install]
|
||||
Also=lxd-containers.service lxd.socket
|
12
app-emulation/lxd/files/lxd-4.0.0.socket
Normal file
12
app-emulation/lxd/files/lxd-4.0.0.socket
Normal file
|
@ -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
|
21
app-emulation/lxd/files/lxd-4.0.0_apparmor.service
Normal file
21
app-emulation/lxd/files/lxd-4.0.0_apparmor.service
Normal file
|
@ -0,0 +1,21 @@
|
|||
[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
|
||||
ExecStartPre=/usr/libexec/lxc/lxc-apparmor-load
|
||||
ExecStart=/usr/sbin/lxd --group lxd --logfile=/var/log/lxd/lxd.log
|
||||
ExecStartPost=/usr/sbin/lxd waitready --timeout=600
|
||||
KillMode=process
|
||||
TimeoutStartSec=600s
|
||||
TimeoutStopSec=30s
|
||||
Restart=on-failure
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=infinity
|
||||
TasksMax=infinity
|
||||
|
||||
[Install]
|
||||
Also=lxd-containers.service lxd.socket
|
16
app-emulation/lxd/files/lxd-containers-4.0.0.service
Normal file
16
app-emulation/lxd/files/lxd-containers-4.0.0.service
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue