From 9d56e00289cf6c182fc47ebbb066da93aa68bbbb Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jeremy@system76.com> Date: Sat, 11 May 2019 20:13:57 -0600 Subject: [PATCH] Run each redoxer instance in a separate location --- redoxer.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/redoxer.sh b/redoxer.sh index 367013b..3b00c98 100755 --- a/redoxer.sh +++ b/redoxer.sh @@ -79,7 +79,7 @@ function redoxfs_mount { return 1 fi - redoxfs build/redoxer.bin build/redoxer + redoxfs "$1" "$2" while ! redoxfs_mounted "$2" do if ! pgrep redoxfs >/dev/null @@ -90,9 +90,6 @@ function redoxfs_mount { done } -redoxfs_unmount build/redoxer -rm -rf build/redoxer build/redoxer.bin build/redoxer.log - name="$(basename "$1")" if [ ! -f build/bootloader.bin ] @@ -127,18 +124,27 @@ then mv build/base.bin.partial build/base.bin fi -cp build/base.bin build/redoxer.bin +uuid="$(uuidgen)" +function cleanup { + redoxfs_unmount "build/${uuid}" + rm -rf "build/${uuid}" "build/${uuid}.bin" "build/${uuid}.log" +} +trap cleanup EXIT + +cleanup + +cp build/base.bin "build/${uuid}.bin" -mkdir -p build/redoxer -redoxfs_mount build/redoxer.bin build/redoxer +mkdir -p "build/${uuid}" +redoxfs_mount "build/${uuid}.bin" "build/${uuid}" -cp "target/${TARGET}/release/redoxerd" "build/redoxer/bin/redoxerd" +cp "target/${TARGET}/release/redoxerd" "build/${uuid}/bin/redoxerd" for arg in "$@" do - echo "${arg}" >> build/redoxer/etc/redoxerd + echo "${arg}" >> "build/${uuid}/etc/redoxerd" done -redoxfs_unmount build/redoxer +redoxfs_unmount "build/${uuid}" qemu-system-x86_64 \ -enable-kvm \ @@ -147,15 +153,15 @@ qemu-system-x86_64 \ -m 2048 \ -smp 4 \ -serial mon:stdio \ - -chardev file,id=log,path=build/redoxer.log \ + -chardev file,id=log,path="build/${uuid}.log" \ -device isa-debugcon,chardev=log \ -device isa-debug-exit \ -netdev user,id=net0 \ -device e1000,netdev=net0 \ -nographic \ -vga none \ - -drive file=build/redoxer.bin,format=raw + -drive file="build/${uuid}.bin",format=raw echo echo "## redoxer $@ ##" -cat build/redoxer.log +cat "build/${uuid}.log" -- GitLab