2009-07-14 00:13:10 +00:00
|
|
|
|
#! /bin/sh
|
2014-04-27 19:31:10 +00:00
|
|
|
|
# $Id: updateminiupnpcstrings.sh,v 1.7 2011/01/04 11:41:53 nanard Exp $
|
|
|
|
|
# project miniupnp : http://miniupnp.free.fr/
|
|
|
|
|
# (c) 2009 Thomas Bernard
|
2012-05-30 18:56:30 +00:00
|
|
|
|
|
2014-05-05 21:02:17 +00:00
|
|
|
|
VERSION_FILE=$1
|
|
|
|
|
TEMPLATE_FILE=$2
|
|
|
|
|
FILE=$3
|
|
|
|
|
TMPFILE=$3.tmp
|
2009-07-14 00:13:10 +00:00
|
|
|
|
|
|
|
|
|
# detecting the OS name and version
|
|
|
|
|
OS_NAME=`uname -s`
|
|
|
|
|
OS_VERSION=`uname -r`
|
|
|
|
|
if [ -f /etc/debian_version ]; then
|
2014-04-27 19:31:10 +00:00
|
|
|
|
OS_NAME=Debian
|
|
|
|
|
OS_VERSION=`cat /etc/debian_version`
|
2009-07-14 00:13:10 +00:00
|
|
|
|
fi
|
|
|
|
|
# use lsb_release (Linux Standard Base) when available
|
2012-05-30 18:15:33 +00:00
|
|
|
|
LSB_RELEASE=`which lsb_release`
|
|
|
|
|
if [ 0 -eq $? -a -x "${LSB_RELEASE}" ]; then
|
2014-04-27 19:31:10 +00:00
|
|
|
|
OS_NAME=`${LSB_RELEASE} -i -s`
|
|
|
|
|
OS_VERSION=`${LSB_RELEASE} -r -s`
|
|
|
|
|
case $OS_NAME in
|
|
|
|
|
Debian)
|
|
|
|
|
#OS_VERSION=`${LSB_RELEASE} -c -s`
|
|
|
|
|
;;
|
|
|
|
|
Ubuntu)
|
|
|
|
|
#OS_VERSION=`${LSB_RELEASE} -c -s`
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2012-05-30 18:15:33 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# on AmigaOS 3, uname -r returns "unknown", so we use uname -v
|
|
|
|
|
if [ "$OS_NAME" = "AmigaOS" ]; then
|
2014-04-27 19:31:10 +00:00
|
|
|
|
if [ "$OS_VERSION" = "unknown" ]; then
|
|
|
|
|
OS_VERSION=`uname -v`
|
|
|
|
|
fi
|
2009-07-14 00:13:10 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Detected OS [$OS_NAME] version [$OS_VERSION]"
|
2014-04-27 19:31:10 +00:00
|
|
|
|
MINIUPNPC_VERSION=`cat VERSION`
|
2012-05-30 18:15:33 +00:00
|
|
|
|
echo "MiniUPnPc version [${MINIUPNPC_VERSION}]"
|
2009-07-14 00:13:10 +00:00
|
|
|
|
|
2009-07-28 18:03:47 +00:00
|
|
|
|
EXPR="s|OS_STRING \".*\"|OS_STRING \"${OS_NAME}/${OS_VERSION}\"|"
|
2012-09-17 20:34:46 +00:00
|
|
|
|
#echo $EXPR
|
2012-05-30 18:15:33 +00:00
|
|
|
|
test -f ${FILE}.in
|
|
|
|
|
echo "setting OS_STRING macro value to ${OS_NAME}/${OS_VERSION} in $FILE."
|
2014-04-27 19:31:10 +00:00
|
|
|
|
sed -e "$EXPR" < $TEMPLATE_FILE > $TMPFILE
|
2012-05-30 18:15:33 +00:00
|
|
|
|
|
|
|
|
|
EXPR="s|MINIUPNPC_VERSION_STRING \".*\"|MINIUPNPC_VERSION_STRING \"${MINIUPNPC_VERSION}\"|"
|
|
|
|
|
echo "setting MINIUPNPC_VERSION_STRING macro value to ${MINIUPNPC_VERSION} in $FILE."
|
2014-04-27 19:31:10 +00:00
|
|
|
|
sed -e "$EXPR" < $TMPFILE > $FILE
|
|
|
|
|
rm $TMPFILE
|
2009-07-14 00:13:10 +00:00
|
|
|
|
|