debian-archive() {
isdeb || return 0
local archive expression pri name highpri shortest
- local policy="${1:-$(apt-cache policy)}"
+ local policy="${1:-$(apt-cache policy)}" || return $?
# a = archive
# n = codename
# o = origin
debian-codename() {
isdeb || return 0
- local policy="$(apt-cache policy)"
+ local policy="$(apt-cache policy)" || return $?
archive=$(debian-archive "$policy")
echo "$policy" | sed -rn "s/^.*a=$archive,n=([a-z]+).*/\1/p;T;q"
}