From e79f0a84712ffaddb22ca3e4d1f89cf7405ba33b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 6 Aug 2021 20:54:05 +0100 Subject: [PATCH] uml: tidy up a bit Signed-off-by: Ian Jackson --- psusan-uml | 2 +- psusan-uml-inside | 15 ++++++++------- psusan-uml-wrap | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/psusan-uml b/psusan-uml index 7e72583..2dd8ade 100755 --- a/psusan-uml +++ b/psusan-uml @@ -11,7 +11,7 @@ mkfifo -m600 $fifo ) | \ bwrap --dev-bind / / --tmpfs /dev/shm \ linux mem=512M rootfstype=hostfs rootflags=/ rw \ - con=fd:2,fd:2 con1=fd:0,fd:1 init=$PWD/psusan-uml-inside | \ + con=fd:2,fd:2 con1=fd:0,fd:1 init="${0%/*}"/psusan-uml-inside | \ ( read banner : >$fifo diff --git a/psusan-uml-inside b/psusan-uml-inside index 243728e..ec5a393 100755 --- a/psusan-uml-inside +++ b/psusan-uml-inside @@ -1,17 +1,18 @@ #!/bin/bash set -e -# Set up vital pseudo-filesystems -mount -t proc none /proc + mkdir /dev/pts +mount -t proc none /proc mount -t devpts none /dev/pts -# Redirect I/O to the serial port (leave stderr to the console) +mount -t tmpfs none /tmp +mount -t tmpfs none /run + exec 0<>/dev/tty1 1>&0 -# Set the serial port into raw mode, to run a binary protocol stty raw -echo -# Choose what shell you want to run inside psusan -export SHELL=/bin/bash + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991959 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin export PATH -# And now run psusan over the serial port +export SHELL=/bin/bash + exec psusan diff --git a/psusan-uml-wrap b/psusan-uml-wrap index a563b4a..db1e091 100755 --- a/psusan-uml-wrap +++ b/psusan-uml-wrap @@ -4,4 +4,4 @@ mkdir -p tmp rm -rf tmp/uml mkdir -p -m2700 tmp/uml -plink -v -v -ssh-connection -proxycmd $PWD/psusan-uml $PWD "$@" +plink -v -v -ssh-connection -proxycmd "${0%/*}"/psusan-uml $PWD "$@" -- 2.30.2