1 |
#!/bin/bash |
2 |
|
3 |
# Generate SetVouchers Request |
4 |
RES=set_vouchers.txt |
5 |
|
6 |
VOUCHERS=$* |
7 |
BASE64=/tmp/base64 |
8 |
|
9 |
# Create file header |
10 |
echo 'Name: SetVouchers method' > $RES |
11 |
echo 'Request: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cwmp="urn:dslforum-org:cwmp-1-0">' >> $RES |
12 |
echo ' <soap:Header/>' >> $RES |
13 |
echo ' <soap:Body>' >> $RES |
14 |
echo ' <SetVouchers>' >> $RES |
15 |
echo ' <VoucherList>' >> $RES |
16 |
|
17 |
# add vouchers |
18 |
for f in $VOUCHERS; do |
19 |
openssl base64 -in $f -out $BASE64 -a |
20 |
VOUCHER=`cat $BASE64 | tr -d '\n'` |
21 |
printf " <xsd:base64>%s</xsd:base64>\n" $VOUCHER >> $RES |
22 |
done |
23 |
|
24 |
# Close XML document |
25 |
echo ' </VoucherList>' >> $RES |
26 |
echo ' </SetVouchers>' >> $RES |
27 |
echo ' </soap:Body>' >> $RES |
28 |
echo ' </soap:Envelope>' >> $RES |
29 |
|