From 08a12f3921c16cfaed4fa0f620fa7262c926d871 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 24 Dec 2013 16:57:36 +0000 Subject: [PATCH] Added a script to check for newer versions of included libs Just run "sh checklibs.sh". Currently checks liblua, libpcre, libpcap, and prints the latest version of liblinear (no version info is in the copy we have). Requires perl, curl, and a C compiler (cc). --- checklibs.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 checklibs.sh diff --git a/checklibs.sh b/checklibs.sh new file mode 100644 index 000000000..b1483de68 --- /dev/null +++ b/checklibs.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +NDIR=${NDIR:-$PWD} + +newest() { + perl -ne'$n=pack"C*",split/\./;$m=($m,$n)[$n gt$m];END{print join".",unpack("C*",$m)}' +} + +trim_version() { + echo $1 | sed 's/\(^\|\.\)0*/\1/g' +} + +check_libpcre() { + PCRE_SOURCE="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/" + PCRE_MAJOR="" + PCRE_MINOR="" + eval $(grep '^PCRE_MAJOR=' $NDIR/libpcre/configure) + eval $(grep '^PCRE_MINOR=' $NDIR/libpcre/configure) + PCRE_VERSION="$PCRE_MAJOR.$PCRE_MINOR" + PCRE_LATEST=$(curl -ls $PCRE_SOURCE | perl -lne 'if(/pcre-(\d+.\d+).tar.gz$/){print $1}' | newest) + if [ "$PCRE_VERSION" != "$PCRE_LATEST" ]; then + echo "Newer version of libpcre available" + echo " Current:" $PCRE_VERSION + echo " Latest: " $PCRE_LATEST + echo " Source: $PCRE_SOURCE" + fi +} + +check_libpcap() { + PCAP_SOURCE="http://www.tcpdump.org/release/" + PCAP_VERSION=$(cat $NDIR/libpcap/VERSION) + PCAP_LATEST=$(curl -s $PCAP_SOURCE | perl -lne 'if(/libpcap-([\d.]+).tar.gz/){print $1}' | newest) + if [ "$PCAP_VERSION" != "$PCAP_LATEST" ]; then + echo "Newer version of libpcap available" + echo " Current:" $PCAP_VERSION + echo " Latest: " $PCAP_LATEST + echo " Source: $PCAP_SOURCE" + fi +} + +check_liblua() { + LUA_SOURCE="http://www.lua.org/ftp/" + cat >check_liblua.c < +int main(int argc,char *argv[]){ +printf("%s\\n", LUA_RELEASE); +return 0; +} +EOC + cc -I"$NDIR/liblua" -o check_liblua check_liblua.c + LUA_VERSION=$(./check_liblua) + LUA_VERSION=${LUA_VERSION#Lua } + rm check_liblua check_liblua.c + LUA_LATEST=$(curl -s $LUA_SOURCE | perl -lne 'if(/lua-([\d.]+).tar.gz/){print $1}' | newest) + if [ "$LUA_VERSION" != "$LUA_LATEST" ]; then + echo "Newer version of liblua available" + echo " Current:" $LUA_VERSION + echo " Latest: " $LUA_LATEST + echo " Source: $LUA_SOURCE" + fi +} + +check_liblinear() { + LINEAR_SOURCE="http://www.csie.ntu.edu.tw/~cjlin/liblinear/" + echo "Can't check liblinear, no version information is available" + LINEAR_LATEST=$(curl -s $LINEAR_SOURCE | perl -lne 'if(/The current release \(([^)]+)\) of LIBLINEAR/){print $1;exit 0}') + echo " Latest:" $LINEAR_LATEST +} + +check_libpcre +check_libpcap +check_liblua +check_liblinear