1#! /bin/sh 2# $Id: updateminiupnpcstrings.sh,v 1.7 2011/01/04 11:41:53 nanard Exp $ 3# project miniupnp : http://miniupnp.free.fr/ 4# (c) 2009 Thomas Bernard 5 6FILE=miniupnpcstrings.h 7TMPFILE=miniupnpcstrings.h.tmp 8TEMPLATE_FILE=${FILE}.in 9 10# detecting the OS name and version 11OS_NAME=`uname -s` 12OS_VERSION=`uname -r` 13if [ -f /etc/debian_version ]; then 14 OS_NAME=Debian 15 OS_VERSION=`cat /etc/debian_version` 16fi 17# use lsb_release (Linux Standard Base) when available 18LSB_RELEASE=`which lsb_release` 19if [ 0 -eq $? -a -x "${LSB_RELEASE}" ]; then 20 OS_NAME=`${LSB_RELEASE} -i -s` 21 OS_VERSION=`${LSB_RELEASE} -r -s` 22 case $OS_NAME in 23 Debian) 24 #OS_VERSION=`${LSB_RELEASE} -c -s` 25 ;; 26 Ubuntu) 27 #OS_VERSION=`${LSB_RELEASE} -c -s` 28 ;; 29 esac 30fi 31 32# on AmigaOS 3, uname -r returns "unknown", so we use uname -v 33if [ "$OS_NAME" = "AmigaOS" ]; then 34 if [ "$OS_VERSION" = "unknown" ]; then 35 OS_VERSION=`uname -v` 36 fi 37fi 38 39echo "Detected OS [$OS_NAME] version [$OS_VERSION]" 40MINIUPNPC_VERSION=`cat VERSION` 41echo "MiniUPnPc version [${MINIUPNPC_VERSION}]" 42 43EXPR="s|OS_STRING \".*\"|OS_STRING \"${OS_NAME}/${OS_VERSION}\"|" 44#echo $EXPR 45test -f ${FILE}.in 46echo "setting OS_STRING macro value to ${OS_NAME}/${OS_VERSION} in $FILE." 47sed -e "$EXPR" < $TEMPLATE_FILE > $TMPFILE 48 49EXPR="s|MINIUPNPC_VERSION_STRING \".*\"|MINIUPNPC_VERSION_STRING \"${MINIUPNPC_VERSION}\"|" 50echo "setting MINIUPNPC_VERSION_STRING macro value to ${MINIUPNPC_VERSION} in $FILE." 51sed -e "$EXPR" < $TMPFILE > $FILE 52rm $TMPFILE 53 54