vscode-patch/patch-code.sh
Steven Hobs 9a0c7e2196 init
2025-06-26 08:45:29 +08:00

24 lines
797 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
VSCODE_PATCH_DIR="$HOME/.vscode-patch"
if [ ! -d "$VSCODE_PATCH_DIR/lib" ]; then
echo "错误:补丁文件夹应放在这儿:$HOME/.vscode-patch/"
exit 1
fi
echo "[VSCode应用-补丁]"
read -p "指定VSCode路径: " VSCODE_APP_PATH
if [ ! -f "$VSCODE_APP_PATH/code" ]; then
echo "错误指定路径下不存在VSCode可执行文件"
exit 1
fi
echo "-- 找到code程序即将补丁code程序..."
echo "-- 备份原始code程序..."
if [ ! -f "$VSCODE_APP_PATH/code.bak" ]; then
cp "$VSCODE_APP_PATH/code" "$VSCODE_APP_PATH/code.bak"
fi
echo "-- 开始打补丁..."
$VSCODE_PATCH_DIR/tools/patchelf \
--set-interpreter "$VSCODE_PATCH_DIR/lib/ld-linux-x86-64.so.2" \
--set-rpath '$ORIGIN:~/.vscode-patch/lib' \
"$VSCODE_APP_PATH/code"
echo "-- 补丁完成!"