-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfetch_sk.sh
executable file
·52 lines (46 loc) · 1.09 KB
/
fetch_sk.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
#!/bin/sh
case $# in
1)
app="$1"
what=sk
;;
2)
app="$1"
what="$2"
;;
*)
echo "usage: $0 app_name [sk|require_part]"
exit 1
;;
esac
topdir=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
settings="${topdir}/${app}_app/src/main/res/values/ou.xml"
if [ ! -f "$settings" ]; then
echo "No such file: $settings"
exit 1
fi
# scrape library_url from settings xml
url=$(egrep library_url $settings)
url=${url%<*}
url=${url#*>}
test -n "$url" || {
echo >&2 "library_url is empty for ${app}_app"
exit 1
}
# construct url
url="${url}/osrf-gateway-v1"
case "$what" in
require_part)
url="${url}?service=open-ils.actor&method=open-ils.actor.ou_setting.ancestor_default.batch¶m=1¶m=%5B%22circ.holds.ui_require_monographic_part_when_present%22%5D¶m=%22ANONYMOUS%22"
;;
sk)
url="${url}?service=open-ils.actor&method=open-ils.actor.ou_setting.ancestor_default.batch¶m=1¶m=%5B%22hemlock.cache_key%22%5D¶m=%22ANONYMOUS%22"
;;
*)
echo >&2 "don't know about \"$what\""
exit 1
;;
esac
# fetch
set -x
curl -sS "${url}" && echo