X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/6de58cbf6b78506898ef23ca26b068eedf8ed97f..1ed5f97952d3a7b722bd73992c92769ec0efc67c:/vendor/getinfo diff --git a/vendor/getinfo b/vendor/getinfo index 992b30cf4..504b086af 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -2,7 +2,42 @@ # small helper to extract information form *.ent files BASEDIR="$(readlink -f "$(dirname $0)")" -INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")" + +getcurrent() { + # search for an exact match to use the correct sources.list example + cd $BASEDIR + DISTROS="$(find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2)" + for DISTRO in $DISTROS; do + if dpkg-vendor --is $DISTRO; then + echo $DISTRO + return 0 + fi + done + + # if we haven't found a specific, look for a deriving + # we do ubuntu and debian last as those are the biggest families + # and would therefore potentially 'shadow' smaller families + # (especially debian as it sorts quiet early) + for DISTRO in $DISTROS; do + if [ "$DISTRO" = 'debian' -o "$DISTRO" = 'ubuntu' ]; then continue; fi + if dpkg-vendor --derives-from $DISTRO; then + echo $DISTRO + return 0 + fi + done + + # Do the ubuntu/debian dance we talked about + if dpkg-vendor --derives-from ubuntu; then + echo $DISTRO + return 0 + fi + + echo debian + return 0 +} + +INFO="$(readlink -f "${BASEDIR}/$(getcurrent)/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.' @@ -10,7 +45,7 @@ if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then fi getrawfield() { - grep --max-count=1 "^&2 "Unknown data field $1 requested"