mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
The coreboot sites support HTTPS, and requests over HTTP with SSL are
also redirected. So use the more secure URLs, which also saves a
request most of the times, as nothing needs to be redirected.
Run the command below to replace all occurences.
```
$ git grep -l -E 'http://(www.|review.|)coreboot.org'
| xargs sed -i 's,http://\(.*\)coreboot.org,https://\1coreboot.org,g'
```
BUG=none
BRANCH=none
TEST=none
Change-Id: I881e55138a6114c67585ce37d4d719fe2626b83a
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: a8843dee58
Original-Change-Id: If53f8b66f1ac72fb1a38fa392b26eade9963c369
Original-Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Original-Reviewed-on: https://review.coreboot.org/20034
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/528256
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
80 lines
2.3 KiB
Bash
Executable file
80 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
# $1: file containing text
|
|
# $2: wiki page to update
|
|
|
|
. ~/.wikiaccount
|
|
WIKIAPI="https://www.coreboot.org/api.php"
|
|
TITLE="$2"
|
|
cookie_jar="$HOME/.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=json")
|
|
|
|
TOKEN=`echo $CR| sed -e 's,^.*"token":"\([^"]*\)".*$,\1,'`
|
|
if [ -z "$TOKEN" ]; then
|
|
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=json")
|
|
|
|
###############
|
|
#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=query&meta=tokens&format=json")
|
|
|
|
EDITTOKEN=`echo $CR| sed -e 's,^.*"csrftoken":"\([^"]*\)".*$,\1,'`
|
|
EDITTOKEN=`printf "$EDITTOKEN"`
|
|
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&")
|