]> git.saurik.com Git - apt.git/blame - vendor/getinfo
use a substvar to set the archive-keyring in debian/control
[apt.git] / vendor / getinfo
CommitLineData
0005fa07
DK
1#!/bin/sh
2# small helper to extract information form *.ent files
3
4BASEDIR="$(readlink -f "$(dirname $0)")"
5INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")"
6
7if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then
8 echo >&2 'The current vendor is not valid or not chosen by the buildsystem yet.'
9 exit 1
10fi
11
12getrawfield() {
13 grep --max-count=1 "^<!ENTITY $1 \"" "${2:-$INFO}" | cut -d'"' -f 2
14}
15
16getfield() {
17 local FIELD="$(getrawfield "$@")"
18 FIELD="${FIELD#*>}"
19 echo "${FIELD%<*}"
20}
21
22case "$1" in
23debian-stable-codename)
24 getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent"
25 ;;
26ubuntu-codename)
27 getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent"
28 ;;
29keyring-package)
30 getfield "$1"
31 ;;
32*)
33 echo >&2 "Unknown data field $1 requested"
34 exit 2
35 ;;
36esac