Restrict pkg completions to BSD

0507b04 loosened the FreeBSD-only restriction on `pkg` completions to
!SunOS in order to support DragonFlyBSD. This is overly broad and can
still cause the script to be loaded on systems that we can't
realistically expect to have `pkg` be the FreeBSD pkgng package manager
(especially since `pkg` is a much more generic term when compared to the
likes of `dnf`, `yum`, `deb`, and `apt`).

This patch changes `pkg` + BSD to be the minimum requirements for
considering a system to be using pkgng.
This commit is contained in:
Mahmoud Al-Qudsi 2021-01-05 17:26:48 -06:00
parent 7669e8e497
commit b5523dbd64

View File

@ -1,8 +1,14 @@
# Completions for pkgng package manager
# Solaris has a thing called "pkg", it works quite differently,
# and spews errors when called like this.
if uname | string match -q SunOS
# Solaris has a thing called "pkg"; it works quite differently and spews errors when called here.
# There are multiple SunOS-derived distributions and not all of them have `SunOS` in their name (and
# some of them also use pkgsrc and have a `pkg`).
#
# Additionally, this particular script is intended to complete the pkgng "Next Generation" package
# manager initially developed for FreeBSD though now available on a few other BSDs. From here on
# out, maintainers can assume we are specifically talking about the (Free)BSD `pkg` command being
# executed on a BSD system, rather than just work with "not SunOS".
if ! uname | string match -irq bsd
exit
end