diff --git a/README.md b/README.md index 1d06f26..80af307 100644 --- a/README.md +++ b/README.md @@ -102,9 +102,9 @@ serial console and the [QEMU monitor](https://www.qemu.org/docs/master/system/mo If you run with `--background /path/to/some/directory` as the first parameter, it will fork into the background and open Unix sockets in -that directory for console and monitor. Use -`./scripts/connect-qemu.sh` to connect to either of these sockets, and -^O to disconnect. +that directory for console and monitor. Use `connect-vm` (also in the +`buildEnv` environment) to connect to either of these sockets, and ^O +to disconnect. ### Emulated upstream connection @@ -116,9 +116,9 @@ Liminix PPPoE client support can be tested. This is made available in the `buildEnv`, so you can do something like mkdir ros-sockets - nix-shell -A buildEnv --arg device '(import ./devices/qemu)' \ - --run "routeros ros-sockets" - ./scripts/connect-qemu.sh ./ros-sockets/console + nix-shell -A buildEnv --arg device '(import ./devices/qemu)' + nix-shell$ routeros ros-sockets + nix-shell$ connect-vm ./ros-sockets/console to start it and connect to it. diff --git a/THOUGHTS.txt b/THOUGHTS.txt index 5e39ef3..217c1a6 100644 --- a/THOUGHTS.txt +++ b/THOUGHTS.txt @@ -468,7 +468,7 @@ don't yet know if any of those builds actually boots or does anything useful. Would be nice to clean up the run-qemu and connect-qemu scripts -and put them in the buildEnv +and put them in the buildEnv [DONE] Some thought needed about how to hook up the gl-ar750 to the internets, ideally in a way that mirrors typical real uses. AAISP have an L2TP diff --git a/pkgs/mips-vm/default.nix b/pkgs/mips-vm/default.nix index 7c1b22e..21d268c 100644 --- a/pkgs/mips-vm/default.nix +++ b/pkgs/mips-vm/default.nix @@ -1,11 +1,19 @@ { qemu +, socat , writeShellScriptBin -, stdenv +, symlinkJoin , lib -}: -writeShellScriptBin "mips-vm" - '' +}: let + mips-vm = writeShellScriptBin "mips-vm" '' export PATH="${lib.makeBinPath [qemu]}:$PATH" ${builtins.readFile ./mips-vm.sh} - '' + ''; + connect = writeShellScriptBin "connect-vm" '' + export PATH="${lib.makeBinPath [socat]}:$PATH" + socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f unix-connect:$1 + ''; +in symlinkJoin { + name = "mips-vm"; + paths = [ mips-vm connect ]; +} diff --git a/scripts/connect-qemu.sh b/scripts/connect-qemu.sh deleted file mode 100755 index 27f3f69..0000000 --- a/scripts/connect-qemu.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -nix-shell -p socat --run "socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f unix-connect:$1"