summaryrefslogtreecommitdiff
path: root/scripts/format.sh
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2018-08-02 17:21:14 +0200
committerYves Fischer <yvesf-git@xapek.org>2018-08-02 17:59:06 +0200
commit74973624deed05d1cc8b297fb1d877cadad50969 (patch)
tree8304000f99a4dc0e0fad263fc9928d8e5ad6366c /scripts/format.sh
downloadesp8266-master.tar.gz
esp8266-master.zip
new commit-history root - cleaned off passwordsHEADmaster
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