diff --git a/build/build.sh b/build/build.sh index 04a58a3..a89d2c3 100755 --- a/build/build.sh +++ b/build/build.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash +# shellcheck disable=SC1091,SC2129 ### Windows # to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build.sh @@ -13,7 +14,7 @@ export SKIP_SOURCE="no" export VSCODE_LATEST="no" export VSCODE_QUALITY="stable" -while getopts ":ilop" opt; do +while getopts ":ilops" opt; do case "$opt" in i) export VSCODE_QUALITY="insider" @@ -30,6 +31,8 @@ while getopts ":ilop" opt; do s) export SKIP_SOURCE="yes" ;; + *) + ;; esac done @@ -100,7 +103,8 @@ if [[ "${SKIP_BUILD}" == "no" ]]; then . build.sh if [[ "${VSCODE_QUALITY}" == "insider" && "${VSCODE_LATEST}" == "yes" ]]; then - echo "$( cat "insider.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )" > "insider.json" + jsonTmp=$( jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. "insider.json" | .tag=$tag | .commit=$commit' ) + echo "${jsonTmp}" > "insider.json" && unset jsonTmp fi fi diff --git a/build/build_docker.sh b/build/build_docker.sh index 9ad3755..81aeba4 100755 --- a/build/build_docker.sh +++ b/build/build_docker.sh @@ -1,6 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash +# shellcheck disable=SC1091 -exists() { type -t "$1" > /dev/null 2>&1; } +exists() { type -t "$1" &> /dev/null; } export APP_NAME="VSCodium" export CI_BUILD="no" @@ -19,7 +20,9 @@ while getopts ":ilp" opt; do export VSCODE_LATEST="yes" ;; p) - export SKIP_ASSETS="no" + export SKIP_ASSETS="no" + ;; + *) ;; esac done diff --git a/build/linux/appimage/build.sh b/build/linux/appimage/build.sh index fae196a..4864fe4 100755 --- a/build/linux/appimage/build.sh +++ b/build/linux/appimage/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex @@ -15,11 +15,11 @@ if [[ "${VSCODE_ARCH}" == "x64" ]]; then exit 1 fi - wget -c "${APPIMAGE_URL}" +wget -c "${APPIMAGE_URL}" -o pkg2appimage.AppImage - chmod +x ./pkg2appimage-*.AppImage +chmod +x ./pkg2appimage.AppImage - ./pkg2appimage-*.AppImage --appimage-extract && mv ./squashfs-root ./pkg2appimage.AppDir +./pkg2appimage.AppImage --appimage-extract && mv ./squashfs-root ./pkg2appimage.AppDir # add update's url sed -i 's/generate_type2_appimage/generate_type2_appimage -u "gh-releases-zsync|VSCodium|vscodium|latest|*.AppImage.zsync"/' pkg2appimage.AppDir/AppRun diff --git a/build/update_api.sh b/build/update_api.sh index 83c0934..b6310f7 100755 --- a/build/update_api.sh +++ b/build/update_api.sh @@ -1,23 +1,25 @@ -#!/bin/bash +#!/usr/bin/env bash set -e export VSCODE_QUALITY="stable" -while getopts ":ilp" opt; do +while getopts ":i" opt; do case "$opt" in i) export VSCODE_QUALITY="insider" ;; + *) + ;; esac done -URL=`curl -s "https://update.code.visualstudio.com/api/update/win32-x64-archive/${VSCODE_QUALITY}/VERSION" | jq -c '.url' | sed -E 's/.*"([^"]+)".*/\1/'` +URL=$( curl -s "https://update.code.visualstudio.com/api/update/win32-x64-archive/${VSCODE_QUALITY}/0000000000000000000000000000000000000000" | jq -c '.url' | sed -E 's/.*"([^"]+)".*/\1/' ) # echo "url: ${URL}" -FILE=`echo "${URL}" | sed -E 's|.*/([^/]+\.zip)$|\1|'` +FILE="${URL##*/}" # echo "file: ${FILE}" -DIRECTORY=`echo "${URL}" | sed -E 's|.*/([^/]+)\.zip$|\1|'` +DIRECTORY="${FILE%.zip}" # echo "directory: ${DIRECTORY}" if [[ ! -f "${FILE}" ]]; then @@ -28,8 +30,9 @@ if [[ ! -d "${DIRECTORY}" ]]; then unzip "${FILE}" -d "${DIRECTORY}" fi -APIS=`cat ${DIRECTORY}/resources/app/product.json | jq -r '.extensionEnabledApiProposals'` +APIS=$( jq -r '.extensionEnabledApiProposals' "${DIRECTORY}/resources/app/product.json" ) -APIS=`echo "${APIS}" | jq '. += {"jeanp413.open-remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribRemoteHelp", "contribViewsRemote"]}'` +APIS=$( echo "${APIS}" | jq '. += {"jeanp413.open-remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribRemoteHelp", "contribViewsRemote"]}' ) -cat <<< $(jq --argjson v "${APIS}" 'setpath(["extensionEnabledApiProposals"]; $v)' product.json) > product.json +jsonTmp=$( jq --argjson v "${APIS}" 'setpath(["extensionEnabledApiProposals"]; $v)' product.json ) +echo "${jsonTmp}" > product.json && unset jsonTmp \ No newline at end of file diff --git a/build/update_patches.sh b/build/update_patches.sh index a39eccc..2e74123 100755 --- a/build/update_patches.sh +++ b/build/update_patches.sh @@ -1,12 +1,14 @@ -#!/bin/bash +#!/usr/bin/env bash export VSCODE_QUALITY="stable" -while getopts ":ilp" opt; do +while getopts ":i" opt; do case "$opt" in i) export VSCODE_QUALITY="insider" ;; + *) + ;; esac done @@ -16,16 +18,15 @@ git add . git reset -q --hard HEAD for FILE in ../patches/*.patch; do - if [ -f "${FILE}" ]; then + if [[ -f "${FILE}" ]]; then echo applying patch: "${FILE}" - git apply --ignore-whitespace "${FILE}" - if [ $? -ne 0 ]; then + if ! git apply --ignore-whitespace "${FILE}"; then echo failed to apply patch "${FILE}" git apply --reject "${FILE}" git apply --reject "../patches/helper/settings.patch" - read -p "Press any key when the conflict have been resolved..." -n1 -s + read -rp "Press any key when the conflict have been resolved..." -n1 -s git restore .vscode/settings.json git add . @@ -38,16 +39,15 @@ done if [[ "${VSCODE_QUALITY}" == "insider" ]]; then for FILE in ../patches/insider/*.patch; do - if [ -f "${FILE}" ]; then + if [[ -f "${FILE}" ]]; then echo applying patch: "${FILE}" - git apply --ignore-whitespace "${FILE}" - if [ $? -ne 0 ]; then + if ! git apply --ignore-whitespace "${FILE}"; then echo failed to apply patch "${FILE}" git apply --reject "${FILE}" git apply --reject "../patches/helper/settings.patch" - read -p "Press any key when the conflict have been resolved..." -n1 -s + read -rp "Press any key when the conflict have been resolved..." -n1 -s git restore .vscode/settings.json git add . diff --git a/build/windows/msi/build-updates-disabled.sh b/build/windows/msi/build-updates-disabled.sh index 0d1a50c..466d5f2 100644 --- a/build/windows/msi/build-updates-disabled.sh +++ b/build/windows/msi/build-updates-disabled.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex @@ -10,9 +10,8 @@ SCRIPT_DIR=$( pwd ) cd "../../../VSCode-win32-${VSCODE_ARCH}/resources/app" -cp product.json product.json.bak -cat product.json.bak | jq "del(.updateUrl)" > product.json -rm -f product.json.bak +jsonTmp=$( jq "del(.updateUrl)" product.json ) +echo "${jsonTmp}" > product.json && unset jsonTmp cd "${SCRIPT_DIR}" diff --git a/build/windows/msi/build.sh b/build/windows/msi/build.sh index f5ef5cc..8251502 100644 --- a/build/windows/msi/build.sh +++ b/build/windows/msi/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex @@ -11,14 +11,12 @@ WIN_SDK_FULL_VERSION="10.0.17763.0" if [[ "${VSCODE_QUALITY}" == "insider" ]]; then PRODUCT_NAME="VSCodium - Insiders" - PRODUCT_SKU="vscodium-insiders" PRODUCT_CODE="VSCodiumInsiders" PRODUCT_UPGRADE_CODE="1C9B7195-5A9A-43B3-B4BD-583E20498467" ICON_DIR="..\\..\\..\\src\\insider\\resources\\win32" SETUP_RESOURCES_DIR=".\\resources\\insider" else PRODUCT_NAME="VSCodium" - PRODUCT_SKU="vscodium" PRODUCT_CODE="VSCodium" PRODUCT_UPGRADE_CODE="965370CD-253C-4720-82FC-2E6B02A53808" ICON_DIR="..\\..\\..\\src\\stable\\resources\\win32" diff --git a/build/windows/rtf/make.sh b/build/windows/rtf/make.sh index 2fdc2aa..5fb473b 100644 --- a/build/windows/rtf/make.sh +++ b/build/windows/rtf/make.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cd "$( dirname "${BASH_SOURCE[0]}" )"/../../../vscode || { echo "'vscode' dir not found"; exit 1; } diff --git a/icons/build_icons.sh b/icons/build_icons.sh index 254a5ad..e0e9628 100755 --- a/icons/build_icons.sh +++ b/icons/build_icons.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=SC1091 set -e @@ -14,14 +15,14 @@ while getopts ":i" opt; do export QUALITY="insider" export COLOR="orange1" ;; + *) + ;; esac done check_programs() { # {{{ - for arg in "$@" - do - if ! command -v "${arg}" >/dev/null 2>&1 - then + for arg in "$@"; do + if ! command -v "${arg}" &> /dev/null; then echo "${arg} could not be found" exit fi @@ -52,9 +53,8 @@ build_darwin_main() { # {{{ build_darwin_types() { # {{{ rsvg-convert -w 128 -h 128 "icons/${QUALITY}/codium_cnl_w80_b8.svg" -o "code_logo.png" - for file in "${VSCODE_PREFIX}"vscode/resources/darwin/* - do - if [ -f "${file}" ]; then + for file in "${VSCODE_PREFIX}"vscode/resources/darwin/*; do + if [[ -f "${file}" ]]; then name=$(basename "${file}" '.icns') if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/darwin/${name}.icns" ]; then @@ -76,26 +76,26 @@ build_darwin_types() { # {{{ } # }}} build_linux_main() { # {{{ - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" ]]; then wget "https://raw.githubusercontent.com/VSCodium/icons/main/icons/linux/circle1/${COLOR}/paulo22s.png" -O "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" fi mkdir -p "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm" - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm/code.xpm" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm/code.xpm" ]]; then convert "${SRC_PREFIX}src/${QUALITY}/resources/linux/code.png" "${SRC_PREFIX}src/${QUALITY}/resources/linux/rpm/code.xpm" fi } # }}} build_media() { # {{{ - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media/code-icon.svg" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media/code-icon.svg" ]]; then cp "icons/${QUALITY}/codium_clt.svg" "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media/code-icon.svg" gsed -i 's|width="100" height="100"|width="1024" height="1024"|' "${SRC_PREFIX}src/${QUALITY}/src/vs/workbench/browser/media/code-icon.svg" fi } # }}} build_windows_main() { # {{{ - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico" ]]; then wget "https://raw.githubusercontent.com/VSCodium/icons/main/icons/win32/nobg/${COLOR}/paulo22s.ico" -O "${SRC_PREFIX}src/${QUALITY}/resources/win32/code.ico" fi } # }}} @@ -105,9 +105,8 @@ build_windows_types() { # {{{ rsvg-convert -b "#F5F6F7" -w 64 -h 64 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" - for file in "${VSCODE_PREFIX}"vscode/resources/win32/*.ico - do - if [ -f "${file}" ]; then + for file in "${VSCODE_PREFIX}"vscode/resources/win32/*.ico; do + if [[ -f "${file}" ]]; then name=$(basename "${file}" '.ico') if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/${name}.ico" ]; then @@ -122,95 +121,95 @@ build_windows_types() { # {{{ fi done - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_70x70.png" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_70x70.png" ]]; then convert -size 70x70 canvas:transparent PNG32:"${SRC_PREFIX}src/${QUALITY}/resources/win32/code_70x70.png" rsvg-convert -w 45 -h 45 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_70x70.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_70x70.png" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_150x150.png" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_150x150.png" ]]; then convert -size 150x150 canvas:transparent PNG32:"${SRC_PREFIX}src/${QUALITY}/resources/win32/code_150x150.png" rsvg-convert -w 64 -h 64 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -geometry +44+25 "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_150x150.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/code_150x150.png" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp" ]]; then convert -size 164x314 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp" rsvg-convert -w 126 -h 126 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-100.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp" ]]; then convert -size 192x386 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp" rsvg-convert -w 147 -h 147 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-125.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp" ]]; then convert -size 246x459 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp" rsvg-convert -w 190 -h 190 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-150.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp" ]]; then convert -size 273x556 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp" rsvg-convert -w 211 -h 211 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-175.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp" ]]; then convert -size 328x604 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp" rsvg-convert -w 255 -h 255 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-200.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp" ]]; then convert -size 355x700 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp" rsvg-convert -w 273 -h 273 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-225.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp" ]]; then convert -size 410x797 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp" rsvg-convert -w 317 -h 317 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-big-250.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp" ]]; then convert -size 55x55 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp" rsvg-convert -w 44 -h 44 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-100.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp" ]]; then convert -size 64x68 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp" rsvg-convert -w 52 -h 52 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-125.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp" ]]; then convert -size 83x80 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp" rsvg-convert -w 63 -h 63 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-150.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp" ]]; then convert -size 92x97 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp" rsvg-convert -w 76 -h 76 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-175.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp" ]]; then convert -size 110x106 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp" rsvg-convert -w 86 -h 86 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-200.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp" ]]; then convert -size 119x123 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp" rsvg-convert -w 103 -h 103 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-225.bmp" fi - if [ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp" ]]; then convert -size 138x140 xc:white "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp" rsvg-convert -w 116 -h 116 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -gravity center "code_logo.png" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp" "${SRC_PREFIX}src/${QUALITY}/resources/win32/inno-small-250.bmp" fi - if [ ! -f "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-banner.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-banner.bmp" ]]; then convert -size 493x58 xc:white "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-banner.bmp" rsvg-convert -w 50 -h 50 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -geometry +438+6 "code_logo.png" "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-banner.bmp" "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-banner.bmp" fi - if [ ! -f "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-dialog.bmp" ]; then + if [[ ! -f "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-dialog.bmp" ]]; then convert -size 493x312 xc:white "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-dialog.bmp" rsvg-convert -w 120 -h 120 "icons/${QUALITY}/codium_cnl.svg" -o "code_logo.png" composite -geometry +22+152 "code_logo.png" "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-dialog.bmp" "${SRC_PREFIX}build/windows/msi/resources/${QUALITY}/wix-dialog.bmp" @@ -219,8 +218,7 @@ build_windows_types() { # {{{ rm code_logo.png } # }}} -if [ "${0}" == "${BASH_SOURCE}" ]; -then +if [[ "${0}" == "${BASH_SOURCE[0]}" ]]; then build_darwin_main build_linux_main build_windows_main diff --git a/stores/snapcraft/check_version.sh b/stores/snapcraft/check_version.sh index f490c82..b824bc4 100755 --- a/stores/snapcraft/check_version.sh +++ b/stores/snapcraft/check_version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e @@ -12,11 +12,11 @@ sudo snap install --channel stable --classic snapcraft echo "Architecture: ${ARCHITECTURE}" -SNAP_VERSION=$(snapcraft list-revisions ${SNAP_NAME} | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4) +SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 ) echo "Snap version: ${SNAP_VERSION}" wget --quiet "https://api.github.com/repos/${ASSETS_REPOSITORY}/releases" -O gh_latest.json -GH_VERSION=$(jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json) +GH_VERSION=$( jq -r 'sort_by(.tag_name)|last.tag_name' gh_latest.json ) echo "GH version: ${GH_VERSION}" rm -f gh_latest.json @@ -27,7 +27,7 @@ else export SHOULD_DEPLOY="yes" snap version - snap info "${SNAP_NAME}" | true + snap info "${SNAP_NAME}" || true fi if [[ "${GITHUB_ENV}" ]]; then diff --git a/stores/winget/check_version.sh b/stores/winget/check_version.sh index c878fdd..86f50ec 100755 --- a/stores/winget/check_version.sh +++ b/stores/winget/check_version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/update_version.sh b/update_version.sh index d5cd242..ee0092c 100755 --- a/update_version.sh +++ b/update_version.sh @@ -120,7 +120,7 @@ cd "${REPOSITORY_NAME}" || { echo "'${REPOSITORY_NAME}' dir not found"; exit 1; git config user.email "$( echo "${GITHUB_USERNAME}" | awk '{print tolower($0)}' )-ci@not-real.com" git config user.name "${GITHUB_USERNAME} CI" git remote rm origin -git remote add origin "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${VERSIONS_REPOSITORY}.git" > /dev/null 2>&1 +git remote add origin "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${VERSIONS_REPOSITORY}.git" &> /dev/null cd .. if [[ "${OS_NAME}" == "osx" ]]; then diff --git a/utils.sh b/utils.sh index e81c9fa..80ac165 100755 --- a/utils.sh +++ b/utils.sh @@ -2,10 +2,10 @@ # All common functions can be added to this file -exists() { type -t "$1" > /dev/null 2>&1; } +exists() { type -t "$1" &> /dev/null; } is_gnu_sed () { - sed --version >/dev/null 2>&1 + sed --version &> /dev/null } replace () { diff --git a/version.sh b/version.sh index 2e79692..aa4c9a8 100755 --- a/version.sh +++ b/version.sh @@ -2,7 +2,7 @@ if [[ -z "${BUILD_SOURCEVERSION}" ]]; then - if type -t "sha1sum" > /dev/null 2>&1; then + if type -t "sha1sum" &> /dev/null; then BUILD_SOURCEVERSION=$( echo "${RELEASE_VERSION/-*/}" | sha1sum | cut -d' ' -f1 ) else npm install -g checksum