summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Beattie <mike@ethernal.org>2012-03-23 08:20:02 +1300
committerMike Beattie <mike@ethernal.org>2012-03-23 08:20:02 +1300
commit336bf8c22dacbf051e163f005869072df6266b02 (patch)
treece11603f6166585aa265306ff34fdd85521a4598
parent43fcaefb0765e8b06382b57236b8046ef0025652 (diff)
Update encode script to support other html files
(also add config files to .gitignore) Signed-off-by: Mike Beattie <mike@ethernal.org>
-rw-r--r--.gitignore1
-rwxr-xr-xencode_html.sh16
2 files changed, 12 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 0a5840b..f5aedd4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
index_gzip.*
+config_gzip.*
diff --git a/encode_html.sh b/encode_html.sh
index 50da6cc..0672c56 100755
--- a/encode_html.sh
+++ b/encode_html.sh
@@ -1,16 +1,22 @@
#!/bin/sh
+page=index
+
+[ -n "${1}" ] && page=${1}
+
+[ ! -f "${page}.html" ] && exit 1
+
# Copy HTML to a web server....
-scp index.html prometheus.ethernal.org:public_html/arduino.html
+scp ${page}.html prometheus.ethernal.org:public_html/arduino.html
# Fetch HTML with appropriate Accept-Encoding: header -> save to raw file
-/bin/echo -ne "GET /~mjb/arduino.html HTTP/1.0\nAccept-Encoding: gzip\n\n" | nc www.ethernal.org 80 > index_gzip.raw
+/bin/echo -ne "GET /~mjb/arduino.html HTTP/1.0\nAccept-Encoding: gzip\n\n" | nc www.ethernal.org 80 > ${page}_gzip.raw
# Process Raw file - delete headers and blank line -> save to raw gzip dat file
-sed -e '0,/^\r$/d' index_gzip.raw > index_gzip.dat
+sed -e '0,/^\r$/d' ${page}_gzip.raw > ${page}_gzip.dat
# Process raw gzip dat file into hex array for inclusion in program
-od -A n -t x1 index_gzip.dat | sed -e 's/ \(..\)/0x\1, /g' -e 's/^/ /' > index_gzip.txt
+od -A n -t x1 ${page}_gzip.dat | sed -e 's/ \(..\)/0x\1, /g' -e 's/^/ /' > ${page}_gzip.txt
-ls -l index_gzip.*
+ls -l ${page}_gzip.*