Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 38 lines (29 sloc) 0.964 kb
3b9abd5 @psycotica0 First Version of Purchase Script.
psycotica0 authored
1 #!/bin/sh
2
3 if [ -r "`dirname "$0"`"/tve-setup.sh ]; then
4 . "`dirname "$0"`"/tve-setup.sh
5 else
6 . "$TVEROOT"/usr/lib/tve-setup.sh
7 fi
8
9 BASEURL="http://pkgs.theveeb.com/" # XXX: Should this be an argument?
10
11 # Verify the presence of oauthsign
12 if ! cmdexists oauthsign; then
13 echo "You need the oauthsign utility from oauth-utils installed to use this script." 1>&2
14 exit 1
15 fi
16
17 PACKAGE="$1"
18 URL="https://theveeb.com/apps/$PACKAGE"
19
20 # Find the file where OAuth tokens are and get them
21 TOKENS="`getTVETokens "$BASEURL"`"
22 REQUEST="`getTVEAuthRequest "$TOKENS" "$URL" "PURCHASE"`"
23
24 # Make the request
31cb9f4 @psycotica0 Fixed Outputting of Purchase.
psycotica0 authored
25 # (The -w means that after the body it will output the HTTP Response Code)
26 RESPONSE="`curl -sL -X PURCHASE -w '%{http_code}' "$REQUEST"`"
27 # Pull out the Response Code
28 R_CODE="`echo "$RESPONSE" | tail -n 1`"
29 # And take the Reponse Code off the Reponse
30 RESPONSE="`echo "$RESPONSE" | sed '$d'`"
31
8430fc1 @singpolyma -ne is better than != for numbers
authored
32 if [ "$R_CODE" -ne 200 ]; then
3b9abd5 @psycotica0 First Version of Purchase Script.
psycotica0 authored
33 echo "$RESPONSE"
34 exit 2
35 fi
36
37 echo "$RESPONSE"
Something went wrong with that request. Please try again.