]> git.saurik.com Git - apt.git/blob - vendor/getinfo
Merge branch 'debian/sid' into feature/apt-manpage
[apt.git] / vendor / getinfo
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 ;;
26 ubuntu-codename)
27 getrawfield 'ubuntu-codename' "${BASEDIR}/../doc/apt-verbatim.ent"
28 ;;
29 keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-distro-codename)
30 getfield "$1"
31 ;;
32 *)
33 echo >&2 "Unknown data field $1 requested"
34 exit 2
35 ;;
36 esac