Suggested improvement to debian/ubuntu plexmediaserver.preinst

The section in plexmediaserver.preinst which checks for the various Intel IGC components is a bit fragile - for example it will fail and print a warning if the packages are held to prevent upgrades (ie: dpkg -l starts with ‘hi’ rather than ‘ii’).

I suggest replacing the checks for these packages with something like:

[ “$(dpkg-query -f ‘${Version}\n’ -W intel-gmmlib 2>/dev/null)” = ‘21.3.3’ ] && HaveIntelGmmlib=1
[ “$(dpkg-query -f ‘${Version}\n’ -W intel-igc-core 2>/dev/null)” = ‘1.0.9441’ ] && HaveIntelIGCCore=1
[ “$(dpkg-query -f ‘${Version}\n’ -W intel-igc-opencl 2>/dev/null)” = ‘1.0.9441’ ] && HaveIntelIGCOpenCL=1
[ “$(dpkg-query -f ‘${Version}\n’ -W intel-opencl-icd 2>/dev/null)” = ‘21.49.21786’ ] && HaveIntelOpenCL=1

This confirms that a specific version is installed without reference to its status in the apt database.

Cleaner yet; I suggest defining a quick function just before the section which checks for existing packages; like:

dpkg-version() {
    dpkg-query -f '${Version}\n' -W "$1" 2>/dev/null
}

and then using that to check for specific versions of the various packages:

    # Beignet
    [ "$(dpkg-version beignet-opencl-icd)" != "" ] && HaveBeignet=1                                                                                                                                             
                                                                                                                                                                                                                            
    # ICR Packages (version 21.49.21786)                                                                                                                                                                                        
    [ "$(dpkg-version intel-gmmlib)"     = "21.3.3"      ] && HaveIntelGmmlib=1                                                                                                                     
    [ "$(dpkg-version intel-igc-core)"   = "1.0.9441"    ] && HaveIntelIGCCore=1                                                                                                                    
    [ "$(dpkg-version intel-igc-opencl)" = "1.0.9441"    ] && HaveIntelIGCOpenCL=1                                                                                                                  
    [ "$(dpkg-version intel-opencl-icd)" = "21.49.21786" ] && HaveIntelOpenCL=1                                                                                                                     
                                                                                                                                                                                                                                
    # OpenCL  (Required regardless of which Tone Mapping solution installed)                                                                                                                                                    
    [ "$(dpkg-version ocl-icd-libopencl1)" != "" ] && HaveOpenCL=1

@colmbuckley

Why don’t you join us in the main thread ?

I will move your posts there if you wish.

This is good voodoo :smiling_imp:

PS: I did spot the hi/ii status issue and corrected with a regex. Your suggestion sounds like it might cover all cases ?

Sounds good - please move my suggestions over to that thread and we can continue the discussion there.

… actually, having read that thread, I’ve added the relevant small suggestion which I think covers everything I’d like to see.

Thanks.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.