Warn user to upgrade gtkdialog

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

Warn user to upgrade gtkdialog

#1 Post by don570 »

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: 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
____________________________________________________
Attachments
warn-version.gz
remove gz extension to obtain script
(680 Bytes) Downloaded 176 times
Last edited by don570 on Mon 04 Feb 2013, 19:43, edited 3 times in total.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

# VER3="$(gtkdialog3 -v | cut -f 3 -d ' ')"
# VER4="$(gtkdialog4 -v | cut -f 3 -d ' ')"
# echo $VER3
0.7.20
# which vercmp
/bin/vercmp
# if vercmp $VER3 lt $VER4;then echo LESS; fi
LESS
# VER="$(gtkdialog -v | cut -f 3 -d ' ')"
# if vercmp $VER lt 0.8.4;then echo BAD;fi
BAD
# vercmp
usage: vercmp version1 lt|gt|le|ge|eq version2
return value 0 if true, else 1
#
[url]https://bkhome.org/news/[/url]

Post Reply