Here is how I did it.
Notes:
1) The first two lines finds the app
2) VERSION=( $($GTKDIALOG -v) ) # creates an array
3) VERSION=${VERSION[2]} # finds the third element of array
4) VERSION=$(echo $VERSION | sed 's/\.//g') # gets rid of period to make integer
5) VERSION=${VERSION: -2} # get rid of front zero by selecting last two digits
6) A final message is shown with yaf-splash
I suggest that apps that need gtkdialog4 have a warning window
in the pinstall.sh file using code like this.
Code: Select all
#!/bin/sh
# demonstrate warn-version
for P in gtkdialog4 gtkdialog3 gtkdialog; do
GTKDIALOG=$(which $P) && break
done
VERSION=( $($GTKDIALOG -v) ) # create an array
VERSION=${VERSION[2]} # find third element
VERSION=$(echo $VERSION | sed 's/\.//g') # remove period
VERSION=${VERSION: -2} # remove first zero
let "UPDATE=$VERSION-84" # check gtkdialog version at least 0.8.4
if [ "$UPDATE" -lt "0" ]; then
MESSAGE="Please update gtkdialog version"
else
MESSAGE="Version is up-to-date"
fi
A=$("$GTKDIALOG" -v | sed '1q' | awk '{ print $3 }')
yaf-splash -close box -border false -fontsize large -bg orange -text "Gtkdialog version $A
$MESSAGE" &
exit 0