]> git.saurik.com Git - apt.git/blobdiff - vendor/getinfo
indextargets: Check that cache could be built before using it
[apt.git] / vendor / getinfo
index ac816e10ebec65b408110eec84c064446cd57dc6..79da83620f1f7af93720a74a93cf19588a2f048f 100755 (executable)
@@ -3,6 +3,7 @@
 
 BASEDIR="$(readlink -f "$(dirname $0)")"
 INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")"
 
 BASEDIR="$(readlink -f "$(dirname $0)")"
 INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")"
+VERBATIM="${BASEDIR}/../doc/apt-verbatim.ent"
 
 if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then
        echo >&2 'The current vendor is not valid or not chosen by the buildsystem yet.'
 
 if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then
        echo >&2 'The current vendor is not valid or not chosen by the buildsystem yet.'
@@ -10,7 +11,7 @@ if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then
 fi
 
 getrawfield() {
 fi
 
 getrawfield() {
-       grep --max-count=1 "^<!ENTITY $1 \"" "${2:-$INFO}" | cut -d'"' -f 2
+       awk "/<!ENTITY $1/ {f=NR} f && NR-1==f { print; exit 0 }" RS='"' "${2:-$INFO}"
 }
 
 getfield() {
 }
 
 getfield() {
@@ -20,14 +21,17 @@ getfield() {
 }
 
 case "$1" in
 }
 
 case "$1" in
-debian-stable-codename)
-       getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent"
+debian-stable-codename|debian-oldstable-codename|debian-testing-codename|ubuntu-codename)
+       getrawfield "$1" "$VERBATIM"
        ;;
        ;;
-ubuntu-codename)
-       getrawfield 'stable-codename' "${BASEDIR}/../doc/apt-verbatim.ent"
+keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename)
+       exec $0 'vendor' "$@"
        ;;
        ;;
-keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri)
-       getfield "$1"
+vendor)
+       getfield "$2"
+       ;;
+verbatim)
+       getfield "$2" "$VERBATIM"
        ;;
 *)
        echo >&2 "Unknown data field $1 requested"
        ;;
 *)
        echo >&2 "Unknown data field $1 requested"