2023-07-20 14:25:13 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# shellcheck disable=SC1091,SC2016
|
2018-10-05 09:43:05 -04:00
|
|
|
|
2022-08-05 07:09:02 -04: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 16:49:00 -04:00
|
|
|
. ../utils.sh
|
|
|
|
|
2022-08-05 07:09:02 -04:00
|
|
|
if is_gnu_sed; then
|
|
|
|
replace_with_debug () {
|
2022-11-12 04:09:54 -05:00
|
|
|
echo "found: ${2}"
|
2022-08-05 07:09:02 -04:00
|
|
|
sed -i -E "${1}" "${2}"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
replace_with_debug () {
|
2022-11-12 04:09:54 -05:00
|
|
|
echo "found: ${2}"
|
2022-08-05 07:09:02 -04:00
|
|
|
sed -i '' -E "${1}" "${2}"
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
export -f replace_with_debug
|
|
|
|
|
2023-07-20 14:25:13 -04:00
|
|
|
d1=$( date +%s )
|
2022-08-05 07:09:02 -04:00
|
|
|
|
|
|
|
if [[ "${OS_NAME}" == "linux" ]]; then
|
|
|
|
if [[ ${VSCODE_ARCH} == "x64" ]]; then
|
2022-08-16 17:10:04 -04:00
|
|
|
./node_modules/@vscode/ripgrep/bin/rg --no-ignore -l "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
|
2021-07-21 16:49:00 -04:00
|
|
|
else
|
2022-08-05 07:09:02 -04:00
|
|
|
grep -rl --exclude-dir=.git -E "${SEARCH}" . | xargs -I {} bash -c 'replace_with_debug "${1}" "{}"' _ "${REPLACEMENT}"
|
2021-07-21 16:49:00 -04:00
|
|
|
fi
|
2022-08-05 07:09:02 -04: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 09:43:05 -04:00
|
|
|
else
|
2022-08-05 07:09:02 -04: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 09:43:05 -04:00
|
|
|
fi
|
2022-08-05 07:09:02 -04:00
|
|
|
|
2023-07-20 14:25:13 -04:00
|
|
|
d2=$( date +%s )
|
2022-08-05 07:09:02 -04:00
|
|
|
|
2023-07-20 14:25:13 -04:00
|
|
|
echo "undo_telemetry: $((d2 - d1))s"
|