]>
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")" | |
6 | ||
7 | if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then | |
8 | echo >&2 'The current vendor is not valid or not chosen by the buildsystem yet.' | |
9 | exit 1 | |
10 | fi | |
11 | ||
12 | getrawfield() { | |
13 | grep --max-count=1 "^<!ENTITY $1 \"" "${2:-$INFO}" | cut -d'"' -f 2 | |
14 | } | |
15 | ||
16 | getfield() { | |
17 | local FIELD="$(getrawfield "$@")" | |
18 | FIELD="${FIELD#*>}" | |
19 | echo "${FIELD%<*}" | |
20 | } | |
21 | ||
22 | case "$1" in | |
23 | debian-stable-codename) | |
24 | getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent" | |
25 | ;; | |
bef4b142 JS |
26 | tanglu-codename) |
27 | getrawfield 'tanglu-codename' "${BASEDIR}/../doc/apt-verbatim.ent" | |
28 | ;; | |
0005fa07 | 29 | ubuntu-codename) |
6de58cbf | 30 | getrawfield 'ubuntu-codename' "${BASEDIR}/../doc/apt-verbatim.ent" |
0005fa07 | 31 | ;; |
62f6ecbf | 32 | keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-distro-codename) |
0005fa07 DK |
33 | getfield "$1" |
34 | ;; | |
35 | *) | |
36 | echo >&2 "Unknown data field $1 requested" | |
37 | exit 2 | |
38 | ;; | |
39 | esac |