Revision: 6155 http://ipcop.svn.sourceforge.net/ipcop/?rev=6155&view=rev Author: dotzball Date: 2011-12-09 20:54:12 +0000 (Fri, 09 Dec 2011) Log Message: ----------- Tweak isversion() function in library.sh to allow addons check version for Version X or newer and for Version X or older.
Modified Paths: -------------- ipcop/trunk/src/libs/library.sh ipcop/trunk/updates/2.0.3/ROOTFILES.i486-2.0.3 Modified: ipcop/trunk/src/libs/library.sh =================================================================== --- ipcop/trunk/src/libs/library.sh 2011-12-07 21:31:51 UTC (rev 6154) +++ ipcop/trunk/src/libs/library.sh 2011-12-09 20:54:12 UTC (rev 6155) @@ -25,7 +25,7 @@ # Some helper functions useable by IPCop addons # Return values are 0 if ok, otherwise error -export LIBVERSION=1 +export LIBVERSION=2 export IPCOPVERSION=`/usr/bin/perl -e "require '/usr/lib/ipcop/general-functions.pl';print \\$General::version;"` export IPCOPMACHINE=`/usr/bin/perl -e "require '/usr/lib/ipcop/general-functions.pl';print \\$General::machine;"` @@ -34,8 +34,10 @@ # Parameter 1 is IPCop version to test for # Parameter 2 optional, if set a min-max version test is done # -# isversion 2.0.0 tests for version equal v2.0.0 +# isversion 2.0.0 tests for version equal v2.0.0 # isversion 2.0.0 2.0.5 tests for version between v2.0.0 and v2.0.5 +# isversion older 2.0.5 tests for version v2.0.5 and older (e.g. 2.0.4, 2.0.3 ...) +# isversion 2.0.2 newer tests for version v2.0.2 and newer (e.g. 2.0.3, 2.0.4 ...) isversion() { local i @@ -50,13 +52,22 @@ # Now test if version is within wanted range for i in `seq 1 3`; do - if [ 0`echo ${IPCOPVERSION} | cut -d"." -f ${i}` -lt 0`echo ${1} | cut -d"." -f ${i}` ]; then - return 1 - elif [ 0`echo ${IPCOPVERSION} | cut -d"." -f ${i}` -gt 0`echo ${2} | cut -d"." -f ${i}` ]; then - return 1 + if [ "x${1}" != "xolder" ]; then + if [ 0`echo ${IPCOPVERSION} | cut -d"." -f ${i}` -lt 0`echo ${1} | cut -d"." -f ${i}` ]; then + return 1 + fi fi + if [ "x${2}" != "xnewer" ]; then + if [ 0`echo ${IPCOPVERSION} | cut -d"." -f ${i}` -gt 0`echo ${2} | cut -d"." -f ${i}` ]; then + return 1 + fi + fi done + if [ "x${1}" == "xolder" -a "x${2}" == "xnewer" ]; then + return 1 + fi + return 0 } @@ -163,7 +174,7 @@ # Add to end of a file # Parameter 1 is Addon name # Parameter 2 is file with section to add -# Parameter 3 is target file +# Parameter 3 is target file # # Identifying lines will automatically surround the section to add, # for easy removal later Modified: ipcop/trunk/updates/2.0.3/ROOTFILES.i486-2.0.3 =================================================================== --- ipcop/trunk/updates/2.0.3/ROOTFILES.i486-2.0.3 2011-12-07 21:31:51 UTC (rev 6154) +++ ipcop/trunk/updates/2.0.3/ROOTFILES.i486-2.0.3 2011-12-09 20:54:12 UTC (rev 6155) @@ -8,6 +8,7 @@ /home/httpd/cgi-bin/trafficadm.cgi /home/httpd/cgi-bin/urlfilter.cgi /home/httpd/vhost81/cgi-bin/redirect.cgi +/usr/lib/ipcop/library.sh /usr/local/bin/makesquidconf /usr/local/bin/upgrade.sh /usr/share/locale/el_GR/LC_MESSAGES/ipcop.mo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn