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
... | ... |
@@ -388,7 +388,26 @@ function GetDistro { |
388 | 388 |
elif [[ "$os_VENDOR" =~ (kvmibm) ]]; then |
389 | 389 |
DISTRO="${os_VENDOR}${os_RELEASE::1}" |
390 | 390 |
else |
391 |
- die $LINENO "Unable to determine DISTRO" |
|
391 |
+ # We can't make a good choice here. Setting a sensible DISTRO |
|
392 |
+ # is part of the problem, but not the major issue -- we really |
|
393 |
+ # only use DISTRO in the code as a fine-filter. |
|
394 |
+ # |
|
395 |
+ # The bigger problem is categorising the system into one of |
|
396 |
+ # our two big categories as Ubuntu/Debian-ish or |
|
397 |
+ # Fedora/CentOS-ish. |
|
398 |
+ # |
|
399 |
+ # The setting of os_PACKAGE above is only set to "deb" based |
|
400 |
+ # on a hard-coded list of vendor names ... thus we will |
|
401 |
+ # default to thinking unknown distros are RPM based |
|
402 |
+ # (ie. is_ubuntu does not match). But the platform will then |
|
403 |
+ # also not match in is_fedora, because that also has a list of |
|
404 |
+ # names. |
|
405 |
+ # |
|
406 |
+ # So, if you are reading this, getting your distro supported |
|
407 |
+ # is really about making sure it matches correctly in these |
|
408 |
+ # functions. Then you can choose a sensible way to construct |
|
409 |
+ # DISTRO based on your distros release approach. |
|
410 |
+ die $LINENO "Unable to determine DISTRO, can not continue." |
|
392 | 411 |
fi |
393 | 412 |
typeset -xr DISTRO |
394 | 413 |
} |