summaryrefslogtreecommitdiff
path: root/scripts/format.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/format.sh')
-rwxr-xr-xscripts/format.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/format.sh b/scripts/format.sh
new file mode 100755
index 0000000..c00e4c5
--- /dev/null
+++ b/scripts/format.sh
@@ -0,0 +1,26 @@
+#!/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