]>
Commit | Line | Data |
---|---|---|
0005fa07 DK |
1 | #!/bin/sh |
2 | # small helper to extract information form *.ent files | |
3 | ||
4 | BASEDIR="$(readlink -f "$(dirname $0)")" | |
5 | INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")" | |
fa19cc95 | 6 | VERBATIM="${BASEDIR}/../doc/apt-verbatim.ent" |
0005fa07 DK |
7 | |
8 | if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then | |
9 | echo >&2 'The current vendor is not valid or not chosen by the buildsystem yet.' | |
10 | exit 1 | |
11 | fi | |
12 | ||
13 | getrawfield() { | |
14 | grep --max-count=1 "^<!ENTITY $1 \"" "${2:-$INFO}" | cut -d'"' -f 2 | |
15 | } | |
16 | ||
17 | getfield() { | |
18 | local FIELD="$(getrawfield "$@")" | |
19 | FIELD="${FIELD#*>}" | |
20 | echo "${FIELD%<*}" | |
21 | } | |
22 | ||
23 | case "$1" in | |
fa19cc95 DK |
24 | debian-stable-codename|debian-oldstable-codename|debian-testing-codename) |
25 | getrawfield "${1#*-}" "$VERBATIM" | |
bef4b142 | 26 | ;; |
0005fa07 | 27 | ubuntu-codename) |
fa19cc95 DK |
28 | getrawfield "$1" "$VERBATIM" |
29 | ;; | |
30 | keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) | |
31 | exec $0 'vendor' "$@" | |
32 | ;; | |
33 | vendor) | |
34 | getfield "$2" | |
0005fa07 | 35 | ;; |
fa19cc95 DK |
36 | verbatim) |
37 | getfield "$2" "$VERBATIM" | |
0005fa07 DK |
38 | ;; |
39 | *) | |
40 | echo >&2 "Unknown data field $1 requested" | |
41 | exit 2 | |
42 | ;; | |
43 | esac |