Checking Unraid version


itimpi

Recommended Posts

To save me writing my own I was wondering if there is a standard PHP routine in Unraid that I can use to check that the Unraid version meets the requirements for a new feature I am adding to a plugin (needs to be Unraid 6.9.0 beta 36 or higher). Ideally this routine would handle both stable and next type releases. 

 

It feels like a routine that may already be present somewhere if I could just locate it :)

Link to comment
21 minutes ago, itimpi said:

To save me writing my own I was wondering if there is a standard PHP routine in Unraid that I can use to check that the Unraid version meets the requirements for a new feature I am adding to a plugin (needs to be Unraid 6.9.0 beta 36 or higher). Ideally this routine would handle both stable and next type releases. 

 

It feels like a routine that may already be present somewhere if I could just locate it :)

Can you not just use

 

[var] => Array ( [version] => 6.9.0-beta35

Link to comment
16 minutes ago, SimonF said:

Can you not just use

 

[var] => Array ( [version] => 6.9.0-beta35

does that work correctly for detecting that 6.9.0 (i. e. stable version) is greater than any beta or rc release and rc releases are greater than beta ones?  I had not thought of doing it that way so maybe I should try it to see as it is a very simple way if it works.

 

Since I do not intend to release this new feature until 6.9.0 beta 36 (or later) is released I could probably get away in practice in just checking for the 6.9.09 part of the release info, but I thought the question war worth asking anyway.

Link to comment

Found this code in Squid's CA helpders.

 

#################################################################

# checks the Min/Max version of an app against unRaid's version #

# Returns: TRUE if it's valid to run, FALSE if not #

#################################################################

function versionCheck($template) {

global $caSettings;

if ( $template['MinVer'] && ( version_compare($template['MinVer'],$caSettings['unRaidVersion']) > 0 ) ) return false;

if ( $template['MaxVer'] && ( version_compare($template['MaxVer'],$caSettings['unRaidVersion']) < 0 ) ) return false;

return true;

}

 

Also version is available here.

 

root@Tower:/etc# cat unraid-version 
version="6.9.0-beta35"

Edited by SimonF
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.