link executor: switch to pre-up/post-down
This commit is contained in:
parent
aba4b18862
commit
8fe264a120
1 changed files with 7 additions and 4 deletions
|
@ -29,12 +29,14 @@ is_vlan() {
|
|||
}
|
||||
|
||||
case "$PHASE" in
|
||||
up|down)
|
||||
pre-up|post-down)
|
||||
UP_DOWN="${PHASE##*-}"
|
||||
|
||||
if is_vlan; then
|
||||
ADD_DEL="add"
|
||||
[ "$PHASE" = "down" ] && ADD_DEL="delete"
|
||||
[ "$UP_DOWN" = "down" ] && ADD_DEL="delete"
|
||||
|
||||
if [ -e /sys/class/net/$IFACE ]; then
|
||||
if [ "$UP_DOWN" = "up" -a -e /sys/class/net/$IFACE ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -51,8 +53,9 @@ up|down)
|
|||
fi
|
||||
|
||||
${MOCK} ip link $ADD_DEL link "$IF_VLAN_RAW_DEVICE" name "$IFACE" type vlan id "$IF_VLAN_ID"
|
||||
[ "$UP_DOWN" = "up" ] && ${MOCK} ip link set $UP_DOWN dev $IFACE $IF_LINK_OPTIONS
|
||||
else
|
||||
${MOCK} ip link set $PHASE dev $IFACE $IF_LINK_OPTIONS
|
||||
${MOCK} ip link set $UP_DOWN dev $IFACE $IF_LINK_OPTIONS
|
||||
fi
|
||||
;;
|
||||
depend)
|
||||
|
|
Loading…
Reference in a new issue