File: get-orig-source.sh

package info (click to toggle)
tk-html3 3.0~fossil20110109-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,644 kB
  • ctags: 5,882
  • sloc: ansic: 48,994; tcl: 26,030; sh: 1,190; yacc: 161; makefile: 24
file content (51 lines) | stat: -rwxr-xr-x 1,468 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh

#
# Download tkHTML from its fossil repository. This reqires that we know 
# the patch ID and have a session cookie.
#

#
# Fossil uuid and corresponding date. The date goes only into the version 
# number. Since the development is rather slow, there putting year-month-day
# here is more than enough.
#
UUID=4ee7aaa953d6cb59905b9ee1bf9f292a7138deb2
DATE="20110109"

SID=$(echo ${UUID} | cut -c-16)
INCOMING_TAR=tkHTML-${SID}.tar.gz

#
# Get the values for login
#
wget -O fossil_login.html http://tkhtml.tcl.tk/fossil/login
PASSWD=$(fgrep "getElementById('p')" fossil_login.html | cut -d\' -f4)
CS=$(fgrep \"cs\" fossil_login.html | cut -d\" -f6)
echo $PASSWD $CS
rm -f fossil_login.html

#
# Save the login cookie
#
wget -O /dev/null --save-cookies fossil_cookies.txt \
     --post-data "cs=${CS}&u=anonymous&p=${PASSWD}&in=Login" \
     http://tkhtml.tcl.tk/fossil/login

#
# Retrieve file with the login cookie
# 
wget --load-cookies fossil_cookies.txt -O ${INCOMING_TAR} \
     "http://tkhtml.tcl.tk/fossil/tarball/${INCOMING_TAR}?uuid=${UUID}"
rm -f fossil_cookies.txt

VERSION=$(tar xOf ${INCOMING_TAR} --wildcards \*/configure.in |\
          grep ^AC_INIT | cut -d, -f2 | cut -d\) -f1)
VERSION=$(echo ${VERSION} | tr -d \[\])

if [ "${VERSION}" != "" ] ; then
  DEBIAN_ORIG_TAR=tk-html3_${VERSION}~fossil${DATE}.orig.tar.gz
  ln -sf ${INCOMING_TAR} ${DEBIAN_ORIG_TAR}
else
  echo "Could not find version info in tar file. Check ${INCOMING_TAR}"
fi