Skip to content

Instantly share code, notes, and snippets.

@Duncaen
Created October 13, 2016 00:07
Show Gist options
  • Select an option

  • Save Duncaen/f69df216ce249fcc1a5ea11cc00760d6 to your computer and use it in GitHub Desktop.

Select an option

Save Duncaen/f69df216ce249fcc1a5ea11cc00760d6 to your computer and use it in GitHub Desktop.
plan9.sh
#!/bin/sh
tmp=$(mktemp -d /tmp/plan9-XXXXXX)
binds="
mkdir -p usr/bin usr/lib tmp;
mount -t tmpfs tmp
mkdir -p tmp/.X11-unix
touch tmp/.X11-unix/X0
mount -v --bind /tmp/.X11-unix/X1 tmp/.X11-unix/X0;
mount -v --bind /usr/lib/ usr/lib;
mount -v --bind /usr/bin/ usr/bin;
ln -sf usr/lib lib;
ln -sf usr/bin bin;
"
cat <<EOF >"$tmp/init"
#!/bin/sh
export DISPLAY=:0
export PLAN9=/usr/lib/plan9
export PATH="\$PLAN9/bin:\$PATH"
exec rio
EOF
chmod +x "$tmp/init"
Xephyr -br -ac -noreset -screen 800x600 :1 &
sleep 1
contain -i "$binds" "$tmp" /init
rm -rf "$tmp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment