Rework structure and template services
This commit is contained in:
parent
f9a0844d6c
commit
9d90d0a2b7
|
@ -3,17 +3,19 @@
|
|||
. ../../APKBUILD.template
|
||||
|
||||
pkgname=nnd-s6-services
|
||||
pkgver=1.28
|
||||
pkgrel=0
|
||||
pkgver=2.0
|
||||
pkgrel=15
|
||||
pkgdesc="Base services for s6"
|
||||
depends="s6-rc s6-portable-utils s6-linux-utils"
|
||||
builddir="$srcdir/"
|
||||
_distpfx="etc/s6/dist"
|
||||
options=""
|
||||
|
||||
prepare() {
|
||||
default_prepare
|
||||
cp -R "$startdir"/rc "$builddir"/rc
|
||||
cp -R "$startdir"/env "$builddir"/env
|
||||
cp -R "$startdir"/tmpl "$builddir"/tmpl
|
||||
cp "$startdir"/manage.sh "$builddir"/manage.sh
|
||||
}
|
||||
|
||||
|
@ -23,6 +25,9 @@ package() {
|
|||
mv "$builddir"/rc "$pkgdir/$_distpfx"/rc
|
||||
mv "$builddir"/env "$pkgdir/$_distpfx"/env
|
||||
|
||||
mkdir -p "$pkgdir/usr/libexec/nnd/"
|
||||
mv "$builddir"/tmpl "$pkgdir/usr/libexec/nnd"/s6
|
||||
|
||||
# Manager
|
||||
install -Dm755 "$builddir"/manage.sh "$pkgdir"/usr/bin/nnd-s6
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/etc/ceph/ceph.conf
|
|
@ -1 +0,0 @@
|
|||
20
|
|
@ -1 +0,0 @@
|
|||
1000000
|
|
@ -1 +0,0 @@
|
|||
20
|
|
@ -1 +0,0 @@
|
|||
1000000
|
|
@ -1 +0,0 @@
|
|||
20
|
|
@ -1 +0,0 @@
|
|||
1000000
|
|
@ -1 +0,0 @@
|
|||
20
|
|
@ -1 +0,0 @@
|
|||
1000000
|
|
@ -1 +0,0 @@
|
|||
20
|
|
@ -1 +0,0 @@
|
|||
1000000
|
|
@ -1 +0,0 @@
|
|||
20
|
|
@ -1 +0,0 @@
|
|||
1000000
|
|
@ -1 +0,0 @@
|
|||
20
|
|
@ -1 +0,0 @@
|
|||
1000000
|
|
@ -1 +0,0 @@
|
|||
/var/log
|
|
@ -1 +0,0 @@
|
|||
nodev,nosuid
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtinterfaced
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtlockd
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtlogd
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtnetworkd
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtnodedevd
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtproxyd
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtqemud
|
|
@ -1 +0,0 @@
|
|||
/etc/libvirt/virtstoraged
|
|
@ -45,13 +45,6 @@ generate() {
|
|||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
if ! s6-rc-update "$S6_SV_PATH/current.$DB_FRESH_ACT"; then
|
||||
error "Failed to update live state of the database"
|
||||
return "$?"
|
||||
fi
|
||||
}
|
||||
|
||||
swap() {
|
||||
local new="current.$DB_FRESH_NAC"
|
||||
if ! [ -d "$S6_SV_PATH/$new" ]; then
|
||||
|
@ -70,61 +63,71 @@ swap() {
|
|||
fi
|
||||
}
|
||||
|
||||
dist() {
|
||||
SDIR="$S6_DIST_PATH/rc" DPATH="$S6_RC_PATH" distdefs || return "$?"
|
||||
SDIR="$S6_DIST_PATH/env" DPATH="$S6_ENV_PATH" distdefs || return "$?"
|
||||
# Remove any dangling invalid symlinks
|
||||
find -L /etc/s6/rc/ -type l -exec rm -v -- {} +
|
||||
update() {
|
||||
if ! s6-rc-update "$S6_SV_PATH/current.$DB_FRESH_ACT"; then
|
||||
error "Failed to update live state of the database"
|
||||
return "$?"
|
||||
fi
|
||||
}
|
||||
|
||||
distdefs() {
|
||||
if [ -z "$SDIR" ]; then
|
||||
error "SDIR not defined"
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$DPATH" ]; then
|
||||
error "DPATH not defined"
|
||||
return 1
|
||||
fi
|
||||
for cdir in "$SDIR"/*; do
|
||||
local srv="${cdir##*/}"
|
||||
local dsv="$DPATH/$srv"
|
||||
if [ ! -e "$dsv" ]; then
|
||||
if ! ln -sv "$cdir" "$dsv"; then
|
||||
error "Failed to create reference"
|
||||
return "$?"
|
||||
fi
|
||||
dist() {
|
||||
for src in "$S6_DIST_PATH/rc"/* "$S6_DIST_PATH/env"/*; do
|
||||
local svc="${src#$S6_DIST_PATH/}"
|
||||
if [ ! -e "$S6_PATH/$svc" ]; then
|
||||
default "$svc" || return "$?"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
# Remove any dangling invalid symlinks
|
||||
for i in rc env; do
|
||||
removedangle /etc/s6/"$i" || return "$?"
|
||||
done
|
||||
}
|
||||
|
||||
default() {
|
||||
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 [ -h "$target" ]; then
|
||||
error "$svc is already a default instance"
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
defaultfunc || return "$?"
|
||||
done
|
||||
}
|
||||
|
||||
custom() {
|
||||
local SVC="$1"
|
||||
for svc in $@; do
|
||||
local src="$S6_DIST_PATH/$svc"
|
||||
local target="$S6_PATH/$svc"
|
||||
|
||||
local target="$S6_RC_PATH/$SVC"
|
||||
if ! [ -e "$src" ]; then
|
||||
error "$svc doesn't exist"
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
if ! [ -e "$target" ]; then
|
||||
error "Service $SVC doesn't exist"
|
||||
return "$?"
|
||||
fi
|
||||
if [ -d "$target" ]; then
|
||||
error "$svc is already a custom instance"
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
if ! [ -h "$target" ]; then
|
||||
error "Service $SVC is already a custom instance"
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
customfunc "$S6_DIST_PATH/rc/$SVC" "$target" || return "$?"
|
||||
|
||||
local target="$S6_ENV_PATH/$SVC"
|
||||
if [ -e "$target" ]; then
|
||||
customfunc "$S6_DIST_PATH/env/$SVC" "$target" || return "$?"
|
||||
fi
|
||||
customfunc || return "$?"
|
||||
done
|
||||
}
|
||||
|
||||
customfunc() {
|
||||
local src="$1"
|
||||
local target="$2"
|
||||
if ! rm -rf "$target"; then
|
||||
: ${src:?Missing src in customfunc}
|
||||
: ${target:?Missing target in customfunc}
|
||||
if ! rm "$target"; then
|
||||
error "Failed to remove distributed directory $target"
|
||||
return "$?"
|
||||
fi
|
||||
|
@ -135,10 +138,35 @@ customfunc() {
|
|||
fi
|
||||
}
|
||||
|
||||
defaultfunc() {
|
||||
: ${src:?Missing src in defaultfunc}
|
||||
: ${target:?Missing target in defaultfunc}
|
||||
if ! rm -rf "$target"; then
|
||||
error "Failed to remove custom directory $target"
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
if ! ln -sv "$src" "$target"; then
|
||||
error "Failed to create reference to $src"
|
||||
return "$?"
|
||||
fi
|
||||
}
|
||||
|
||||
removedangle() {
|
||||
local dir="$1"
|
||||
find -L "$dir" -maxdepth 1 -type l -exec rm -v -- {} +
|
||||
}
|
||||
|
||||
cmd="$1"
|
||||
shift
|
||||
cstate
|
||||
case "$cmd" in
|
||||
generate|update|swap|dist|custom) eval "$cmd" $@ || return "$?";;
|
||||
*) error "Invalid command $cmd"; return 1;;
|
||||
esac
|
||||
if [ -z "$cmd" ]; then
|
||||
generate || return "$?"
|
||||
swap || return "$?"
|
||||
update || return "$?"
|
||||
else
|
||||
case "$cmd" in
|
||||
generate|swap|update|dist|custom|default) eval "$cmd" $@ || return "$?";;
|
||||
*) error "Invalid command $cmd"; return 1;;
|
||||
esac
|
||||
fi
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
bundle
|
|
@ -0,0 +1 @@
|
|||
logger.ceph
|
|
@ -1,15 +1,5 @@
|
|||
#!/bin/execlineb -P
|
||||
define ID 0
|
||||
define DAEMON mds
|
||||
export DAEMON mds
|
||||
export ID 0
|
||||
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
|
||||
s6-envdir -i /etc/s6/env/ceph
|
||||
importas -i CONFIG CONFIG
|
||||
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
|
||||
exec ceph-${DAEMON} -d -i $ID -c $CONFIG
|
||||
exec /usr/libexec/nnd/s6/ceph
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
logger.ceph
|
|
@ -1,15 +1,5 @@
|
|||
#!/bin/execlineb -P
|
||||
define ID 0
|
||||
define DAEMON mgr
|
||||
export DAEMON mgr
|
||||
export ID 0
|
||||
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
|
||||
s6-envdir -i /etc/s6/env/ceph
|
||||
importas -i CONFIG CONFIG
|
||||
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
|
||||
exec ceph-${DAEMON} -d -i $ID -c $CONFIG
|
||||
exec /usr/libexec/nnd/s6/ceph
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
logger.ceph
|
|
@ -1,15 +1,5 @@
|
|||
#!/bin/execlineb -P
|
||||
define ID 0
|
||||
define DAEMON mon
|
||||
export DAEMON mon
|
||||
export ID 0
|
||||
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
|
||||
s6-envdir -i /etc/s6/env/ceph
|
||||
importas -i CONFIG CONFIG
|
||||
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
|
||||
exec ceph-${DAEMON} -d -i $ID -c $CONFIG
|
||||
exec /usr/libexec/nnd/s6/ceph
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
#!/bin/execlineb -P
|
||||
define ID 0
|
||||
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
|
||||
s6-envdir -i /etc/s6/env/ceph.osd.${ID}
|
||||
importas -i DEV DEV
|
||||
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
export SRC /var/lib/ceph/osd/ceph-${ID}/block
|
||||
export DEST $DEV
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
exec ln -snf $DEV /var/lib/ceph/osd/ceph-${ID}/block
|
||||
exec /usr/libexec/nnd/s6/symlink
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
logger.ceph
|
|
@ -1,15 +1,5 @@
|
|||
#!/bin/execlineb -P
|
||||
define ID 0
|
||||
define DAEMON osd
|
||||
export DAEMON osd
|
||||
export ID 0
|
||||
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
|
||||
s6-envdir -i /etc/s6/env/ceph
|
||||
importas -i CONFIG CONFIG
|
||||
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
|
||||
exec ceph-${DAEMON} -d -i $ID -c $CONFIG
|
||||
exec /usr/libexec/nnd/s6/ceph
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/execlineb -P
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
# WARNING: DO NOT LET DIR BE EMPTY IN ANY CASE
|
||||
define DIR /var/empty
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
exec rm -rf $DIR
|
|
@ -1,12 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
emptyenv
|
||||
export DIR /var/empty
|
||||
|
||||
export PATH $PATH
|
||||
define DIR /var/empty
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
exec mkdir -p $DIR
|
||||
exec /usr/libexec/nnd/s6/dir
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/execlineb -P
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
# WARNING: DO NOT LET DIR BE EMPTY IN ANY CASE
|
||||
define DIR /var/lock
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
exec rm -rf $DIR
|
|
@ -1,12 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
emptyenv
|
||||
export DIR /var/lock
|
||||
|
||||
export PATH $PATH
|
||||
define DIR /var/empty
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
exec mkdir -p $DIR
|
||||
exec /usr/libexec/nnd/s6/dir
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
emptyenv
|
||||
export DIR /var/log
|
||||
|
||||
export PATH $PATH
|
||||
define DIR /var/log
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
exec mkdir -p $DIR
|
||||
exec /usr/libexec/nnd/s6/dir
|
||||
|
|
|
@ -1,15 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
define TTY tty1
|
||||
export TTY tty1
|
||||
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
s6-envdir -i /etc/s6/env/getty.${TTY}
|
||||
importas -i BAUD BAUD
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
exec getty ${BAUD} ${TTY}
|
||||
exec /usr/libexec/nnd/s6/getty
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/execlineb -P
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
s6-envdir -i /etc/s6/env/hostname
|
||||
importas -i HOSTNAME HOSTNAME
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
|
||||
fdclose 1
|
||||
fdclose 2
|
||||
|
||||
redirfd -w 1 /proc/sys/kernel/hostname echo $HOSTNAME
|
|
@ -0,0 +1 @@
|
|||
logger.libvirt
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
export NAME interface
|
||||
|
||||
exec /usr/libexec/nnd/s6/libvirtd
|
|
@ -0,0 +1 @@
|
|||
logger.libvirt
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
export NAME lock
|
||||
|
||||
exec /usr/libexec/nnd/s6/libvirtd
|
|
@ -0,0 +1 @@
|
|||
logger.libvirt
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
export NAME log
|
||||
|
||||
exec /usr/libexec/nnd/s6/libvirtd
|
|
@ -0,0 +1 @@
|
|||
logger.libvirt
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
export NAME lxc
|
||||
|
||||
exec /usr/libexec/nnd/s6/libvirtd
|
|
@ -0,0 +1 @@
|
|||
logger.libvirt
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
export NAME network
|
||||
|
||||
exec /usr/libexec/nnd/s6/libvirtd
|
|
@ -0,0 +1 @@
|
|||
logger.libvirt
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
export NAME nodedev
|
||||
|
||||
exec /usr/libexec/nnd/s6/libvirtd
|
|
@ -0,0 +1 @@
|
|||
logger.libvirt
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/execlineb -P
|
||||
export NAME proxy
|
||||
|
||||
exec /usr/libexec/nnd/s6/libvirtd
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue