Initial PoC of the madness
parent
10e28b3afa
commit
ea8df9e7b3
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for mach in machines/*; do
|
||||||
|
statedir="state/${mach##*/}"
|
||||||
|
rm -rvf "$statedir"
|
||||||
|
done
|
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
unshare -rnm ./init.sh
|
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
for mach in machines/*; do
|
||||||
|
$mach/run-shim.sh
|
||||||
|
done
|
||||||
|
|
||||||
|
tmux
|
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/false
|
||||||
|
|
||||||
|
mach=$(basename $(dirname "$0"))
|
||||||
|
|
||||||
|
netns=netns
|
||||||
|
nethorror_root="`pwd`" # and hope?
|
||||||
|
|
||||||
|
ensure_started() {
|
||||||
|
test -e state/$mach/$netns || machines/$mach/start.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
attach() {
|
||||||
|
machines/$mach/attach.sh "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_statedir() {
|
||||||
|
dir="state/$mach"
|
||||||
|
mkdir "$dir"
|
||||||
|
for ns in $namespaces; do
|
||||||
|
nsfile="${ns#*=}"
|
||||||
|
touch "$nsfile"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
. ./lib.shs
|
||||||
|
. machines/$mach/opts.shs
|
||||||
|
|
||||||
|
nsenter --wdns=$nethorror_root $namespaces "$@"
|
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/false
|
||||||
|
|
||||||
|
namespaces="--net=./state/$mach/netns --mount=./state/$mach/mntns"
|
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
. ./lib.shs
|
||||||
|
|
||||||
|
ensure_started
|
||||||
|
attach machines/$mach/setup.sh
|
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# typically: bring up the networks
|
||||||
|
# TODO: veth naming?
|
||||||
|
|
||||||
|
# dummy for now:
|
||||||
|
ip route add unreachable 192.168.3.0/24
|
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
. ./lib.shs
|
||||||
|
. machines/$mach/opts.shs
|
||||||
|
|
||||||
|
setup_statedir
|
||||||
|
|
||||||
|
unshare $namespaces /bin/true # just create the namespaces
|
||||||
|
|
||||||
|
# TODO: connect to the bridges
|
Loading…
Reference in New Issue