Date: Tuesday, March 14, 2023 @ 21:25:31 Author: mtorromeo Revision: 1420495
upgpkg: code 1.76.1-2: Changed bin script to understand electron flags in combination with ELECTRON_RUN_AS_NODE (Fixes FS#75667) Modified: code/trunk/PKGBUILD code/trunk/code.sh ----------+ PKGBUILD | 6 +++--- code.sh | 24 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2023-03-14 21:25:04 UTC (rev 1420494) +++ PKGBUILD 2023-03-14 21:25:31 UTC (rev 1420495) @@ -14,7 +14,7 @@ # Important: Remember to check https://github.com/microsoft/vscode/blob/master/.yarnrc (choose correct tag) for target electron version _electron=electron19 pkgver=1.76.1 -pkgrel=1 +pkgrel=2 arch=('x86_64') url='https://github.com/microsoft/vscode' license=('MIT') @@ -30,7 +30,7 @@ 'product_json.diff') sha512sums=('SKIP' '6e8ee1df4dd982434a8295ca99e786a536457c86c34212546e548b115081798c5492a79f99cd5a3f1fa30fb71d29983aaabc2c79f4895d4a709d8354e9e2eade' - '88b0e491b18bb10b1293217c92b984d863a711a5d743c3e929e889e1a927e62e639811b2feaa8dec4f5eac49610c6e5ce75f874d526fc7059134ee612c7991e1' + 'f949779dde4e3fe72f8a62db20edffc3e093c7209981e089f91e7d369274639a66b8cbf95cbdea4f3ea36e219d91e0abadb30f9c8e19e37d6077f9545e55a9a0' 'b1aa0d7c5b3e3e8ba1172822d75ea38e90efc431b270e0b4ca9e45bf9c0be0f60922c8618969ef071b5b6dbd9ac9f030294f1bf49bcc28c187b46d113dca63a7') # Even though we don't officially support other archs, let's @@ -56,7 +56,7 @@ cd $pkgname # Change electron binary name to the target electron - sed -i "s|exec electron |exec $_electron |" ../code.sh + sed -i "s|name=electron |name=$_electron |" ../code.sh sed -i "s|#!/usr/bin/electron|#!/usr/bin/$_electron|" ../code.js # This patch no longer contains proprietary modifications. Modified: code.sh =================================================================== --- code.sh 2023-03-14 21:25:04 UTC (rev 1420494) +++ code.sh 2023-03-14 21:25:31 UTC (rev 1420495) @@ -2,10 +2,25 @@ set -euo pipefail -name=code +flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/code-flags.conf" + +declare -a codeflags + +if [[ -f "${flags_file}" ]]; then + mapfile -t < "${flags_file}" +fi + +for line in "${MAPFILE[@]}"; do + if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then + codeflags+=("${line}") + fi +done + +# don't edit the electron binary name here! simply change the variable in the PKGBUILD and we will sed it into the correct one :) +name=electron flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf" -declare -a flags +declare -a electronflags if [[ -f "${flags_file}" ]]; then mapfile -t < "${flags_file}" @@ -13,9 +28,8 @@ for line in "${MAPFILE[@]}"; do if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then - flags+=("${line}") + electronflags+=("${line}") fi done -# don't edit the electron binary name here! simply change the variable in the PKGBUILD and we will sed it into the correct one :) -exec electron /usr/lib/code/out/cli.js /usr/lib/code/code.js "${flags[@]}" "$@" +ELECTRON_RUN_AS_NODE=1 exec /usr/lib/${name}/electron /usr/lib/code/out/cli.js /usr/lib/code/code.js "${electronflags[@]}" "${codeflags[@]}" "$@"
