1 Commits

Author SHA1 Message Date
13c0fc85d9 completely refactor service generation
Far too many changes to list, but having a ton of redundant files like
"type" were removed since they can be generated in the install script
instead. cg support is also added to every longrun.
2024-04-26 12:30:33 -05:00
462 changed files with 1121 additions and 420 deletions

8
cg/down Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/execlineb -P
envfile /etc/s6/config/template.conf
importas -uD "" SV_CG_SEND_SIGHUP SV_CG_SEND_SIGHUP
importas -uD "" SV_CG_TIMEOUT_STOPSEC SV_CG_TIMEOUT_STOPSEC
importas -uD "" SV_CG_SEND_SIGKILL SV_CG_SEND_SIGKILL
foreground { sh /usr/lib/artix/sv-cg.sh down daemon ${SV_CG_SEND_SIGHUP} ${SV_CG_TIMEOUT_STOPSEC} ${SV_CG_SEND_SIGKILL} }

6
cg/up Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/execlineb -P
envfile /etc/s6/config/template.conf
importas -uD "" SV_CG_SETTINGS SV_CG_SETTINGS
foreground { sh /usr/lib/artix/sv-cg.sh up daemon ${SV_CG_SETTINGS} }

32
conf
View File

@@ -1,2 +1,34 @@
# This configures the directives used for s6-log in the log service.
DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -8,6 +8,147 @@ ADMINSVDIR="${DESTDIR}"/etc/s6/adminsv
FALLBACKSVDIR="${DESTDIR}"/etc/s6/fallbacksv
CONFDIR="${DESTDIR}"/etc/s6/config
cg_dependency_blacklist() {
case $dirname in
dbus-srv) return ;;
elogind-srv) return ;;
gdm-srv) return ;;
lightdm-srv) return ;;
lvmpolld-srv) return ;;
lxdm-srv) return ;;
sddm-srv) return ;;
xdm-srv) return ;;
esac
false
}
log_blacklist() {
case $dirname in
backuppc-srv) return ;;
bftpd-srv) return ;;
cgmanager-srv) return ;;
colord-srv) return ;;
colord-session-srv) return ;;
cronie-srv) return ;;
cupsd-srv) return ;;
ddclient-srv) return ;;
dhclient-srv) return ;;
dhcpd4-srv) return ;;
dhcpd6-srv) return ;;
elogind-srv) return ;;
espeakup-srv) return ;;
exim-srv) return ;;
fancontrol-srv) return ;;
hiawatha-srv) return ;;
kadmind-srv) return ;;
krb5kdc-srv) return ;;
mailman-srv) return ;;
metalog-srv) return ;;
named-srv) return ;;
nvidia-persistenced-srv) return ;;
opensips-srv) return ;;
pptpd-srv) return ;;
radiusd-srv) return ;;
rspamd-srv) return ;;
salt-api-srv) return ;;
salt-master-srv) return ;;
salt-master-srv) return ;;
salt-syndic-srv) return ;;
sshguard-srv) return ;;
sslh-srv) return ;;
tinydns-srv) return ;;
usbguard-srv) return ;;
vncserver-srv) return ;;
vsftpd-ipv6-srv) return ;;
vsftpd-srv) return ;;
xdm-srv) return ;;
esac
false
}
install_cg() {
srvname=$(basename "$dir" "$run_file" | sed -e 's/-srv//')
install -v -d "${TOPDIR}/$srvname-cg/dependencies.d"
for file in "cg"/*; do
install -v -m644 "$file" "${TOPDIR}/$srvname-cg"
filename=$(basename "$file")
sed -i "s/daemon/$srvname/g" "${TOPDIR}/$srvname-cg/$filename"
sed -i "s/template/$PKG/g" "${TOPDIR}/$srvname-cg/$filename"
done
touch "${TOPDIR}/$srvname-cg/dependencies.d/mount-cgroups"
echo "oneshot" >> "${TOPDIR}/$srvname-cg/type"
if ! echo "$dir" | grep -q "\-log"; then
install -v -d "${TOPDIR}/$srvname/contents.d"
echo "bundle" >> "${TOPDIR}/$srvname/type"
touch ${TOPDIR}/$srvname/contents.d/{$srvname-cg,$srvname-srv}
if ! log_blacklist; then
touch ${TOPDIR}/$srvname/contents.d/$srvname-log
fi
fi
}
install_conf() {
install -v -d "${CONFDIR}"
# If a config already exists, don't install the generic one.
if [ -f "srv/$PKG/$PKG.conf" ]; then
install -v -m644 "srv/$PKG/$PKG.conf" "${CONFDIR}/$PKG.conf"
else
install -v -m644 "conf" "${CONFDIR}/$PKG.conf"
fi
}
install_log() {
if log_blacklist; then
return
fi
srvname=$(basename "$dir" | sed 's/-srv//')
install -v -d "${TOPDIR}/$srvname-log"
install -v -m644 "log/run" "${TOPDIR}/$srvname-log"
sed -i "s/daemon/$srvname/g" "${TOPDIR}/$srvname-log/run"
sed -i "s/template/$PKG/g" "${TOPDIR}/$srvname-log/run"
echo "3" > "${TOPDIR}/$srvname-log/notification-fd"
echo "$srvname-srv" > "${TOPDIR}/$srvname-log/consumer-for"
echo "longrun" > "${TOPDIR}/$srvname-log/type"
}
install_srv() {
install -v -d "${TOPDIR}/$dirname"
for file in "$dir"/*; do
install -v -m644 "$file" "${TOPDIR}/$dirname"
filename=$(basename "$file")
case $filename in
run) echo "longrun" > "${TOPDIR}/$dirname/type" ;;
up) echo "oneshot" > "${TOPDIR}/$dirname/type" ;;
esac
done
if [ "$dirname" = "$srvname-srv" ] && ! log_blacklist; then
if ! cg_dependency_blacklist; then
install -v -d "${TOPDIR}/$dirname/dependencies.d"
touch "${TOPDIR}/$dirname/dependencies.d/$srvname-cg"
fi
if ! log_blacklist; then
echo "$srvname-log" > "${TOPDIR}/$dirname/producer-for"
fi
fi
# Install any contents.d/dependencies.d files if needed
for subdir in "$dir"/*; do
if [ -d "$subdir" ]; then
subdirname=$(basename "$subdir")
if [ "${subdirname}" = "contents.d" ]; then
echo "bundle" > "${TOPDIR}/$dirname/type"
fi
install -v -d "${TOPDIR}/$dirname/$subdirname"
for file in "$subdir"/*; do
install -v -m644 "$file" "${TOPDIR}/$dirname/$subdirname"
done
fi
done
if [ "${TOPDIR}" = "${ADMINSVDIR}" ]; then
install -v -d "${FALLBACKSVDIR}/$dirname"
cp -ar "${TOPDIR}/$dirname" "${FALLBACKSVDIR}/$dirname"
fi
}
for dir in "srv/$PKG"/*; do
if [ -d "$dir" ]; then
dirname=$(basename "$dir")
@@ -17,46 +158,18 @@ for dir in "srv/$PKG"/*; do
else
TOPDIR="${SVDIR}"
fi
# Install log if needed
srv_count=$(find "srv/$PKG" -name "*-srv" -type d | wc -l)
log_count=$(find "srv/$PKG" -name "*-log" -type d | wc -l)
if [ "$srv_count" -eq 1 ] && [ "$log_count" -eq 0 ] && echo "$dir" | grep -q "\-srv"; then
srvname=$(basename "$dir" | sed 's/-srv//')
install -v -d "${TOPDIR}/$srvname-log"
for file in "log"/*; do
install -v -m644 "$file" "${TOPDIR}/$srvname-log"
filename=$(basename "$file")
sed -i "s/daemon/$srvname/g" "${TOPDIR}/$srvname-log/$filename"
sed -i "s/template/$PKG/g" "${TOPDIR}/$srvname-log/$filename"
done
install_log
fi
if [ -f "srv/$PKG/$PKG.conf" ] || ([ "$srv_count" -gt 0 ] && echo "$dir" | grep -q "\-srv"); then
install -v -d "${CONFDIR}"
# If a config already exists, don't install the generic one.
if [ -f "srv/$PKG/$PKG.conf" ]; then
install -v -m644 "srv/$PKG/$PKG.conf" "${CONFDIR}/$PKG.conf"
else
install -v -m644 "conf" "${CONFDIR}/$PKG.conf"
fi
install_conf
fi
# Install srv
install -v -d "${TOPDIR}/$dirname"
for file in "$dir"/*; do
install -v -m644 "$file" "${TOPDIR}/$dirname"
done
if [ "${TOPDIR}" = "${ADMINSVDIR}" ]; then
install -v -d "${FALLBACKSVDIR}/$dirname"
cp -ar "${TOPDIR}/$dirname" "${FALLBACKSVDIR}/$dirname"
run_file=$(find "$dir" -name "run" -type f)
if [ -n "$run_file" ] && ! echo "$dir" | grep -q "\-log"; then
install_cg
fi
# Install any dependencies.d files if needed
for subdir in "$dir"/*; do
if [ -d "$subdir" ]; then
subdirname=$(basename "$subdir")
install -v -d "${TOPDIR}/$dirname/$subdirname"
for file in "$subdir"/*; do
install -v -m644 "$file" "${TOPDIR}/$dirname/$subdirname"
done
fi
done
install_srv
fi
done

View File

@@ -1 +0,0 @@
daemon-srv

View File

@@ -1 +0,0 @@
3

View File

@@ -1 +0,0 @@
daemon

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
acpid-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
oneshot

View File

@@ -1 +0,0 @@
apache-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
apcupsd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
oneshot

View File

@@ -1 +0,0 @@
atd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
atftpd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -10,3 +10,35 @@ USE_AUGENRULES=yes
# This configures the directives used for s6-log in the log service.
DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -1 +0,0 @@
oneshot

View File

@@ -1 +0,0 @@
auditd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
autofs-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
avahi-daemon-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
oneshot

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
bitlbee-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
bluetoothd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
boinc-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
boltd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
brltty-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
bumblebeed-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
chronyd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1,3 +1,35 @@
# This configures the directives used for s6-log in the log service.
CLAMD_DIRECTIVES="n3 s2000000 T"
FRESHCLAM_DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -1 +0,0 @@
clamd

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
clamd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
freshclam

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
freshclam-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
longrun

View File

@@ -3,3 +3,35 @@ OPTS=""
# This configures the directives used for s6-log in the log service.
DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -1 +0,0 @@
connmand-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
consul-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
containerd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
coturn-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
oneshot

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
oneshot

View File

@@ -1 +0,0 @@
longrun

View File

@@ -3,3 +3,35 @@ AUTH_METHOD="pam"
# This configures the directives used for s6-log in the log service.
DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -1 +0,0 @@
saslauthd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
darkhttpd-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -13,3 +13,35 @@ OPTS=""
# This configures the directives used for s6-log in the log service.
DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -1 +0,0 @@
dbus-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -8,3 +8,35 @@ DBUS_UUIDGEN="no"
# This configures the directives used for s6-log in the log service.
DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
deluge-web

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1 +0,0 @@
deluge-web-log

View File

@@ -1 +0,0 @@
longrun

View File

@@ -1,3 +1,35 @@
# This configures the directives used for s6-log in the log service.
DELUGE_WEB_DIRECTIVES="n3 s2000000 T"
DELUGED_DIRECTIVES="n3 s2000000 T"
# This variable contains the cgroups version 2 settings for your services.
# If this is set in this file, the settings will apply to all services.
# If you want different settings for each service, place the settings in
# /etc/conf.d/foo for service foo.
# The format is to specify the setting and value followed by a newline.
# Multiple settings and values can be specified.
# For example, you would use this to set the maximum memory and maximum
# number of pids for a service.
#SV_CG_SETTINGS="
#memory.max 10485760
#pids.max max
#"
#
# For more information about the adjustments that can be made with
# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
# source tree.
#SV_CG_SETTINGS=""
# If this is yes, we will send sighup to the processes in the cgroup
# immediately after stopsig and sigcont.
#SV_CG_SEND_SIGHUP="NO"
# This is the amount of time in seconds that we delay after sending sigcont
# and optionally sighup, before we optionally send sigkill to all
# processes in the # cgroup.
# The default is 90 seconds.
#SV_CG_TIMEOUT_STOPSEC="90"
# If this is set to no, we do not send sigkill to all processes in the
# cgroup.
#SV_CG_SEND_SIGKILL="YES"

View File

@@ -1 +0,0 @@
deluged

Some files were not shown because too many files have changed in this diff Show More