fix: skip server requirements check based on file presence (#203729)
parent
a9ba0672ae
commit
fc9dcad098
|
@ -25,6 +25,7 @@ lazy_static! {
|
|||
}
|
||||
|
||||
const NIXOS_TEST_PATH: &str = "/etc/NIXOS";
|
||||
const SKIP_REQ_FILE: &str = "/tmp/vscode-skip-server-requirements-check";
|
||||
|
||||
pub struct PreReqChecker {}
|
||||
|
||||
|
@ -52,13 +53,20 @@ impl PreReqChecker {
|
|||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub async fn verify(&self) -> Result<Platform, CodeError> {
|
||||
let (is_nixos, gnu_a, gnu_b, or_musl) = tokio::join!(
|
||||
let (is_nixos, skip_glibc_checks, or_musl) = tokio::join!(
|
||||
check_is_nixos(),
|
||||
check_glibc_version(),
|
||||
check_glibcxx_version(),
|
||||
check_skip_req_file(),
|
||||
check_musl_interpreter()
|
||||
);
|
||||
|
||||
let (gnu_a, gnu_b) = if !skip_glibc_checks {
|
||||
tokio::join!(check_glibc_version(), check_glibcxx_version())
|
||||
} else {
|
||||
println!("!!! WARNING: Skipping server pre-requisite check !!!");
|
||||
println!("!!! Server stability is not guaranteed. Proceed at your own risk. !!!");
|
||||
(Ok(()), Ok(()))
|
||||
};
|
||||
|
||||
if (gnu_a.is_ok() && gnu_b.is_ok()) || is_nixos {
|
||||
return Ok(if cfg!(target_arch = "x86_64") {
|
||||
Platform::LinuxX64
|
||||
|
@ -157,6 +165,15 @@ async fn check_is_nixos() -> bool {
|
|||
fs::metadata(NIXOS_TEST_PATH).await.is_ok()
|
||||
}
|
||||
|
||||
/// Do not remove this check.
|
||||
/// Provides a way to skip the server glibc requirements check from
|
||||
/// outside the install flow. A system process can create this
|
||||
/// file before the server is downloaded and installed.
|
||||
#[allow(dead_code)]
|
||||
async fn check_skip_req_file() -> bool {
|
||||
fs::metadata(SKIP_REQ_FILE).await.is_ok()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
async fn check_glibcxx_version() -> Result<(), String> {
|
||||
let mut libstdc_path: Option<String> = None;
|
||||
|
|
|
@ -9,8 +9,19 @@ esac
|
|||
|
||||
ROOT="$(dirname "$(dirname "$(readlink -f "$0")")")"
|
||||
|
||||
# Do not remove this check.
|
||||
# Provides a way to skip the server requirements check from
|
||||
# outside the install flow. A system process can create this
|
||||
# file before the server is downloaded and installed.
|
||||
skip_check=0
|
||||
if [ -f "/tmp/vscode-skip-server-requirements-check" ]; then
|
||||
echo "!!! WARNING: Skipping server pre-requisite check !!!"
|
||||
echo "!!! Server stability is not guaranteed. Proceed at your own risk. !!!"
|
||||
skip_check=1
|
||||
fi
|
||||
|
||||
# Check platform requirements
|
||||
if [ "$(echo "$@" | grep -c -- "--skip-requirements-check")" -eq 0 ]; then
|
||||
if [ "$(echo "$@" | grep -c -- "--skip-requirements-check")" -eq 0 ] && [ $skip_check -eq 0 ]; then
|
||||
$ROOT/bin/helpers/check-requirements.sh
|
||||
exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
|
|
Loading…
Reference in New Issue