version 1.1, 2012/02/21 23:16:22
|
version 1.1.1.2, 2023/09/27 11:21:37
|
Line 1
|
Line 1
|
#! /bin/sh |
#! /bin/sh |
# $Id$ |
# $Id$ |
# project miniupnp : http://miniupnp.free.fr/ |
# project miniupnp : http://miniupnp.free.fr/ |
# (c) 2009 Thomas Bernard | # (c) 2009-2021 Thomas Bernard |
|
|
FILE=miniupnpcstrings.h |
FILE=miniupnpcstrings.h |
TMPFILE=miniupnpcstrings.h.tmp |
|
TEMPLATE_FILE=${FILE}.in |
TEMPLATE_FILE=${FILE}.in |
|
|
|
if [ -n "$1" ] ; then |
|
FILE="$1" |
|
fi |
|
if [ -n "$2" ] ; then |
|
TEMPLATE_FILE="$2" |
|
fi |
|
TMPFILE=`mktemp -t miniupnpcstringsXXXXXX` |
|
if [ ! -f "$TMPFILE" ] ; then |
|
echo "mktemp failure" |
|
exit 1 |
|
fi |
|
|
# detecting the OS name and version |
# detecting the OS name and version |
OS_NAME=`uname -s` |
OS_NAME=`uname -s` |
OS_VERSION=`uname -r` |
OS_VERSION=`uname -r` |
Line 14 if [ -f /etc/debian_version ]; then
|
Line 25 if [ -f /etc/debian_version ]; then
|
OS_NAME=Debian |
OS_NAME=Debian |
OS_VERSION=`cat /etc/debian_version` |
OS_VERSION=`cat /etc/debian_version` |
fi |
fi |
|
|
# use lsb_release (Linux Standard Base) when available |
# use lsb_release (Linux Standard Base) when available |
LSB_RELEASE=`which lsb_release` |
LSB_RELEASE=`which lsb_release` |
if [ 0 -eq $? -a -x "${LSB_RELEASE}" ]; then |
if [ 0 -eq $? -a -x "${LSB_RELEASE}" ]; then |
OS_NAME=`${LSB_RELEASE} -i -s` | # On NixOS, lsb_release returns strings such as "NixOS" (with quotes), |
OS_VERSION=`${LSB_RELEASE} -r -s` | # so we need to stript them with the following xargs trick: |
| OS_NAME=`${LSB_RELEASE} -i -s | xargs echo` |
| OS_VERSION=`${LSB_RELEASE} -r -s | xargs echo` |
case $OS_NAME in |
case $OS_NAME in |
Debian) |
Debian) |
#OS_VERSION=`${LSB_RELEASE} -c -s` |
#OS_VERSION=`${LSB_RELEASE} -c -s` |
Line 49 sed -e "$EXPR" < $TEMPLATE_FILE > $TMPFILE
|
Line 63 sed -e "$EXPR" < $TEMPLATE_FILE > $TMPFILE
|
EXPR="s|MINIUPNPC_VERSION_STRING \".*\"|MINIUPNPC_VERSION_STRING \"${MINIUPNPC_VERSION}\"|" |
EXPR="s|MINIUPNPC_VERSION_STRING \".*\"|MINIUPNPC_VERSION_STRING \"${MINIUPNPC_VERSION}\"|" |
echo "setting MINIUPNPC_VERSION_STRING macro value to ${MINIUPNPC_VERSION} in $FILE." |
echo "setting MINIUPNPC_VERSION_STRING macro value to ${MINIUPNPC_VERSION} in $FILE." |
sed -e "$EXPR" < $TMPFILE > $FILE |
sed -e "$EXPR" < $TMPFILE > $FILE |
rm $TMPFILE | rm $TMPFILE && echo "$TMPFILE deleted" |
|
|