-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall-aqbanking.sh
executable file
·219 lines (191 loc) · 6.62 KB
/
install-aqbanking.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/bin/bash
set -e
function on_error() {
echo "An error occurred, exiting."
}
trap on_error ERR
## online banking: gwenhywfar+aqbanking
GWENHYWFAR_VERSION="4.16.0beta"
GWENHYWFAR_URL="http://www2.aquamaniac.de/sites/download/download.php?package=01&release=204&file=01&dummy=gwenhywfar-4.16.0beta.tar.gz"
AQBANKING_VERSION="5.6.10"
AQBANKING_URL="http://www2.aquamaniac.de/sites/download/download.php?package=03&release=206&file=01&dummy=aqbanking-5.6.10.tar.gz"
GNUTLS_VERSION="2.12.22" #"3.1.26"
GNUTLS_URL="ftp://ftp.gnutls.org/gcrypt/gnutls/v2.12/gnutls-${GNUTLS_VERSION}.tar.bz2"
EXTRA_MAKE_ARGS="-j2"
GLOBAL_DIR=/opt/hbci
if [ ! -d $GLOBAL_DIR ] ; then
GLOBAL_DIR=$HOME/tmpa
else
echo "You must call:"
echo "yum install libgcrypt-devel p11-kit-devel gcc-g++ gmp-devel"
fi
AQBANKING_DIR=$GLOBAL_DIR/aqbanking-${AQBANKING_VERSION}
GWENHYWFAR_DIR=$AQBANKING_DIR
GNUTLS_DIR=$AQBANKING_DIR
#GWENHYWFAR_DIR=$GLOBAL_DIR/gwenhywfar-${GWENHYWFAR_VERSION}
DOWNLOAD_DIR=downloads
TMP_DIR=tmp
mkdir -p $TMP_DIR
PKG_CONFIG=pkg-config
export PKG_CONFIG_PATH="$AQBANKING_DIR/lib/pkgconfig:$GWENHYWFAR_DIR/lib/pkgconfig:$PKG_CONFIG_PATH"
function die() { echo "$@"; exit 1; }
function qpushd() { pushd "$@" >/dev/null; }
function qpopd() { popd >/dev/null; }
function unix_path() { echo "$*" | sed 's,^\([A-Za-z]\):,/\1,;s,\\,/,g'; }
# usage: smart_wget URL DESTDIR [DESTFILE]
function smart_wget() {
_FILE=`basename $1`
# Remove url garbage from filename that would not be removed by wget
_UFILE=${3:-${_FILE##*=}}
_DLD=`unix_path $2`
# If the file already exists in the download directory ($2)
# then don't do anything. But if it does NOT exist then
# download the file to the tmpdir and then when that completes
# move it to the dest dir.
if [ ! -f $_DLD/$_UFILE ] ; then
# If WGET_RATE is set (in bytes/sec), limit download bandwith
if [ ! -z "$WGET_RATE" ] ; then
wget --passive-ftp -c $1 -P $TMP_DIR --limit-rate=$WGET_RATE $WGET_EXTRA_OPTIONS
else
wget --passive-ftp -c $1 -P $TMP_DIR $WGET_EXTRA_OPTIONS
fi
mv $TMP_DIR/$_FILE $_DLD/$_UFILE
fi
LAST_FILE=$_DLD/$_UFILE
}
# usage: wget_unpacked URL DOWNLOAD_DIR UNPACK_DIR [DESTFILE]
function wget_unpacked() {
smart_wget $1 $2 $4
_EXTRACT_DIR=`unix_path $3`
_EXTRACT_SUBDIR=
echo -n "Extracting $_UFILE ... "
case $LAST_FILE in
*.zip)
unzip -q -o $LAST_FILE -d $_EXTRACT_DIR
_PACK_DIR=$(zipinfo -1 $LAST_FILE '*/*' 2>/dev/null | head -1)
;;
*.tar.gz|*.tgz)
tar -xzpf $LAST_FILE -C $_EXTRACT_DIR
_PACK_DIR=$(tar -ztf $LAST_FILE 2>/dev/null | head -1)
;;
*.tar.bz2)
tar -xjpf $LAST_FILE -C $_EXTRACT_DIR
_PACK_DIR=$(tar -jtf $LAST_FILE 2>/dev/null | head -1)
;;
*.tar.xz)
tar -xJpf $LAST_FILE -C $_EXTRACT_DIR
_PACK_DIR=$(tar -Jtf $LAST_FILE 2>/dev/null | head -1)
;;
*.tar.lzma)
lzma -dc $LAST_FILE |tar xpf - -C $_EXTRACT_DIR
_PACK_DIR=$(lzma -dc $LAST_FILE |tar -tf - 2>/dev/null | head -1)
;;
*)
die "Cannot unpack file $LAST_FILE!"
;;
esac
# Get the path where the files were actually unpacked
# This can be a subdirectory of the requested directory, if the
# tarball or zipfile contained a relative path.
_PACK_DIR=$(echo "$_PACK_DIR" | sed 's,^\([^/]*\).*,\1,')
if (( ${#_PACK_DIR} > 3 )) # Skip the bin and lib directories from the test
then
_EXTRACT_SUBDIR=$(echo $_UFILE | sed "s,^\($_PACK_DIR\).*,/\1,;t;d")
fi
_EXTRACT_DIR="$_EXTRACT_DIR$_EXTRACT_SUBDIR"
echo "done"
}
function assert_one_dir() {
counted=$(ls -d "$@" 2>/dev/null | wc -l)
if [[ $counted -eq 0 ]]; then
die "Exactly one directory is required, but detected $counted; please check why $@ wasn't created"
fi
if [[ $counted -gt 1 ]]; then
die "Exactly one directory is required, but detected $counted; please delete all but the latest one: $@"
fi
}
# #####################################################
mkdir -p $DOWNLOAD_DIR
# ##############################
# gnutls
echo "###"
echo "### Checking gnutls"
echo "###"
if ${PKG_CONFIG} --atleast-version=${GNUTLS_VERSION} gnutls
then
echo "GNUTLS already installed in $GNUTLS_DIR. skipping."
else
wget_unpacked $GNUTLS_URL $DOWNLOAD_DIR $TMP_DIR
assert_one_dir $TMP_DIR/gnutls-*
cd $TMP_DIR/gnutls-*
./configure \
--disable-cxx --disable-hardware-acceleration \
--without-lzo --disable-guile \
--with-libgcrypt \
--without-libnettle-prefix \
--without-libiconv-prefix \
--without-libpth-prefix \
--without-libintl-prefix \
--prefix=${GNUTLS_DIR}
make ${EXTRA_MAKE_ARGS}
make install
cd ..
${PKG_CONFIG} --exists gnutls || die "GNUTLS not installed correctly"
assert_one_dir gnutls-*
rm -rf gnutls-*
fi
GNUTLS_CPPFLAGS="-I${GNUTLS_DIR}/include"
GNUTLS_LDFLAGS="-L${GNUTLS_DIR}/lib"
# ##############################
# gwenhywfar
echo "###"
echo "### Checking gwenhywfar"
echo "###"
if ${PKG_CONFIG} --exact-version=${GWENHYWFAR_VERSION} gwenhywfar
then
echo "Gwenhywfar already installed in $GWENHYWFAR_DIR. skipping."
else
wget_unpacked $GWENHYWFAR_URL $DOWNLOAD_DIR $TMP_DIR
assert_one_dir $TMP_DIR/gwenhywfar-*
cd $TMP_DIR/gwenhywfar-*
./configure \
--disable-binreloc \
--disable-ssl \
--prefix=$GWENHYWFAR_DIR \
CPPFLAGS="${GNUTLS_CPPFLAGS}" \
LDFLAGS="${GNUTLS_LDFLAGS}" \
--with-guis=none
make ${EXTRA_MAKE_ARGS}
make install
cd ..
${PKG_CONFIG} --exact-version=${GWENHYWFAR_VERSION} gwenhywfar || die "Gwenhywfar not installed correctly"
assert_one_dir gwenhywfar-*
rm -rf gwenhywfar-*
fi
# ##############################
# aqbanking
echo "###"
echo "### Checking aqbanking"
echo "###"
if ${PKG_CONFIG} --exact-version=${AQBANKING_VERSION} aqbanking
then
echo "AqBanking already installed in $AQBANKING_DIR. skipping."
else
wget_unpacked $AQBANKING_URL $DOWNLOAD_DIR $TMP_DIR
assert_one_dir $TMP_DIR/aqbanking-*
cd $TMP_DIR/aqbanking-*
_AQ_BACKENDS="aqhbci"
./configure \
--with-gwen-dir=${GWENHYWFAR_DIR} \
--with-frontends="cbanking" \
--with-backends="${_AQ_BACKENDS}" \
--prefix=${AQBANKING_DIR} \
CPPFLAGS="${GNUTLS_CPPFLAGS}" \
LDFLAGS="${GNUTLS_LDFLAGS}"
make
make install
cd ..
${PKG_CONFIG} --exists aqbanking || die "AqBanking not installed correctly"
assert_one_dir aqbanking-*
rm -rf aqbanking-*
fi