Rollup merge of #84250 - jclulow:illumos-bash-bootstrap, r=Mark-Simulacrum

bootstrap: use bash on illumos to run install scripts

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.
This commit is contained in:
Yuki Okushi 2021-04-24 12:17:02 +09:00 committed by GitHub
commit 5321f9559b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,11 @@ use crate::Compiler;
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)))