diff --git a/munix b/munix index d10e091..e10b715 100755 --- a/munix +++ b/munix @@ -14,6 +14,7 @@ GPU=1 WAYLAND=1 PIPEWIRE=1 X11=0 +USING_PUBLISH=0 export TMP=/tmp TMPDIR=/tmp TEMP=/tmp TEMPDIR=/tmp LC_ALL=C if [ ! -e "$HOST_OPENGL_DRIVER" ]; then @@ -32,6 +33,7 @@ while [ "$#" -gt 0 ]; do --ro-bind) BWRAP_ARGS+=("--ro-bind" "$2" "$3"); shift 3;; --expose) BWRAP_ARGS+=("--bind" "$2" "$2"); shift 2;; --ro-expose) BWRAP_ARGS+=("--ro-bind" "$2" "$2"); shift 2;; + -p|--publish) USING_PUBLISH=1; MUVM_ARGS+=("--publish=$2"); shift 2;; --host-opengl-driver) HOST_OPENGL_DRIVER="$2"; shift 2;; --munix-bin-dir) SCRIPT_PATH="$2"; shift 2;; --muvm-bin-dir) MUVM_PATH="$2"; shift 2;; @@ -177,6 +179,10 @@ BWRAP_ARGS+=( --bind "$HOST_RUNTIME_DIR/port.sock" "$XDG_RUNTIME_DIR/krun/socket/port-50000" ) +if [ "$USING_PUBLISH" -eq 1 ]; then + printf "\n\n\n\e[1mNote: due to a \e[31mBUG\e[39m with port publishing (-p) you have to send the first outgoing packet (e.g. ping -c1 8.8.8.8) before your ports start receiving traffic. Sorry for the inconvenience!\e[39;0m\n\n\n\n" >&2 +fi + # do not 'exec' because of cleanup :) bwrap --unshare-all --share-net \ --uid $MICROVM_UID --gid $MICROVM_GID \