build: double quote args and wrap in brace expansions (#1105)

This commit is contained in:
Frazer Smith 2022-06-05 20:30:23 +01:00 committed by GitHub
parent 31355417a8
commit 98d30bdc2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 95 additions and 95 deletions

View File

@ -6,7 +6,7 @@ CALLER_DIR=$( pwd )
cd "$( dirname "${BASH_SOURCE[0]}" )"
if [[ "$VSCODE_ARCH" == "x64" ]]; then
if [[ "${VSCODE_ARCH}" == "x64" ]]; then
wget -c https://github.com/$(wget -q https://github.com/AppImage/pkg2appimage/releases -O - | grep "pkg2appimage-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x ./pkg2appimage-*.AppImage

View File

@ -8,7 +8,7 @@ cd "$( dirname "${BASH_SOURCE[0]}" )"
SCRIPT_DIR=$( pwd )
cd ../../../VSCode-win32-${VSCODE_ARCH}/resources/app
cd "../../../VSCode-win32-${VSCODE_ARCH}/resources/app"
cp product.json product.json.bak
cat product.json.bak | jq "del(.updateUrl)" > product.json

View File

@ -24,10 +24,10 @@ ICON_DIR="..\\..\\..\\src\\resources\\win32"
LICENSE_DIR="..\\..\\..\\vscode"
PROGRAM_FILES_86=$( env | sed -n 's/^ProgramFiles(x86)=//p' )
if [[ -z "$1" ]]; then
if [[ -z "${1}" ]]; then
OUTPUT_BASE_FILENAME="${PRODUCT_NAME}-${VSCODE_ARCH}-${MS_TAG}"
else
OUTPUT_BASE_FILENAME="${PRODUCT_NAME}-${VSCODE_ARCH}-$1-${MS_TAG}"
OUTPUT_BASE_FILENAME="${PRODUCT_NAME}-${VSCODE_ARCH}-${1}-${MS_TAG}"
fi
if [[ "${VSCODE_ARCH}" == "ia32" ]]; then
@ -38,8 +38,8 @@ fi
BuildSetupTranslationTransform() {
local CULTURE=$1
local LANGID=$2
local CULTURE=${1}
local LANGID=${2}
LANGIDS="${LANGIDS},${LANGID}"
@ -47,13 +47,13 @@ BuildSetupTranslationTransform() {
"${WIX}bin\\light.exe" vscodium.wixobj "Files-${OUTPUT_BASE_FILENAME}.wixobj" -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -spdb -cc "${TEMP}\\vscodium-cab-cache\\${PLATFORM}" -reusecab -out "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi" -loc "i18n\\${PRODUCT_SKU}.${CULTURE}.wxl" -cultures:"${CULTURE}" -sice:ICE60 -sice:ICE69
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\WiLangId.vbs" ${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi Product "${LANGID}"
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\WiLangId.vbs" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi" Product "${LANGID}"
"${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\x86\\msitran" -g "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst"
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\wisubstg.vbs" ${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi ${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst "${LANGID}"
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\wisubstg.vbs" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst" "${LANGID}"
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\wisubstg.vbs" ${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\wisubstg.vbs" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi"
rm -f "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi"
rm -f "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst"

View File

@ -2,12 +2,12 @@
set -e
if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
echo "It's a PR"
export SHOULD_BUILD="yes"
export SHOULD_DEPLOY="no"
elif [[ $GITHUB_EVENT_NAME == "push" ]]; then
elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
echo "It's a Push"
export SHOULD_BUILD="yes"
@ -18,7 +18,7 @@ else
export SHOULD_DEPLOY="yes"
fi
if [[ $GITHUB_ENV ]]; then
echo "SHOULD_BUILD=$SHOULD_BUILD" >> $GITHUB_ENV
echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV
if [[ "${GITHUB_ENV}" ]]; then
echo "SHOULD_BUILD=${SHOULD_BUILD}" >> "${GITHUB_ENV}"
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
fi

View File

@ -8,12 +8,12 @@ if [[ -z "${GITHUB_TOKEN}" ]]; then
fi
REPOSITORY="${GITHUB_REPOSITORY:-"VSCodium/vscodium"}"
GITHUB_RESPONSE=$( curl -s -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/${REPOSITORY}/releases/tags/${MS_TAG})
GITHUB_RESPONSE=$( curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${REPOSITORY}/releases/tags/${MS_TAG}")
VSCODIUM_ASSETS=$( echo "${GITHUB_RESPONSE}" | jq -c '.assets | map(.name)?' )
contains() {
# add " to match the end of a string so any hashs won't be matched by mistake
echo "${VSCODIUM_ASSETS}" | grep "$1\""
echo "${VSCODIUM_ASSETS}" | grep "${1}\""
}
if [ "${VSCODIUM_ASSETS}" != "null" ]; then

View File

@ -7,14 +7,14 @@ git init -q
git remote add origin https://github.com/Microsoft/vscode.git
# figure out latest tag by calling MS update API
if [ "$INSIDER" == "1" ]; then
if [ "${INSIDER}" == "1" ]; then
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/insider/lol)
export MS_COMMIT=$(echo $UPDATE_INFO | jq -r '.version')
export MS_TAG=$(echo $UPDATE_INFO | jq -r '.name')
export MS_COMMIT=$(echo "${UPDATE_INFO}" | jq -r '.version')
export MS_TAG=$(echo "${UPDATE_INFO}" | jq -r '.name')
elif [[ -z "${MS_TAG}" ]]; then
UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/stable/lol)
export MS_COMMIT=$(echo $UPDATE_INFO | jq -r '.version')
export MS_TAG=$(echo $UPDATE_INFO | jq -r '.name')
export MS_COMMIT=$(echo "${UPDATE_INFO}" | jq -r '.version')
export MS_TAG=$(echo "${UPDATE_INFO}" | jq -r '.name')
else
reference=$( git ls-remote --tags | grep -x ".*refs\/tags\/${MS_TAG}" | head -1 )
@ -32,13 +32,13 @@ fi
echo "Got the MS tag: ${MS_TAG} version: ${MS_COMMIT}"
git fetch --depth 1 origin $MS_COMMIT
git fetch --depth 1 origin "${MS_COMMIT}"
git checkout FETCH_HEAD
cd ..
# for GH actions
if [[ $GITHUB_ENV ]]; then
echo "MS_TAG=$MS_TAG" >> $GITHUB_ENV
echo "MS_COMMIT=$MS_COMMIT" >> $GITHUB_ENV
if [[ ${GITHUB_ENV} ]]; then
echo "MS_TAG=${MS_TAG}" >> "${GITHUB_ENV}"
echo "MS_COMMIT=${MS_COMMIT}" >> "${GITHUB_ENV}"
fi

View File

@ -8,9 +8,9 @@ set -e
check_programs() {
for arg in "$@"
do
if ! command -v $arg >/dev/null 2>&1
if ! command -v "${arg}" >/dev/null 2>&1
then
echo "$arg could not be found"
echo "${arg} could not be found"
exit
fi
done
@ -22,22 +22,22 @@ SRC_PREFIX=""
VSCODE_PREFIX=""
build_darwin_types() {
for file in ${VSCODE_PREFIX}vscode/resources/darwin/*
for file in "${VSCODE_PREFIX}"vscode/resources/darwin/*
do
if [ -f "$file" ]; then
name=$(basename $file '.icns')
if [ -f "${file}" ]; then
name=$(basename "${file}" '.icns')
if [[ $name != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/darwin/$name.icns" ]; then
icns2png -x -s 512x512 $file -o .
if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/darwin/${name}.icns" ]; then
icns2png -x -s 512x512 "${file}" -o .
composite -blend 100% -geometry +323+365 icons/corner_512.png "${name}_512x512x32.png" "$name.png"
composite icons/code_darwin.png "$name.png" "$name.png"
composite -blend 100% -geometry +323+365 icons/corner_512.png "${name}_512x512x32.png" "${name}.png"
composite icons/code_darwin.png "${name}.png" "${name}.png"
convert "$name.png" -resize 256x256 "${name}_256.png"
convert "${name}.png" -resize 256x256 "${name}_256.png"
png2icns "${SRC_PREFIX}src/resources/darwin/$name.icns" "$name.png" "${name}_256.png"
png2icns "${SRC_PREFIX}src/resources/darwin/${name}.icns" "${name}.png" "${name}_256.png"
rm "${name}_512x512x32.png" "$name.png" "${name}_256.png"
rm "${name}_512x512x32.png" "${name}.png" "${name}_256.png"
fi
fi
done
@ -56,17 +56,17 @@ build_darwin_main() {
}
build_win32() {
for file in ${VSCODE_PREFIX}vscode/resources/win32/*.ico
for file in "${VSCODE_PREFIX}"vscode/resources/win32/*.ico
do
if [ -f "$file" ]; then
name=$(basename $file '.ico')
if [ -f "${file}" ]; then
name=$(basename "${file}" '.ico')
if [[ $name != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/win32/$name.ico" ]; then
icotool -x -w 256 $file
if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/win32/${name}.ico" ]; then
icotool -x -w 256 "${file}"
composite -geometry +150+185 icons/code_64.png "${name}_9_256x256x32.png" "${name}.png"
convert "${name}.png" -define icon:auto-resize=256,128,96,64,48,32,24,20,16 "${SRC_PREFIX}src/resources/win32/$name.ico"
convert "${name}.png" -define icon:auto-resize=256,128,96,64,48,32,24,20,16 "${SRC_PREFIX}src/resources/win32/${name}.ico"
rm "${name}_9_256x256x32.png" "${name}.png"
fi
@ -144,7 +144,7 @@ build_win32() {
fi
}
if [ "$0" == "$BASH_SOURCE" ];
if [ "${0}" == "${BASH_SOURCE}" ];
then
build_darwin_types
build_win32

View File

@ -5,10 +5,10 @@ set -e
npm install -g checksum
sum_file() {
if [[ -f "$1" ]]; then
echo "Calcuating checksum for $1"
checksum -a sha256 "$1" > "$1".sha256
checksum "$1" > "$1".sha1
if [[ -f "${1}" ]]; then
echo "Calcuating checksum for ${1}"
checksum -a sha256 "${1}" > "${1}".sha256
checksum "${1}" > "${1}".sha1
fi
}
@ -18,7 +18,7 @@ if [[ "${OS_NAME}" == "osx" ]]; then
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
echo "Building and moving ZIP"
cd "VSCode-darwin-${VSCODE_ARCH}"
zip -r -X -y ../artifacts/VSCodium-darwin-${VSCODE_ARCH}-${MS_TAG}.zip ./*.app
zip -r -X -y "../artifacts/VSCodium-darwin-${VSCODE_ARCH}-${MS_TAG}.zip" ./*.app
cd ..
fi
@ -32,35 +32,35 @@ if [[ "${OS_NAME}" == "osx" ]]; then
elif [[ "${OS_NAME}" == "windows" ]]; then
if [[ "${SHOULD_BUILD_ZIP}" != "no" ]]; then
echo "Moving ZIP"
mv vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip artifacts\\VSCodium-win32-${VSCODE_ARCH}-${MS_TAG}.zip
mv "vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip" "artifacts\\VSCodium-win32-${VSCODE_ARCH}-${MS_TAG}.zip"
fi
if [[ "${SHOULD_BUILD_EXE_SYS}" != "no" ]]; then
echo "Moving System EXE"
mv vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe artifacts\\VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe
mv "vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe" "artifacts\\VSCodiumSetup-${VSCODE_ARCH}-${MS_TAG}.exe"
fi
if [[ "${SHOULD_BUILD_EXE_USR}" != "no" ]]; then
echo "Moving User EXE"
mv vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe artifacts\\VSCodiumUserSetup-${VSCODE_ARCH}-${MS_TAG}.exe
mv "vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe" "artifacts\\VSCodiumUserSetup-${VSCODE_ARCH}-${MS_TAG}.exe"
fi
if [[ "${VSCODE_ARCH}" == "ia32" || "${VSCODE_ARCH}" == "x64" ]]; then
if [[ "${SHOULD_BUILD_MSI}" != "no" ]]; then
echo "Moving MSI"
mv build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi artifacts/
mv "build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-${MS_TAG}.msi" artifacts/
fi
if [[ "${SHOULD_BUILD_MSI_NOUP}" != "no" ]]; then
echo "Moving MSI with disabled updates"
mv build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi artifacts/
mv "build\\windows\\msi\\releasedir\\VSCodium-${VSCODE_ARCH}-updates-disabled-${MS_TAG}.msi" artifacts/
fi
fi
else
if [[ "${SHOULD_BUILD_TAR}" != "no" ]]; then
echo "Building and moving TAR"
cd VSCode-linux-${VSCODE_ARCH}
tar czf ../artifacts/VSCodium-linux-${VSCODE_ARCH}-${MS_TAG}.tar.gz .
cd "VSCode-linux-${VSCODE_ARCH}"
tar czf "../artifacts/VSCodium-linux-${VSCODE_ARCH}-${MS_TAG}.tar.gz" .
cd ..
fi

View File

@ -13,21 +13,21 @@ cd vscode || exit
{ set +x; } 2>/dev/null
for file in ../patches/*.patch; do
if [ -f "$file" ]; then
echo applying patch: $file;
git apply --ignore-whitespace "$file"
if [ -f "${file}" ]; then
echo applying patch: "${file}";
git apply --ignore-whitespace "${file}"
if [ $? -ne 0 ]; then
echo failed to apply patch $file 1>&2
echo failed to apply patch "${file}" 1>&2
fi
fi
done
for file in ../patches/user/*.patch; do
if [ -f "$file" ]; then
echo applying user patch: $file;
git apply --ignore-whitespace "$file"
if [ -f "${file}" ]; then
echo applying user patch: "${file}";
git apply --ignore-whitespace "${file}"
if [ $? -ne 0 ]; then
echo failed to apply patch $file 1>&2
echo failed to apply patch "${file}" 1>&2
fi
fi
done
@ -94,7 +94,7 @@ cat product.json
../undo_telemetry.sh
if [[ "$OS_NAME" == "linux" ]]; then
if [[ "${OS_NAME}" == "linux" ]]; then
# microsoft adds their apt repo to sources
# unless the app name is code-oss
# as we are renaming the application to vscodium

View File

@ -33,9 +33,9 @@ do
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
EXIT_STATUS=$?
echo "exit: $EXIT_STATUS"
echo "exit: ${EXIT_STATUS}"
if (( $EXIT_STATUS )); then
if (( "${EXIT_STATUS}" )); then
for (( i=0; i<10; i++ ))
do
github-release delete --owner "${OWNER}" --repo "${REPOSITORY}" --tag "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
@ -46,15 +46,15 @@ do
gh release upload "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"
EXIT_STATUS=$?
echo "exit: $EXIT_STATUS"
echo "exit: ${EXIT_STATUS}"
if ! (( $EXIT_STATUS )); then
if ! (( "${EXIT_STATUS}" )); then
break
fi
done
echo "exit: $EXIT_STATUS"
echo "exit: ${EXIT_STATUS}"
if (( $EXIT_STATUS )); then
if (( "${EXIT_STATUS}" )); then
echo "'${FILE}' hasn't been uploaded!"
github-release delete --owner "${OWNER}" --repo "${REPOSITORY}" --tag "${MS_TAG}" "${FILE}" "${FILE}.sha1" "${FILE}.sha256"

View File

@ -15,11 +15,11 @@ else
sudo snap install --channel stable --classic snapcraft
echo "$SNAP_STORE_LOGIN" | snapcraft login --with -
echo "${SNAP_STORE_LOGIN}" | snapcraft login --with -
echo "Architecture: ${ARCHITECTURE}"
SNAP_VERSION=$(snapcraft list-revisions codium | grep -F stable* | grep ${ARCHITECTURE} | tr -s ' ' | cut -d ' ' -f 4)
SNAP_VERSION=$(snapcraft list-revisions codium | grep -F stable* | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)
echo "Snap version: ${SNAP_VERSION}"
wget --quiet https://api.github.com/repos/VSCodium/vscodium/releases -O gh_latest.json
@ -38,6 +38,6 @@ else
fi
fi
if [[ $GITHUB_ENV ]]; then
echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV
if [[ "${GITHUB_ENV}" ]]; then
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> "${GITHUB_ENV}"
fi

View File

@ -1,17 +1,17 @@
# mobile.events.data.microsoft.com
# vortex.data.microsoft.com
TELEMETRY_URLS="[^/]+\.data\.microsoft\.com"
REPLACEMENT="s/$TELEMETRY_URLS/0\.0\.0\.0/g"
REPLACEMENT="s/${TELEMETRY_URLS}/0\.0\.0\.0/g"
#include common functions
. ../utils.sh
if [[ "$OS_NAME" == "osx" ]]; then
if [[ "${OS_NAME}" == "osx" ]]; then
if is_gnu_sed; then
grep -rl --exclude-dir=.git -E $TELEMETRY_URLS . | xargs sed -i -E $REPLACEMENT
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
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
grep -rl --exclude-dir=.git -E "${TELEMETRY_URLS}" . | xargs sed -i -E "${REPLACEMENT}"
fi

View File

@ -9,41 +9,41 @@ TELEMETRY_CONFIGURATION=" TelemetryConfiguration.ON"
. ../utils.sh
update_setting () {
local FILENAME="$2"
local FILENAME="${2}"
# check that the file exists
if [ ! -f $FILENAME ]; then
if [ ! -f "${FILENAME}" ]; then
echo "File to update setting in does not exist ${FILENAME}"
return
fi
# go through lines of file, looking for block that contains setting
local SETTING="$1"
local SETTING="${1}"
local LINE_NUM=0
while read -r line; do
local LINE_NUM=$(( $LINE_NUM + 1 ))
if [[ $line == *"$SETTING"* ]]; then
if [[ "${line}" == *"${SETTING}"* ]]; then
local IN_SETTING=1
fi
if [[ ($line == *"$DEFAULT_TRUE"* || $line == *"$DEFAULT_ON"*) && "$IN_SETTING" == "1" ]]; then
if [[ ("${line}" == *"${DEFAULT_TRUE}"* || "${line}" == *"${DEFAULT_ON}"*) && "${IN_SETTING}" == "1" ]]; then
local FOUND=1
break
fi
done < $FILENAME
done < "${FILENAME}"
if [[ "$FOUND" != "1" ]]; then
echo "$DEFAULT_TRUE not found for setting $SETTING in file $FILENAME"
if [[ "${FOUND}" != "1" ]]; then
echo "${DEFAULT_TRUE} not found for setting ${SETTING} in file ${FILENAME}"
return
fi
# construct line-aware replacement string
if [[ $line == *"$DEFAULT_TRUE"* ]]; then
if [[ "${line}" == *"${DEFAULT_TRUE}"* ]]; then
local DEFAULT_TRUE_TO_FALSE="${LINE_NUM}s/${DEFAULT_TRUE}/${DEFAULT_FALSE}/"
else
local DEFAULT_TRUE_TO_FALSE="${LINE_NUM}s/${DEFAULT_ON}/${DEFAULT_OFF}/"
fi
replace "$DEFAULT_TRUE_TO_FALSE" $FILENAME
replace "${DEFAULT_TRUE_TO_FALSE}" "${FILENAME}"
}
update_setting "$TELEMETRY_CRASH_REPORTER" src/vs/workbench/electron-sandbox/desktop.contribution.ts
update_setting "$TELEMETRY_CONFIGURATION" src/vs/platform/telemetry/common/telemetryService.ts
update_setting "${TELEMETRY_CRASH_REPORTER}" src/vs/workbench/electron-sandbox/desktop.contribution.ts
update_setting "${TELEMETRY_CONFIGURATION}" src/vs/platform/telemetry/common/telemetryService.ts

View File

@ -7,10 +7,10 @@ is_gnu_sed () {
}
replace () {
echo $1
echo "${1}"
if is_gnu_sed; then
sed -i -E "$1" $2
sed -i -E "${1}" "${2}"
else
sed -i '' -E "$1" $2
sed -i '' -E "${1}" "${2}"
fi
}