Add some notes on DISTRO setting
It was pointed out in I42599c1bd851d2b61a56a3960f42ad051aab1727 that
after I46a2c36d95327087085df07cb797eb91249a893c we now die if we can't
determine DISTRO, rather than take a guess.
After some consideration, I don't consider this a regression. This
default matching was basically only working for LinuxMint, because we
already have some matching there for setting os_PACKAGE that makes us
know the platform is Ubuntu-ish.
However, I would certainly agree it is not particularly clear as to
why. This just adds some comments explaining why we can not just add
a default DISTRO fall-through and directs implementors on how to add
support for their platform.
Change-Id: I4b07259be1427d86a7154906646073d08dd07294
diff --git a/functions-common b/functions-common
index ff9bc0f..c11ba33 100644
--- a/functions-common
+++ b/functions-common
@@ -388,7 +388,26 @@
elif [[ "$os_VENDOR" =~ (kvmibm) ]]; then
DISTRO="${os_VENDOR}${os_RELEASE::1}"
else
- die $LINENO "Unable to determine DISTRO"
+ # We can't make a good choice here. Setting a sensible DISTRO
+ # is part of the problem, but not the major issue -- we really
+ # only use DISTRO in the code as a fine-filter.
+ #
+ # The bigger problem is categorising the system into one of
+ # our two big categories as Ubuntu/Debian-ish or
+ # Fedora/CentOS-ish.
+ #
+ # The setting of os_PACKAGE above is only set to "deb" based
+ # on a hard-coded list of vendor names ... thus we will
+ # default to thinking unknown distros are RPM based
+ # (ie. is_ubuntu does not match). But the platform will then
+ # also not match in is_fedora, because that also has a list of
+ # names.
+ #
+ # So, if you are reading this, getting your distro supported
+ # is really about making sure it matches correctly in these
+ # functions. Then you can choose a sensible way to construct
+ # DISTRO based on your distros release approach.
+ die $LINENO "Unable to determine DISTRO, can not continue."
fi
typeset -xr DISTRO
}