Fix statekeeping in manager and add nameif for persistent interface naming, fix mount autoimport
This commit is contained in:
parent
f53443b1f1
commit
430e95ea33
|
@ -3,7 +3,7 @@
|
|||
. ../../APKBUILD.template
|
||||
|
||||
pkgname=nnd-s6-services
|
||||
pkgver=2.1
|
||||
pkgver=2.3
|
||||
pkgrel=0
|
||||
pkgdesc="Base services for s6"
|
||||
depends="s6-rc s6-portable-utils s6-linux-utils"
|
||||
|
|
|
@ -18,12 +18,12 @@ alt_ab() {
|
|||
: ${S6_SV_PATH:="$S6_PATH/sv"}
|
||||
|
||||
# A/B mode, always keep last copy
|
||||
DB_FRESH_ACT=""
|
||||
DB_FRESH_NAC=""
|
||||
DB_FRESH_ACT() {
|
||||
readlink "$S6_SV_PATH/current" | cut -d. -f2 # if it fails (missing), it will be empty and 'a' will be used as inactive by default
|
||||
}
|
||||
|
||||
cstate() {
|
||||
DB_FRESH_ACT="$(readlink "$S6_SV_PATH/current" | cut -d. -f2)" # if it fails (missing), it will be empty and 'a' will be used as inactive by default
|
||||
DB_FRESH_NAC="$(alt_ab "$DB_FRESH_ACT")"
|
||||
DB_FRESH_NAC() {
|
||||
alt_ab "$(DB_FRESH_ACT)"
|
||||
}
|
||||
|
||||
generate() {
|
||||
|
@ -32,28 +32,28 @@ generate() {
|
|||
return "$?"
|
||||
fi
|
||||
|
||||
# A/B current
|
||||
if [ -d "$S6_SV_PATH/current.$DB_FRESH_NAC" ]; then
|
||||
if ! rm -rf "$S6_SV_PATH/current.$DB_FRESH_NAC"; then
|
||||
local NAC="$(DB_FRESH_NAC)"
|
||||
if [ -d "$S6_SV_PATH/current.$NAC" ]; then
|
||||
if ! rm -rf "$S6_SV_PATH/current.$NAC"; then
|
||||
error "Failed to remove inactive database path"
|
||||
return "$?"
|
||||
fi
|
||||
fi
|
||||
if ! s6-rc-compile "$S6_SV_PATH/current.$DB_FRESH_NAC" "$S6_RC_PATH"; then
|
||||
if ! s6-rc-compile "$S6_SV_PATH/current.$NAC" "$S6_RC_PATH"; then
|
||||
error "Failed to compile current s6 database"
|
||||
return "$?"
|
||||
fi
|
||||
}
|
||||
|
||||
swap() {
|
||||
local new="current.$DB_FRESH_NAC"
|
||||
local new="current.$(DB_FRESH_NAC)"
|
||||
if ! [ -d "$S6_SV_PATH/$new" ]; then
|
||||
error "There's no database to switch to"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! s6-rc-db -c "$S6_SV_PATH/$new" check; then
|
||||
error "Database $DB_FRESH_NAC is invalid"
|
||||
error "Database $new is invalid"
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
|
@ -64,7 +64,7 @@ swap() {
|
|||
}
|
||||
|
||||
update() {
|
||||
if ! s6-rc-update "$S6_SV_PATH/current.$DB_FRESH_ACT"; then
|
||||
if ! s6-rc-update "$S6_SV_PATH/current.$(DB_FRESH_ACT)"; then
|
||||
error "Failed to update live state of the database"
|
||||
return "$?"
|
||||
fi
|
||||
|
@ -159,7 +159,6 @@ removedangle() {
|
|||
|
||||
cmd="$1"
|
||||
shift
|
||||
cstate
|
||||
if [ -z "$cmd" ]; then
|
||||
generate || return "$?"
|
||||
swap || return "$?"
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/execlineb -P
|
||||
s6-envdir -i /etc/s6/env/path
|
||||
importas -i PATH PATH
|
||||
|
||||
s6-envdir -I /etc/s6/env/nameif
|
||||
importas -D /etc/mactab CONFIG CONFIG
|
||||
|
||||
emptyenv
|
||||
|
||||
export PATH $PATH
|
||||
|
||||
exec nameif -c $CONFIG
|
|
@ -0,0 +1 @@
|
|||
longrun
|
|
@ -13,7 +13,7 @@ export PATH $PATH
|
|||
foreground { mkdir -p $DEST }
|
||||
|
||||
# Resolve LABEL and UUID
|
||||
backtick -e -D $SRCPROVIDED SRC { findfs $SRCPROVIDED }
|
||||
backtick -E -D $SRCPROVIDED SRC { findfs $SRCPROVIDED }
|
||||
|
||||
ifelse {
|
||||
redirfd -w 1 /dev/null findmnt -t $FSTYPE $DEST
|
||||
|
|
Loading…
Reference in New Issue