[vbox-dev] Patch to support installation on non-Sun/Oracle Solaris hosts

Jim Klimov jimklimov at cos.ru
Tue Jul 7 12:45:06 GMT 2015

Hello Ram,

On 2015-07-02 11:52, Ramshankar wrote:
>> That's what I researched originally. The problem is, these "uname"
>> identifiers are not quite constant (and in my own build of the OS/Net
>> gate I can define anything I want).
> I'm sorry but I disagree with the expectations here.  If people want to
> make their OS practically unidentifiable, then the onus is on them to
> deal with the consequences.  If someone can fake up their own uname
> while building their own kernel, they can also break the kernel package
> FMRI any way they choose. This is not something we want to support.

Makes sense, and that's why I started with touch-files following an
established example so as to support anything regardless of matching,
only an admin (or wrap-package) who'd touch the file is needed. ;)

> With this being case, we should be able to use 'omni*' or 'oi_*' or
> 'illumos*' and use 5.11 snv_151 version compatibility.
> Regardless, I hacked up a patch last week trying to fix up the FMRI
> parsing (rest of the stuff is untouched).  I'm attaching the patch here
> (you might have to manually apply it, as it's pretty small).
> Let me know if this satisfies the requirements for supporting the
> distros in question. This patch doesn't do the uname simplification I
> mentioned above, so there's no guarantee that I'll be applying this
> patch if there is a simpler solution.

I think a "case" would be more readable and conservative on resources
than a stack of if-elif-else-fi (don't have to call an external program
too many times) and would suffice especially since you are comparing
fixed strings or, at most, simple wildcards here.

In the patch itself, here's a bit that worries me: either I've had a 
night too sleepless, or there is a logical error here:

+                    STR_KERN_MAJOR=`echo "$PKGFMRI" | sed 
+                    if test "$STR_KERN_MAJOR" = "5.12"; then
+ ###(comments snipped)
+                        BRANCH_VERSION=$STR_KERN_MAJOR
+                        HOST_OS_MAJORVERSION=`echo "$BRANCH_VERSION" | 
cut -f2 -d'-' | cut -f1,2 -d'.'`
+                        if test "$HOST_OS_MAJORVERSION" = "5.12"; then
+                            HOST_OS_MAJORVERSION="12"
+                            HOST_OS_MINORVERSION=`echo 
"$BRANCH_VERSION" | cut -f2 -d'-' | cut -f6 -d'.'`
+                            return 0
+                        else
+                            errorprint "Failed to parse the Solaris 
kernel major version."
+                            exit 1

Here you have STR_KERN_MAJOR=="5.12" (fixed, no more, no less), then
assign BRANCH_VERSION to the same "5.12" and try to `cut` major/minor
versions out of it. You do get "5.12" again as major, but minor without
the dash-separated part of the FMRI is meaningless (and ends up empty).

Otherwise, cutting the "5.11", "0.5.11" or "5.12" parts seems to work
correctly here.

Also, in line 10 (added comment for OI Hipster string) there is "of"
instead of "or" ;)


More information about the vbox-dev mailing list