projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
713666c
)
Small cleanup of indention and trailing whitespaces in tools/upload_supertux_wiki.sh
author
Arvid Norlander
<anmaster@berlios.de>
Sun, 28 Jan 2007 13:04:15 +0000
(13:04 +0000)
committer
Arvid Norlander
<anmaster@berlios.de>
Sun, 28 Jan 2007 13:04:15 +0000
(13:04 +0000)
SVN-Revision: 4699
tools/upload_supertux_wiki.sh
patch
|
blob
|
history
diff --git
a/tools/upload_supertux_wiki.sh
b/tools/upload_supertux_wiki.sh
index
7b78f21
..
92ae97c
100755
(executable)
--- a/
tools/upload_supertux_wiki.sh
+++ b/
tools/upload_supertux_wiki.sh
@@
-15,26
+15,26
@@
set -e
function rc_error() {
set -e
function rc_error() {
- echo "Create a file ~/.supertux-wiki.sh with the following syntax: "
- echo ""
-
echo "WIKI_USERNAME=your_username
"
-
echo "WIKI_PASSWORD=your_password
"
- echo ""
- exit 1;
+
echo "Create a file ~/.supertux-wiki.sh with the following syntax: "
+
echo ""
+
echo "WIKI_USERNAME=\"your_username\"
"
+
echo "WIKI_PASSWORD=\"your_password\"
"
+
echo ""
+
exit 1;
}
if [ ! -f ~/.supertux-wiki.sh ]; then
}
if [ ! -f ~/.supertux-wiki.sh ]; then
- echo "Error: Couldn't find ~/.supertux-wiki.sh"
- echo ""
- rc_error
+
echo "Error: Couldn't find ~/.supertux-wiki.sh"
+
echo ""
+
rc_error
fi
fi
-source
~/.supertux-wiki.sh
+source
"$HOME/.supertux-wiki.sh"
if [ -z "$WIKI_PASSWORD" -o -z "$WIKI_USERNAME" ]; then
if [ -z "$WIKI_PASSWORD" -o -z "$WIKI_USERNAME" ]; then
- echo "Error: WIKI_PASSWORD or WIKI_USERNAME not set"
- echo ""
- rc_error
+
echo "Error: WIKI_PASSWORD or WIKI_USERNAME not set"
+
echo ""
+
rc_error
fi
usage="\
fi
usage="\
@@
-44,23
+44,23
@@
Usage: $0 [OPTIONS] FILENAME DESCRIPTION
"
if [ ! $# -eq 2 ]; then
"
if [ ! $# -eq 2 ]; then
- if [ $# -eq 3 -a "x$1" = "x--overwrite" ]; then
- FILENAME="$2"
- DESCRIPTION="$3"
- IGNORE_WARNING="-F wpIgnoreWarning=1"
- else
- echo "${usage}" 1>&2
- exit 1
- fi
+
if [ $# -eq 3 -a "x$1" = "x--overwrite" ]; then
+
FILENAME="$2"
+
DESCRIPTION="$3"
+
IGNORE_WARNING="-F wpIgnoreWarning=1"
+
else
+
echo "${usage}" 1>&2
+
exit 1
+
fi
else
else
- FILENAME="$1"
- DESCRIPTION="$2"
- IGNORE_WARNING=""
+
FILENAME="$1"
+
DESCRIPTION="$2"
+
IGNORE_WARNING=""
fi
if [ ! -r "$FILENAME" ]; then
fi
if [ ! -r "$FILENAME" ]; then
- echo "Error: Can't read $FILENAME"
- exit 1
+
echo "Error: Can't read $FILENAME"
+
exit 1
fi
# MD5SUM=`md5sum "$1" | cut -c "1-32"`
fi
# MD5SUM=`md5sum "$1" | cut -c "1-32"`
@@
-71,20
+71,20
@@
STEP2_FILE="`tempfile`"
COOKIES_FILE="`tempfile`"
curl \
COOKIES_FILE="`tempfile`"
curl \
- -c "$COOKIES_FILE" \
-
-F "wpName=$WIKI_USERNAME"
\
-
-F "wpPassword=$WIKI_PASSWORD"
\
- -F "wpLoginattempt=Log in" \
- "http://supertux.lethargik.org/wiki/index.php?title=Special:Userlogin&action=submitlogin&returnto=Main_Page" > $STEP1_FILE
+
-c "$COOKIES_FILE" \
+
-F "wpName=$WIKI_USERNAME"
\
+
-F "wpPassword=$WIKI_PASSWORD"
\
+
-F "wpLoginattempt=Log in" \
+ "http://supertux.lethargik.org/wiki/index.php?title=Special:Userlogin&action=submitlogin&returnto=Main_Page" > "$STEP1_FILE"
curl \
curl \
- -b "${COOKIES_FILE}" \
- -F "wpUploadFile=@${FILENAME}" \
-
-F "wpUploadDescription=${DESCRIPTION}"
\
- -F "wpUploadAffirm=1" \
- -F "wpUpload='Upload file'" \
- $IGNORE_WARNING \
- "http://supertux.lethargik.org/wiki/index.php/Special:Upload" > $STEP2_FILE
+
-b "${COOKIES_FILE}" \
+
-F "wpUploadFile=@${FILENAME}" \
+
-F "wpUploadDescription=${DESCRIPTION}"
\
+
-F "wpUploadAffirm=1" \
+
-F "wpUpload='Upload file'" \
+
$IGNORE_WARNING \
+ "http://supertux.lethargik.org/wiki/index.php/Special:Upload" > "$STEP2_FILE"
echo "------------------------------------------------------------------------"
echo "------------------------------------------------------------------------"
@@
-92,14
+92,14
@@
links -dump $STEP2_FILE | sed "s/ *Views/## EOF ##/;/## EOF ##/q"
rm -f "$STEP1_FILE" "$STEP2_FILE" "$COOKIES_FILE"
rm -f "$STEP1_FILE" "$STEP2_FILE" "$COOKIES_FILE"
-WIKI_FILENAME=
$(basename $FILENAME | sed -n "s/^\(.\).*/\1/p" | tr '[a-z]' '[A-Z]')$(basename $FILENAME | sed "s/^.\(.*\)/\1/")
+WIKI_FILENAME=
"$(basename "$FILENAME" | sed -n "s/^\(.\).*/\1/p" | tr '[a-z]' '[A-Z]')$(basename "$FILENAME" | sed "s/^.\(.*\)/\1/")"
echo ""
echo "Link to the Image list:"
echo " http://supertux.lethargik.org/wiki/index.php/Special:Imagelist"
echo " "
echo ""
echo "Link to the Image list:"
echo " http://supertux.lethargik.org/wiki/index.php/Special:Imagelist"
echo " "
-echo "Link to the Image page:"
-echo " http://supertux.lethargik.org/wiki/index.php/Image:
"$WIKI_FILENAME
+echo "Link to the Image page:"
+echo " http://supertux.lethargik.org/wiki/index.php/Image:
${WIKI_FILENAME}"
echo ""
echo "Wiki Link (first without thumbnail, second with):"
echo " [[:Image:$WIKI_FILENAME|$DESCRIPTION]]"
echo ""
echo "Wiki Link (first without thumbnail, second with):"
echo " [[:Image:$WIKI_FILENAME|$DESCRIPTION]]"