#!/bin/bash set -x PORT=$1 cat $PORT & PRINTER_PID=$! # interrupt echo -e -n "\003" >$PORT # Enter RAW Repl echo -e -n "\001" >$PORT echo -e -n "import flashbdev\004" >$PORT echo -e -n "import os\004" >$PORT sleep 0.1 echo -e -n "os.umount('/')\004" >$PORT echo -e -n "os.VfsFat.mkfs(flashbdev.bdev)\004" >$PORT echo -e -n "os.mount(flashbdev.bdev, '/')\004" >$PORT echo -e -n "\002" >$PORT sleep 0.5 kill $PRINTER_PID