DietPi version information

Hi there,

Is there a command to output the installed version of DietPi?
And also; is there a similar command to check the latest one available?

I want to add this information to my Home Assistant overview like this:


Thanks!

svh1985
/DietPi/dietpi/.version contains the installed version info. This is sourced to the login bash session, so you can run:
echo “$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC”

From within programs/scripts you either need to source the file as well or use grep/mawk/sed or something similar to scrape the version string.

Perfect that works!
And what about getting the latest version that is available to download? I want to create a notification in Home Assistant to notify me when a new version of DietPi is available. :sunglasses:

Is this the place where DietPi checks the latest version available:
https://raw.githubusercontent.com/MichaIng/DietPi/master/dietpi/server_version-6

Thanks!!

If the update check (dietpi-update 2, runs on boot and as daily cron job, if not disabled via dietpi.txt) will create the file /DietPi/dietpi/.update_available with exactly this version string inside, if an update is available.

And yep, the file you linked is the one that is checked for updates, when you are on master branch (default, stable).

echo “$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC”

Would welcome tips on assigning the full DietPi version to a PHP variable :slight_smile:

In PHP you’d need to read the version digits from /boot/dietpi/.version. Not sure if there is some shell like key=value interpreter, as this the format of this file. In the Allo web UI we execute sed as shell command three times, which is quite inefficient, but I’m no PHP expert and hence not sure whether there is a more efficient method :wink:.

Thanks. I got some help with this but the following working for me;

$dpver=vsprintf('%d.%d.%d', parse_ini_file('/DietPi/dietpi/.version'));
echo $dpver;

My version is 7.3.2

I’d like to compare this and create an ‘update available’ type message / flag. I don’t see a /DietPi/dietpi/.update_available but I do see that there are packages available. It would be nice to cobble all this together like;

Installed Version: 7.3.2
Current Version: 7.3.3
Packages Available: 25

Any tips :slight_smile:

Hi,

Folder /DietPi/ depreciated and is not existing anymore. DietPi scripts are located in /boot/dietpi now

I’m on 7.3.2 and /DietPi certainly is present here although /boot/dietpi/.version reflects same number as /DietPi/dietpi/.version

Sorry - just seen its a simlink :slight_smile:

Looks like the number of updated packages available that apt finds is written out to;

/run/dietpi/.apt_updates

Very useful :slight_smile:

yes the sym linc is still in place on older images to ensure compatibility to the new DietPi script code. On newer images, it did not exist at all. Therefore it’s recommended to use /boot/dietpi

Thanks :slight_smile:

What is the best / most reliable way to check for a new version being released?

You could try to read following files

/run/dietpi/.update_available
/run/dietpi/.apt_updates

If they are not present, no update or apt package update are available :sunglasses:

Works great thanks!

function GetAptUpdates(){
                        $aptud=exec("cat /run/dietpi/.apt_updates");
                        if(empty($aptud)){echo '0';}
                        else{echo $aptud;}}

In html

There are <?php GetAptUpdates();?> updated packages available