summaryrefslogtreecommitdiff
path: root/util/board_status/to-wiki/push-to-wiki.sh
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2013-12-05 18:11:33 +0100
committerPatrick Georgi <patrick@georgi-clan.de>2013-12-05 18:40:25 +0100
commit274c6c2177979ba471f61f03d2ea76df673ff925 (patch)
treecaf296bd0453f0edee9db03be014664a65e629f8 /util/board_status/to-wiki/push-to-wiki.sh
parent08c4150ec4f9fde303205802d646f96a54fd5a59 (diff)
Add scripts to export board status data to wiki
It's a start... Change-Id: Ibdb0b64ab0349df58bcad5ce553bf0dbec636925 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/4483 Tested-by: build bot (Jenkins)
Diffstat (limited to 'util/board_status/to-wiki/push-to-wiki.sh')
-rwxr-xr-xutil/board_status/to-wiki/push-to-wiki.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/util/board_status/to-wiki/push-to-wiki.sh b/util/board_status/to-wiki/push-to-wiki.sh
new file mode 100755
index 0000000000..1f90745702
--- /dev/null
+++ b/util/board_status/to-wiki/push-to-wiki.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+# $1: file containing text
+
+. ~/.wikiaccount
+WIKIAPI="http://www.coreboot.org/api.php"
+TITLE="Supported_Motherboards"
+cookie_jar="/tmp/wikicookiejar"
+#Will store file in wikifile
+
+#################login
+#Login part 1
+CR=$(curl -sS \
+ --location \
+ --retry 2 \
+ --retry-delay 5\
+ --cookie $cookie_jar \
+ --cookie-jar $cookie_jar \
+ --user-agent "Curl Shell Script" \
+ --keepalive-time 60 \
+ --header "Accept-Language: en-us" \
+ --header "Connection: keep-alive" \
+ --compressed \
+ --data-urlencode "lgname=${USERNAME}" \
+ --data-urlencode "lgpassword=${USERPASS}" \
+ --request "POST" "${WIKIAPI}?action=login&format=txt")
+
+CR2=($CR)
+if [ "${CR2[9]}" = "[token]" ]; then
+ TOKEN=${CR2[11]}
+else
+ exit
+fi
+
+#Login part 2
+CR=$(curl -sS \
+ --location \
+ --cookie $cookie_jar \
+ --cookie-jar $cookie_jar \
+ --user-agent "Curl Shell Script" \
+ --keepalive-time 60 \
+ --header "Accept-Language: en-us" \
+ --header "Connection: keep-alive" \
+ --compressed \
+ --data-urlencode "lgname=${USERNAME}" \
+ --data-urlencode "lgpassword=${USERPASS}" \
+ --data-urlencode "lgtoken=${TOKEN}" \
+ --request "POST" "${WIKIAPI}?action=login&format=txt")
+
+###############
+#Get edit token
+CR=$(curl -sS \
+ --location \
+ --cookie $cookie_jar \
+ --cookie-jar $cookie_jar \
+ --user-agent "Curl Shell Script" \
+ --keepalive-time 60 \
+ --header "Accept-Language: en-us" \
+ --header "Connection: keep-alive" \
+ --compressed \
+ --request "POST" "${WIKIAPI}?action=tokens&format=txt")
+
+CR2=($CR)
+EDITTOKEN=${CR2[8]}
+if [ ${#EDITTOKEN} != 34 ]; then
+ exit
+fi
+#########################
+
+CR=$(curl -sS \
+ --location \
+ --cookie $cookie_jar \
+ --cookie-jar $cookie_jar \
+ --user-agent "Curl Shell Script" \
+ --keepalive-time 60 \
+ --header "Accept-Language: en-us" \
+ --header "Connection: keep-alive" \
+ --header "Expect:" \
+ --form "token=${EDITTOKEN}" \
+ --form "title=${TITLE}" \
+ --form "text=<$1" \
+ --request "POST" "${WIKIAPI}?action=edit&")
+