Posted: Tue 29 Jan 2013, 21:10 Post subject:
Warn user to upgrade gtkdialog
In my app report-video 2.7 I warn the user to upgrade to version 8.4.
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:
#!/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
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum