Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 23 Nov 2014, 03:26
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Warn user to upgrade gtkdialog
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
don570


Joined: 10 Mar 2010
Posts: 3379
Location: Ontario

PostPosted: 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


____________________________________________________
warn-version.gz
Description  remove gz extension to obtain script
gz

 Download 
Filename  warn-version.gz 
Filesize  680 Bytes 
Downloaded  82 Time(s) 

Last edited by don570 on Mon 04 Feb 2013, 15:43; edited 3 times in total
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7082
Location: Perth, Western Australia

PostPosted: Fri 01 Feb 2013, 08:18    Post subject:  

# 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
#

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0466s ][ Queries: 13 (0.0035s) ][ GZIP on ]