[Samba] Programmatically Retrieve Current Stable Version

Rowland Penny rpenny at samba.org
Mon Aug 13 08:59:59 UTC 2018


On Fri, 10 Aug 2018 20:58:38 -0400
John Clendenen via samba <samba at lists.samba.org> wrote:

> I am writing an update script for Samba (compiled from source) and I
> am wondering how best to programmatically get the latest release
> version number.
> 
> I know that https://download.samba.org/pub/samba/samba-latest.tar.gz
> exists, but I would like to get the version number to compare to smbd
> -V, so that it can quietly ignore if Samba is already up to date.
> 
> My currently solution is to incrementally prod at
> https://download.samba.org/pub/samba/stable/samba-4.X.X.tar.gz, but
> that’s obviously not ideal.
> 
> Please let me know if there is a better, accepted way to about this.
> 
> Thank you for all your hard work. I am looking forward to the 4.9
> release.

Samba tells you what the latest stable version is here (at the moment):

https://download.samba.org/pub/samba/LATEST-IS-SAMBA-4.8.3

So you could write a script something like this to check it:

#!/bin/bash

# Get present Samba version
version=$(smbd -V | awk '{print $2}' | awk -F '-' '{print $1}')

url="https://download.samba.org/pub/samba/LATEST-IS-$version"

if curl -f ${url} >/dev/null 2>&1; then
  echo "Using latest version"
else
  echo "New version available"
fi

exit 0

Rowland



More information about the samba mailing list