dev-python/conda-libmamba-solver: bump version to 24.11.1
[gentoo-zh.git] / net-proxy / daed / files / daed.initd
blob569aff7a5ae03ec73c51eebee4ff7b91185a01e6
1 #!/sbin/openrc-run
2 # Copyright 2023 Gentoo Authors
3 # Distributed under the terms of the GNU General Public License v2
5 name="daed daemon"
6 description="daed Service"
7 command="/usr/bin/daed"
8 command_args="run "
9 pidfile="/run/${RC_SVCNAME}.pid"
10 command_background="yes"
11 output_log="/var/log/daed/access.log"
12 error_log="/var/log/daed/error.log"
13 supervisor="supervise-daemon"
14 rc_ulimit="-n 30000"
15 rc_cgroup_cleanup="yes"
17 depend() {
18     after docker net net-online sysctl
19     use net
22 error() {
23     echo "ERROR: $@" >&2
24     logger "ERROR: $@"
27 start_pre() {
28     if [ -d /sys/fs/bpf ]; then
29         if ! mountinfo -q /sys/fs/bpf; then
30             # From: https://github.com/cilium/cilium/blob/main/contrib/systemd/sys-fs-bpf.mount
31             # TODO: looking for sys-fs-bpf.mount in init.d
32             mount -t bpf bpffs /sys/fs/bpf || {
33                 error "failed to mount bpf filesystem, exiting..."
34                 return 1
35             }
36         fi
37     fi
38     if [ -d /sys/fs/cgroup ] && ! mountinfo -q /sys/fs/cgroup/; then
39         error "cgroup filesystem not mounted, exiting..."
40         return 1
41     fi
42     if [ ! -d "/tmp/daed/" ]; then
43         mkdir "/tmp/daed"
44     fi
45     if [ ! -L "/var/log/daed" ]; then
46         ln -s "/tmp/daed/" "/var/log/"
47     fi