2022-08-05 14:09:02 +03:00
|
|
|
#!/bin/bash
|
2018-10-05 16:43:05 +03:00
|
|
|
|
2022-08-05 14:09:02 +03:00
|
|
|
set -ex
|
|
|
|
|
|
|
|
# list of urls to match:
|
|
|
|
# - mobile.events.data.microsoft.com
|
|
|
|
# - vortex.data.microsoft.com
|
|
|
|
|
|
|
|
SEARCH="\.data\.microsoft\.com"
|
|
|
|
REPLACEMENT="s|//[^/]+\.data\.microsoft\.com|//0\.0\.0\.0|g"
|
|
|
|
|
|
|
|
# include common functions
|
2021-07-21 23:49:00 +03:00
|
|
|
. ../utils.sh
|
|
|
|
|
2022-08-05 14:09:02 +03:00
|
|
|
if is_gnu_sed; then
|
|
|
|
replace_with_debug () {
|
|
|
|
echo "found: ${2} (`date`)"
|
|
|
|
sed -i -E "${1}" "${2}"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
replace_with_debug () {
|
|
|
|
echo "found: ${2} (`date`)"
|
|
|
|
sed -i '' -E "${1}" "${2}"
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
export -f replace_with_debug
|
|
|
|
|
|
|
|
d1=`date +%s`
|
|
|
|
|
|
|
|
if [[ "${OS_NAME}" == "linux" ]]; then
|
|
|
|
if [[ ${VSCODE_ARCH} == "x64" ]]; then
|
2022-08-17 00:10:04 +03:00
|
|
|
./node_modules/@vscode/ripgrep/bin/rg --no-ignore -l "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
|
2021-07-21 23:49:00 +03:00
|
|
|
else
|
2022-08-05 14:09:02 +03:00
|
|
|
grep -rl --exclude-dir=.git -E "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
|
2021-07-21 23:49:00 +03:00
|
|
|
fi
|
2022-08-05 14:09:02 +03:00
|
|
|
elif [[ "${OS_NAME}" == "osx" ]]; then
|
|
|
|
./node_modules/@vscode/ripgrep/bin/rg --no-ignore -l "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
|
2018-10-05 16:43:05 +03:00
|
|
|
else
|
2022-08-05 14:09:02 +03:00
|
|
|
./node_modules/@vscode/ripgrep/bin/rg --no-ignore --path-separator=// -l "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
|
2018-10-05 16:43:05 +03:00
|
|
|
fi
|
2022-08-05 14:09:02 +03:00
|
|
|
|
|
|
|
d2=`date +%s`
|
|
|
|
|
|
|
|
echo "undo_telemetry: $( echo $((${d2} - ${d1})) )s"
|