1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 13:35:36 +00:00

#6079: Fix miniupnpc script to handle spaces and other special chars in paths

This commit is contained in:
Mike Gelfand 2016-03-02 16:31:16 +00:00
parent 49228ecb14
commit 61f82cb6b5

View file

@ -3,10 +3,10 @@
# project miniupnp : http://miniupnp.free.fr/ # project miniupnp : http://miniupnp.free.fr/
# (c) 2009 Thomas Bernard # (c) 2009 Thomas Bernard
VERSION_FILE=$1 VERSION_FILE="$1"
TEMPLATE_FILE=$2 TEMPLATE_FILE="$2"
FILE=$3 FILE="$3"
TMPFILE=$3.tmp TMPFILE="$3.tmp"
# detecting the OS name and version # detecting the OS name and version
OS_NAME=`uname -s` OS_NAME=`uname -s`
@ -38,17 +38,17 @@ if [ "$OS_NAME" = "AmigaOS" ]; then
fi fi
echo "Detected OS [$OS_NAME] version [$OS_VERSION]" echo "Detected OS [$OS_NAME] version [$OS_VERSION]"
MINIUPNPC_VERSION=`cat ${VERSION_FILE}` MINIUPNPC_VERSION=`cat "${VERSION_FILE}"`
echo "MiniUPnPc version [${MINIUPNPC_VERSION}]" echo "MiniUPnPc version [${MINIUPNPC_VERSION}]"
EXPR="s|OS_STRING \".*\"|OS_STRING \"${OS_NAME}/${OS_VERSION}\"|" EXPR="s|OS_STRING \".*\"|OS_STRING \"${OS_NAME}/${OS_VERSION}\"|"
#echo $EXPR #echo $EXPR
test -f ${FILE}.in test -f "${FILE}.in"
echo "setting OS_STRING macro value to ${OS_NAME}/${OS_VERSION} in $FILE." 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}\"|" 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"