From beeedd568269fb21aa6e313d0ce8bb404ad1f0a7 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 17 Sep 2012 20:32:20 +0000 Subject: [PATCH] #5042 potential fix to building from a directory containing spaces --- .../miniupnp/updateminiupnpcstrings.sh | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/third-party/miniupnp/updateminiupnpcstrings.sh b/third-party/miniupnp/updateminiupnpcstrings.sh index d595a8021..e44cc8184 100755 --- a/third-party/miniupnp/updateminiupnpcstrings.sh +++ b/third-party/miniupnp/updateminiupnpcstrings.sh @@ -5,49 +5,53 @@ VERSION_FILE=$1 TEMPLATE_FILE=$2 FILE=$3 TMPFILE=$3.tmp +echo "1 $VERSION_FILE" +echo "2 $TEMPLATE_FILE" +echo "3 $FILE" +echo "4 $TMPFILE" # detecting the OS name and version OS_NAME=`uname -s` OS_VERSION=`uname -r` if [ -f /etc/debian_version ]; then - OS_NAME=Debian - OS_VERSION=`cat /etc/debian_version` +OS_NAME=Debian +OS_VERSION=`cat /etc/debian_version` fi # use lsb_release (Linux Standard Base) when available LSB_RELEASE=`which lsb_release` if [ 0 -eq $? -a -x "${LSB_RELEASE}" ]; then - 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 +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 fi # on AmigaOS 3, uname -r returns "unknown", so we use uname -v if [ "$OS_NAME" = "AmigaOS" ]; then - if [ "$OS_VERSION" = "unknown" ]; then - OS_VERSION=`uname -v` - fi +if [ "$OS_VERSION" = "unknown" ]; then +OS_VERSION=`uname -v` +fi fi echo "Detected OS [$OS_NAME] version [$OS_VERSION]" -MINIUPNPC_VERSION=`cat $VERSION_FILE` +MINIUPNPC_VERSION=`cat "$VERSION_FILE"` echo "MiniUPnPc version [${MINIUPNPC_VERSION}]" EXPR="s|OS_STRING \".*\"|OS_STRING \"${OS_NAME}/${OS_VERSION}\"|" -#echo $EXPR +echo $EXPR test -f ${FILE}.in echo "setting OS_STRING macro value to ${OS_NAME}/${OS_VERSION} in $FILE." -sed -e "$EXPR" < $TEMPLATE_FILE > $TMPFILE +sed -e "$EXPR" < "$TEMPLATE_FILE" > "$TMPFILE" EXPR="s|MINIUPNPC_VERSION_STRING \".*\"|MINIUPNPC_VERSION_STRING \"${MINIUPNPC_VERSION}\"|" echo "setting MINIUPNPC_VERSION_STRING macro value to ${MINIUPNPC_VERSION} in $FILE." -sed -e "$EXPR" < $TMPFILE > $FILE -rm $TMPFILE +sed -e "$EXPR" < "$TMPFILE" > "$FILE" +rm "$TMPFILE"