Created
December 3, 2014 19:23
-
-
Save marineam/c9dd841afd218f7d021e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# And now we cry because --network-interface on systemd-nspawn is broken. :( | |
set -e | |
NAME="$1" | |
shift | |
for retry in {1..5}; do | |
if machinectl status "$NAME" &>/dev/null; then | |
break | |
else | |
sleep 0.1 | |
fi | |
done | |
LEADER=$(machinectl show "$NAME" --property=Leader) | |
PID="${LEADER#Leader=}" | |
echo "Moving interfaces to net namespace of $NAME ($PID): $*" | |
for IF in "$@"; do | |
ip link set dev "$IF" netns "$PID" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment