]> git.lizzy.rs Git - rust.git/commitdiff
bootstrap: use bash on illumos to run install scripts
authorJoshua M. Clulow <jmc@oxide.computer>
Fri, 16 Apr 2021 03:52:30 +0000 (20:52 -0700)
committerJoshua M. Clulow <jmc@oxide.computer>
Fri, 16 Apr 2021 18:28:41 +0000 (11:28 -0700)
The default illumos shell ("sh" in the default PATH) is ksh93, rather
than bash, and does not support constructs like "local" that came from
bash.  The bootstrap function for invoking "install.sh" scripts should
use "bash" explicitly there to avoid issues.

src/bootstrap/install.rs

index 68e7dc80067268abe28ae010d47a88f4edfd2c72..13ee909afd5e408897a32d1a23395dd0efe5629e 100644 (file)
 use crate::builder::{Builder, RunConfig, ShouldRun, Step};
 use crate::config::{Config, TargetSelection};
 
+#[cfg(target_os = "illumos")]
+const SHELL: &str = "bash";
+#[cfg(not(target_os = "illumos"))]
+const SHELL: &str = "sh";
+
 fn install_sh(
     builder: &Builder<'_>,
     package: &str,
@@ -37,7 +42,7 @@ fn install_sh(
     let empty_dir = builder.out.join("tmp/empty_dir");
     t!(fs::create_dir_all(&empty_dir));
 
-    let mut cmd = Command::new("sh");
+    let mut cmd = Command::new(SHELL);
     cmd.current_dir(&empty_dir)
         .arg(sanitize_sh(&tarball.decompressed_output().join("install.sh")))
         .arg(format!("--prefix={}", prepare_dir(prefix)))