Skip to content
Snippets Groups Projects
Commit 138cd8d0 authored by kkm's avatar kkm Committed by Kirill Katsnelson
Browse files

make_build_h: handle backslashes in external strings

LikewiseOpen creates user names with a backslash in them. A gentle
massage with sed(1) allows such strings to be inserted into build.h
properly quoted. I am also adding the same for host name and other
strings used in the script that are more or less user-controlled.

ASTERISK-26754

Change-Id: Iac5ef2b67a68ee58f35ddbf86bb818ba6eabecae
parent 10631bb2
Branches
Tags
No related merge requests found
#!/bin/sh #!/bin/sh
HOSTNAME=`uname -n` HOSTNAME=`uname -n | sed 's/\\\\/\\\\\\\\/g'`
KERNEL=`uname -r` KERNEL=`uname -r | sed 's/\\\\/\\\\\\\\/g'`
MACHINE=`uname -m` MACHINE=`uname -m | sed 's/\\\\/\\\\\\\\/g'`
OS=`uname -s` OS=`uname -s`
USER=`id | awk -F")" '{print $1}'| awk -F"(" '{print $2}'` USER=`id | awk -F")" '{print $1}'| awk -F"(" '{print $2}' | sed 's/\\\\/\\\\\\\\/g'`
DATE=`date -u "+%Y-%m-%d %H:%M:%S"` DATE=`date -u "+%Y-%m-%d %H:%M:%S"`
cat << END cat << END
/* /*
* build.h * build.h
* Automatically generated * Automatically generated
*/ */
#define BUILD_HOSTNAME "${HOSTNAME}" #define BUILD_HOSTNAME "${HOSTNAME}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment