Skip to content

Commit fc9dcad

Browse files
authored
fix: skip server requirements check based on file presence (microsoft#203729)
1 parent a9ba067 commit fc9dcad

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

cli/src/util/prereqs.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ lazy_static! {
2525
}
2626

2727
const NIXOS_TEST_PATH: &str = "/etc/NIXOS";
28+
const SKIP_REQ_FILE: &str = "/tmp/vscode-skip-server-requirements-check";
2829

2930
pub struct PreReqChecker {}
3031

@@ -52,13 +53,20 @@ impl PreReqChecker {
5253

5354
#[cfg(target_os = "linux")]
5455
pub async fn verify(&self) -> Result<Platform, CodeError> {
55-
let (is_nixos, gnu_a, gnu_b, or_musl) = tokio::join!(
56+
let (is_nixos, skip_glibc_checks, or_musl) = tokio::join!(
5657
check_is_nixos(),
57-
check_glibc_version(),
58-
check_glibcxx_version(),
58+
check_skip_req_file(),
5959
check_musl_interpreter()
6060
);
6161

62+
let (gnu_a, gnu_b) = if !skip_glibc_checks {
63+
tokio::join!(check_glibc_version(), check_glibcxx_version())
64+
} else {
65+
println!("!!! WARNING: Skipping server pre-requisite check !!!");
66+
println!("!!! Server stability is not guaranteed. Proceed at your own risk. !!!");
67+
(Ok(()), Ok(()))
68+
};
69+
6270
if (gnu_a.is_ok() && gnu_b.is_ok()) || is_nixos {
6371
return Ok(if cfg!(target_arch = "x86_64") {
6472
Platform::LinuxX64
@@ -157,6 +165,15 @@ async fn check_is_nixos() -> bool {
157165
fs::metadata(NIXOS_TEST_PATH).await.is_ok()
158166
}
159167

168+
/// Do not remove this check.
169+
/// Provides a way to skip the server glibc requirements check from
170+
/// outside the install flow. A system process can create this
171+
/// file before the server is downloaded and installed.
172+
#[allow(dead_code)]
173+
async fn check_skip_req_file() -> bool {
174+
fs::metadata(SKIP_REQ_FILE).await.is_ok()
175+
}
176+
160177
#[allow(dead_code)]
161178
async fn check_glibcxx_version() -> Result<(), String> {
162179
let mut libstdc_path: Option<String> = None;

resources/server/bin/code-server-linux.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,19 @@ esac
99

1010
ROOT="$(dirname "$(dirname "$(readlink -f "$0")")")"
1111

12+
# Do not remove this check.
13+
# Provides a way to skip the server requirements check from
14+
# outside the install flow. A system process can create this
15+
# file before the server is downloaded and installed.
16+
skip_check=0
17+
if [ -f "/tmp/vscode-skip-server-requirements-check" ]; then
18+
echo "!!! WARNING: Skipping server pre-requisite check !!!"
19+
echo "!!! Server stability is not guaranteed. Proceed at your own risk. !!!"
20+
skip_check=1
21+
fi
22+
1223
# Check platform requirements
13-
if [ "$(echo "$@" | grep -c -- "--skip-requirements-check")" -eq 0 ]; then
24+
if [ "$(echo "$@" | grep -c -- "--skip-requirements-check")" -eq 0 ] && [ $skip_check -eq 0 ]; then
1425
$ROOT/bin/helpers/check-requirements.sh
1526
exit_code=$?
1627
if [ $exit_code -ne 0 ]; then

0 commit comments

Comments
 (0)