aboutsummaryrefslogtreecommitdiff
path: root/guix-container.sh
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-11-21 16:57:42 +0100
committerWojtek Kosior <koszko@koszko.org>2022-11-21 16:57:42 +0100
commitc132a774cb39b3f56d94f5e8e2f35a814673566b (patch)
treed5e18953ccc7ee02eee430895e262afc135b5b79 /guix-container.sh
parent9bc697b85a69af4d1a270aa5272db150c98bed42 (diff)
downloadkoszko-org-server-c132a774cb39b3f56d94f5e8e2f35a814673566b.tar.gz
koszko-org-server-c132a774cb39b3f56d94f5e8e2f35a814673566b.zip
avoid using `ip netn attach` which is not available with older util-linux
Diffstat (limited to 'guix-container.sh')
-rwxr-xr-xguix-container.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/guix-container.sh b/guix-container.sh
index 04781e8..65e3a63 100755
--- a/guix-container.sh
+++ b/guix-container.sh
@@ -53,7 +53,6 @@ is_running() {
network_rip() {
ip link delete veth-guix-out 2>/dev/null || true
- ip netns delete guix-container-ns 2>/dev/null || true
}
stop() {
@@ -112,16 +111,15 @@ start() {
network_rip
- ip netns attach guix-container-ns $SHEPHERD_PID
ip link add veth-guix-out type veth peer name veth-guix-in
- ip link set veth-guix-in netns guix-container-ns
+ ip link set veth-guix-in netns "$SHEPHERD_PID"
ip link set veth-guix-out up
ip addr add 10.207.87.1/24 dev veth-guix-out
- ip netns exec guix-container-ns ip link set lo up
- ip netns exec guix-container-ns ip link set veth-guix-in up
- ip netns exec guix-container-ns ip addr add 10.207.87.2/24 dev veth-guix-in
+ nsenter -t "$SHEPHERD_PID" --net ip link set lo up
+ nsenter -t "$SHEPHERD_PID" --net ip link set veth-guix-in up
+ nsenter -t "$SHEPHERD_PID" --net ip addr add 10.207.87.2/24 dev veth-guix-in
}
trap onexit EXIT