Add support to use GNU sed installed in mac osx (#770)
* Add support to use GNU sed installed in mac osx * Move common functions to utils.sh Co-authored-by: Swinder Pal Singh Juneja <swinder.juneja@oneplus.com>
This commit is contained in:
parent
e1b4583cf9
commit
66551077f8
3 changed files with 26 additions and 13 deletions
|
@ -3,8 +3,15 @@
|
|||
TELEMETRY_URLS="(dc\.services\.visualstudio\.com)|(vortex\.data\.microsoft\.com)"
|
||||
REPLACEMENT="s/$TELEMETRY_URLS/0\.0\.0\.0/g"
|
||||
|
||||
#include common functions
|
||||
. ../utils.sh
|
||||
|
||||
if [[ "$OS_NAME" == "osx" ]]; then
|
||||
grep -rl --exclude-dir=.git -E $TELEMETRY_URLS . | xargs sed -i '' -E $REPLACEMENT
|
||||
if is_gnu_sed; then
|
||||
grep -rl --exclude-dir=.git -E $TELEMETRY_URLS . | xargs sed -i -E $REPLACEMENT
|
||||
else
|
||||
grep -rl --exclude-dir=.git -E $TELEMETRY_URLS . | xargs sed -i '' -E $REPLACEMENT
|
||||
fi
|
||||
else
|
||||
grep -rl --exclude-dir=.git -E $TELEMETRY_URLS . | xargs sed -i -E $REPLACEMENT
|
||||
fi
|
||||
|
|
|
@ -3,18 +3,8 @@ DEFAULT_FALSE="'default': false"
|
|||
TELEMETRY_ENABLE="'telemetry.enableTelemetry':"
|
||||
TELEMETRY_CRASH_REPORTER="'telemetry.enableCrashReporter':"
|
||||
|
||||
is_gnu_sed () {
|
||||
sed --version >/dev/null 2>&1
|
||||
}
|
||||
|
||||
replace () {
|
||||
echo $1
|
||||
if is_gnu_sed; then
|
||||
sed -i -E "$1" $2
|
||||
else
|
||||
sed -i '' -E "$1" $2
|
||||
fi
|
||||
}
|
||||
#include common functions
|
||||
. ../utils.sh
|
||||
|
||||
update_setting () {
|
||||
local FILENAME="$2"
|
||||
|
|
16
utils.sh
Executable file
16
utils.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
#All common functions can be added to this file
|
||||
|
||||
is_gnu_sed () {
|
||||
sed --version >/dev/null 2>&1
|
||||
}
|
||||
|
||||
replace () {
|
||||
echo $1
|
||||
if is_gnu_sed; then
|
||||
sed -i -E "$1" $2
|
||||
else
|
||||
sed -i '' -E "$1" $2
|
||||
fi
|
||||
}
|
Loading…
Reference in a new issue