diff --git a/dev-tools/omicron-dev/src/main.rs b/dev-tools/omicron-dev/src/main.rs index fb62f1dd49f..267a3190051 100644 --- a/dev-tools/omicron-dev/src/main.rs +++ b/dev-tools/omicron-dev/src/main.rs @@ -12,6 +12,7 @@ use nexus_config::NexusConfig; use nexus_test_interface::NexusServer; use nexus_test_utils::resource_helpers::DiskTest; use signal_hook_tokio::Signals; +use std::fs; fn main() -> anyhow::Result<()> { oxide_tokio_rt::run(async { @@ -50,6 +51,9 @@ struct RunAllArgs { /// Override the gateway server configuration file. #[clap(long, default_value = DEFAULT_SP_SIM_CONFIG)] gateway_config: Utf8PathBuf, + /// Override the nexus configuration file. + #[clap(long, default_value = "./nexus/examples/config.toml")] + nexus_config: Utf8PathBuf, } impl RunAllArgs { @@ -60,9 +64,10 @@ impl RunAllArgs { let mut signal_stream = signals.fuse(); // Read configuration. - let config_str = include_str!("../../../nexus/examples/config.toml"); - let mut config: NexusConfig = - toml::from_str(config_str).context("parsing example config")?; + let config_str = fs::read_to_string(&self.nexus_config)?; + let mut config: NexusConfig = toml::from_str(&config_str).context( + format!("parsing config: {}", self.nexus_config.as_str()), + )?; config.pkg.log = dropshot::ConfigLogging::File { // See LogContext::new(), path: "UNUSED".to_string().into(), diff --git a/dev-tools/omicron-dev/tests/test-omicron-dev.rs b/dev-tools/omicron-dev/tests/test-omicron-dev.rs index 816bf7d135a..3bd9a5a1f06 100644 --- a/dev-tools/omicron-dev/tests/test-omicron-dev.rs +++ b/dev-tools/omicron-dev/tests/test-omicron-dev.rs @@ -139,7 +139,7 @@ async fn test_run_all() { let cmd_path = path_to_omicron_dev(); let cmdstr = format!( - "( set -o monitor; {} run-all --nexus-listen-port 0 && true )", + "( set -o monitor; {} run-all --nexus-listen-port 0 --nexus-config ../../nexus/examples/config.toml && true )", cmd_path.display() ); let exec = diff --git a/tools/install_builder_prerequisites.sh b/tools/install_builder_prerequisites.sh index e7d9bfef5a2..486bf0b33da 100755 --- a/tools/install_builder_prerequisites.sh +++ b/tools/install_builder_prerequisites.sh @@ -31,12 +31,14 @@ function usage ASSUME_YES="false" SKIP_PATH_CHECK="false" +OMIT_SUDO="false" RETRY_ATTEMPTS=3 -while getopts ypr: flag +while getopts ypsr: flag do case "${flag}" in y) ASSUME_YES="true" ;; p) SKIP_PATH_CHECK="true" ;; + s) OMIT_SUDO="true" ;; r) RETRY_ATTEMPTS=${OPTARG} ;; *) usage esac @@ -130,11 +132,16 @@ function install_packages { 'libclang-dev' 'libsqlite3-dev' ) - sudo apt-get update + if [[ "${OMIT_SUDO}" == "false" ]]; then + maybe_sudo="sudo" + else + maybe_sudo="" + fi + $maybe_sudo apt-get update if [[ "${ASSUME_YES}" == "true" ]]; then - sudo apt-get install -y "${packages[@]}" + $maybe_sudo apt-get install -y "${packages[@]}" else - confirm "Install (or update) [${packages[*]}]?" && sudo apt-get install "${packages[@]}" + confirm "Install (or update) [${packages[*]}]?" && $maybe_sudo apt-get install "${packages[@]}" fi elif [[ "${HOST_OS}" == "SunOS" ]]; then CLANGVER=15 diff --git a/tools/install_runner_prerequisites.sh b/tools/install_runner_prerequisites.sh index 120cbc3db84..c93f5cdb473 100755 --- a/tools/install_runner_prerequisites.sh +++ b/tools/install_runner_prerequisites.sh @@ -30,12 +30,14 @@ function usage } ASSUME_YES="false" +OMIT_SUDO="false" RETRY_ATTEMPTS=3 -while getopts ypr: flag +while getopts ypsr: flag do case "${flag}" in y) ASSUME_YES="true" ;; p) continue ;; + s) OMIT_SUDO="true" ;; r) RETRY_ATTEMPTS=${OPTARG} ;; *) usage esac @@ -139,11 +141,16 @@ function install_packages { 'libssl3' 'libxmlsec1-openssl' ) - sudo apt-get update + if [[ "${OMIT_SUDO}" == "false" ]]; then + maybe_sudo="sudo" + else + maybe_sudo="" + fi + $maybe_sudo apt-get update if [[ "${ASSUME_YES}" == "true" ]]; then - sudo apt-get install -y "${packages[@]}" + $maybe_sudo apt-get install -y "${packages[@]}" else - confirm "Install (or update) [${packages[*]}]?" && sudo apt-get install "${packages[@]}" + confirm "Install (or update) [${packages[*]}]?" && $maybe_sudo apt-get install "${packages[@]}" fi else echo "Unsupported OS: ${HOST_OS}"