Add disable and fix some paths

This commit is contained in:
Alex D. 2024-06-25 09:15:20 +00:00
parent 1577dfcf09
commit b307b67c22
Signed by: caskd
GPG Key ID: E5AE8A47B8EFC7ED
9 changed files with 54 additions and 16 deletions

View File

@ -3,7 +3,7 @@
. ../../APKBUILD.template
pkgname=nnd-s6-services
pkgver=2.81
pkgver=2.83
pkgrel=0
pkgdesc="Base services for s6"
depends="s6-rc s6-portable-utils s6-linux-utils"
@ -35,9 +35,10 @@ package() {
mkdir -p "$pkgdir"/etc/s6/env
mkdir -p "$pkgdir"/etc/s6/rc
mkdir -p "$pkgdir"/etc/s6/rc/default/contents.d
echo bundle > "$pkgdir"/etc/s6/rc/default/type
local RCPFX="/etc/s6/rc"
mkdir -p "$pkgdir"/"$RCPFX"
mkdir -p "$pkgdir"/"$RCPFX"/default/contents.d
echo bundle > "$pkgdir"/"$RCPFX"/default/type
}
check() {

View File

@ -11,10 +11,14 @@ alt_ab() {
if [ "$1" == "a" ]; then echo "b"; else echo "a"; fi
}
: ${S6_PATH:="${XDG_DATA_HOME:="/etc"}/s6"}
: ${S6_DIST_PATH:="${XDG_CONFIG_HOME:="/usr/share"}/nnd/s6/dist"}
: ${S6_LIVE_PATH:="${XDG_RUNTIME_DIR:="/run"}/s6-rc"}
: ${S6_SCANDIR_PATH:="${XDG_RUNTIME_DIR:="/run"}/service"}
: ${XDG_CONFIG_HOME:="/etc"}
: ${XDG_DATA_HOME:="/usr/share"}
: ${XDG_RUNTIME_DIR:="/run"}
: ${S6_PATH:="${XDG_CONFIG_HOME}/s6"}
: ${S6_DIST_PATH:="${XDG_DATA_HOME}/nnd/s6/dist"}
: ${S6_LIVE_PATH:="${XDG_RUNTIME_DIR}/s6-rc"}
: ${S6_SCANDIR_PATH:="${XDG_RUNTIME_DIR}/service"}
: ${S6_RC_PATH:="$S6_PATH/rc"}
: ${S6_ENV_PATH:="$S6_PATH/env"}
: ${S6_SV_PATH:="$S6_PATH/sv"}
@ -116,6 +120,25 @@ default() {
done
}
disable() {
for svc in $@; do
local src="$S6_DIST_PATH/$svc"
local target="$S6_PATH/$svc"
if ! [ -e "$src" ]; then
error "$svc doesn't exist"
return "$?"
fi
if [ -f "$target" ]; then
error "$svc is already disabled"
return "$?"
fi
disablefunc || return "$?"
done
}
custom() {
for svc in $@; do
local src="$S6_DIST_PATH/$svc"
@ -149,6 +172,20 @@ customfunc() {
fi
}
disablefunc() {
: ${src:?"Missing src in disablefunc"}
: ${target:?"Missing target in disablefunc"}
if ! rm "$target"; then
error "Failed to remove directory $target"
return "$?"
fi
if ! touch "$target"; then
error "Failed to create empty file $target"
return "$?"
fi
}
defaultfunc() {
: ${src:?"Missing src in defaultfunc"}
: ${target:?"Missing target in defaultfunc"}
@ -191,7 +228,7 @@ if [ -z "$cmd" ]; then
update || return "$?"
else
case "$cmd" in
generate|swap|update|dist|custom|default|cleanup) eval "$cmd" $@ || return "$?";;
generate|swap|update|dist|custom|disable|default|cleanup) eval "$cmd" $@ || return "$?";;
*) error "Invalid command $cmd"; return 1;;
esac
fi

View File

@ -1,4 +1,4 @@
#!/bin/execlineb -P
export VAL 0
export SYSCTL dev/tty/legacy_tiocsti
/usr/libexec/nnd/sysctl
/usr/libexec/nnd/s6/sysctl

View File

@ -1,4 +1,4 @@
#!/bin/execlineb -P
export VAL 0
export SYSCTL kernel/unprivileged_userns_clone
/usr/libexec/nnd/sysctl
/usr/libexec/nnd/s6/sysctl

View File

@ -1,4 +1,4 @@
#!/bin/execlineb -P
export VAL 0
export SYSCTL net/ipv4/ip_unprivileged_port_start
/usr/libexec/nnd/sysctl
/usr/libexec/nnd/s6/sysctl

View File

@ -1,4 +1,4 @@
#!/bin/execlineb -P
export VAL 0
export SYSCTL vm/nr_hugepages
/usr/libexec/nnd/sysctl
/usr/libexec/nnd/s6/sysctl

View File

@ -1,4 +1,4 @@
#!/bin/execlineb -P
export VAL 0
export SYSCTL vm/overcommit_memory
/usr/libexec/nnd/sysctl
/usr/libexec/nnd/s6/sysctl

View File

@ -1,4 +1,4 @@
#!/bin/execlineb -P
export VAL 0
export SYSCTL vm/overcommit_ratio
/usr/libexec/nnd/sysctl
/usr/libexec/nnd/s6/sysctl

View File

@ -1,4 +1,4 @@
#!/bin/execlineb -P
export VAL 0
export SYSCTL vm/swappiness
/usr/libexec/nnd/sysctl
/usr/libexec/nnd/s6/sysctl