]> git.saurik.com Git - apt.git/blobdiff - vendor/getinfo
support dpkg debug mode in APT::StateChanges
[apt.git] / vendor / getinfo
index d45c0fca2b085000585e8168674cc74193466103..79da83620f1f7af93720a74a93cf19588a2f048f 100755 (executable)
@@ -11,7 +11,7 @@ if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then
 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() {
@@ -21,10 +21,7 @@ getfield() {
 }
 
 case "$1" in
-debian-stable-codename|debian-oldstable-codename|debian-testing-codename)
-       getrawfield "${1#*-}" "$VERBATIM"
-       ;;
-ubuntu-codename)
+debian-stable-codename|debian-oldstable-codename|debian-testing-codename|ubuntu-codename)
        getrawfield "$1" "$VERBATIM"
        ;;
 keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename)