Skip to content

Commit e3d3a6b

Browse files
authored
Update vscodium-patch.sh
1 parent 277a8fe commit e3d3a6b

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

Cachyos/Scripts/shell-tools/vscodium-patch.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ xdg_patch(){
2424
grep -q "text/plain" "$f" || sed -i -E 's#^(MimeType=.*);$#\1;text/plain;#' "$f"
2525
grep -q "inode/directory" "$f" || sed -i -E 's#^(MimeType=.*);$#\1;inode/directory;#' "$f" ;;
2626
*/package.json) sed -i -E 's/"desktopName":[[:space:]]*"(.+)-url-handler\.desktop"/"desktopName": "\1.desktop"/' "$f" ;;
27+
*) echo "none found" ;;
2728
esac; printf '%b\n' "${G}${D} $f"
2829
done
2930
}
@@ -32,7 +33,6 @@ find_files(){
3233
/opt/vscodium*/resources/app/package.json /usr/share/applications/{code,vscode,vscodium}*.desktop \
3334
| grep -vE '\-url-handler.desktop$'
3435
}
35-
3636
# ─── JSON Logic ───
3737
# $1=prod $2=patch $3=cache
3838
apply_json(){
@@ -54,7 +54,7 @@ restore_json(){
5454
update_json(){
5555
local v="$1" out="$2" work="/tmp/code-up.$$" u="https://update.code.visualstudio.com/${1}/linux-x64/stable"
5656
[[ -z $v ]] && die "Version required"
57-
local -n kref=$3; echo "⬇ VSCode $v..."
57+
local -n kref="$3"; echo "⬇ VSCode $v..."
5858
dl "$u" "$work/c.tgz" || { rm -rf "$work"; return 1; }
5959
tar xf "$work/c.tgz" -C "$work" --strip-components=3 VSCode-linux-x64/resources/app/product.json
6060
"$JQ" -r --argjson k "$(printf '%s\n' "${kref[@]}" | "$JQ" -R . | "$JQ" -s .)" \
@@ -85,14 +85,13 @@ repo_swap(){
8585
printf '%b\n' "${G}Repo: MS Marketplace${D}"
8686
fi
8787
}
88-
8988
vscodium_prod_full(){
9089
local dst="${1:-/usr/share/vscodium/resources/app/product.json}"
91-
local work="/tmp/vp.$$" v src="$work/product.json"
90+
local work="/tmp/vp.$$" v; local src="${work}/product.json"
9291
[[ ! -f $dst ]] && die "Missing $dst"
9392
v=$("$JQ" -r '.version//empty' "$dst") || die "No version"
94-
cp "$dst" "${dst}.backup.$$(date +%s)"; dl "https://update.code.visualstudio.com/$v/linux-x64/stable" "$work/c.tgz"
95-
tar xf "$work/c.tgz" -C "$work" --strip-components=3 VSCode-linux-x64/resources/app/product.json
93+
cp "$dst" "${dst}.backup.$$(date +%s)"; dl "https://update.code.visualstudio.com/$v/linux-x64/stable" "${work}/c.tgz"
94+
tar xf "${work}/c.tgz" -C "$work" --strip-components=3 VSCode-linux-x64/resources/app/product.json
9695
"$JQ" -s --argjson k "$(printf '%s\n' "${KEYS_PROD[@]}" | "$JQ" -R . | "$JQ" -s .)" \
9796
'.[0] as $d | .[1] as $s | $d + ($s | with_entries(select(.key as $x | $k | index($x)))) | . + {enableTelemetry:false}' \
9897
"$dst" "$src" > "${dst}.tmp" && mv "${dst}.tmp" "$dst"

0 commit comments

Comments
 (0)