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
|
. ../../APKBUILD.template
|
||||||
|
|
||||||
pkgname=nnd-s6-services
|
pkgname=nnd-s6-services
|
||||||
pkgver=2.1
|
pkgver=2.3
|
||||||
pkgrel=0
|
pkgrel=0
|
||||||
pkgdesc="Base services for s6"
|
pkgdesc="Base services for s6"
|
||||||
depends="s6-rc s6-portable-utils s6-linux-utils"
|
depends="s6-rc s6-portable-utils s6-linux-utils"
|
||||||
|
|
|
@ -18,12 +18,12 @@ alt_ab() {
|
||||||
: ${S6_SV_PATH:="$S6_PATH/sv"}
|
: ${S6_SV_PATH:="$S6_PATH/sv"}
|
||||||
|
|
||||||
# A/B mode, always keep last copy
|
# A/B mode, always keep last copy
|
||||||
DB_FRESH_ACT=""
|
DB_FRESH_ACT() {
|
||||||
DB_FRESH_NAC=""
|
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_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
|
alt_ab "$(DB_FRESH_ACT)"
|
||||||
DB_FRESH_NAC="$(alt_ab "$DB_FRESH_ACT")"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generate() {
|
generate() {
|
||||||
|
@ -32,28 +32,28 @@ generate() {
|
||||||
return "$?"
|
return "$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# A/B current
|
local NAC="$(DB_FRESH_NAC)"
|
||||||
if [ -d "$S6_SV_PATH/current.$DB_FRESH_NAC" ]; then
|
if [ -d "$S6_SV_PATH/current.$NAC" ]; then
|
||||||
if ! rm -rf "$S6_SV_PATH/current.$DB_FRESH_NAC"; then
|
if ! rm -rf "$S6_SV_PATH/current.$NAC"; then
|
||||||
error "Failed to remove inactive database path"
|
error "Failed to remove inactive database path"
|
||||||
return "$?"
|
return "$?"
|
||||||
fi
|
fi
|
||||||
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"
|
error "Failed to compile current s6 database"
|
||||||
return "$?"
|
return "$?"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
swap() {
|
swap() {
|
||||||
local new="current.$DB_FRESH_NAC"
|
local new="current.$(DB_FRESH_NAC)"
|
||||||
if ! [ -d "$S6_SV_PATH/$new" ]; then
|
if ! [ -d "$S6_SV_PATH/$new" ]; then
|
||||||
error "There's no database to switch to"
|
error "There's no database to switch to"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! s6-rc-db -c "$S6_SV_PATH/$new" check; then
|
if ! s6-rc-db -c "$S6_SV_PATH/$new" check; then
|
||||||
error "Database $DB_FRESH_NAC is invalid"
|
error "Database $new is invalid"
|
||||||
return "$?"
|
return "$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ swap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
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"
|
error "Failed to update live state of the database"
|
||||||
return "$?"
|
return "$?"
|
||||||
fi
|
fi
|
||||||
|
@ -159,7 +159,6 @@ removedangle() {
|
||||||
|
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
shift
|
shift
|
||||||
cstate
|
|
||||||
if [ -z "$cmd" ]; then
|
if [ -z "$cmd" ]; then
|
||||||
generate || return "$?"
|
generate || return "$?"
|
||||||
swap || 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 }
|
foreground { mkdir -p $DEST }
|
||||||
|
|
||||||
# Resolve LABEL and UUID
|
# Resolve LABEL and UUID
|
||||||
backtick -e -D $SRCPROVIDED SRC { findfs $SRCPROVIDED }
|
backtick -E -D $SRCPROVIDED SRC { findfs $SRCPROVIDED }
|
||||||
|
|
||||||
ifelse {
|
ifelse {
|
||||||
redirfd -w 1 /dev/null findmnt -t $FSTYPE $DEST
|
redirfd -w 1 /dev/null findmnt -t $FSTYPE $DEST
|
||||||
|
|
Loading…
Reference in New Issue