-use std::io::Write;
-use std::process::{Command, ExitCode, Stdio};
+use std::process::ExitCode;
use std::{fs, path::PathBuf};
use anyhow::{anyhow, Error, Result};
return ExitCode::FAILURE;
}
};
+ info!("queried answer file for automatic installation successfully");
- let mut child = match Command::new("proxmox-auto-installer")
- .stdout(Stdio::inherit())
- .stdin(Stdio::piped())
- .stderr(Stdio::null())
- .spawn()
- {
- Ok(child) => child,
- Err(err) => panic!("Failed to start automatic installation: {err}"),
- };
-
- let mut stdin = child.stdin.take().expect("Failed to open stdin");
- std::thread::spawn(move || {
- stdin
- .write_all(answer.as_bytes())
- .expect("Failed to write to stdin");
- });
+ println!("{answer}");
- match child.wait() {
- Ok(status) => {
- if status.success() {
- ExitCode::SUCCESS
- } else {
- ExitCode::FAILURE // Will be trapped
- }
- }
- Err(err) => {
- error!("Auto installer exited: {err}");
- ExitCode::FAILURE
- }
- }
+ return ExitCode::SUCCESS;
}
echo "Starting the TUI installer"
/usr/bin/proxmox-tui-installer 2>/dev/tty2
elif [ $proxauto -ne 0 ]; then
+ echo "Caching device info from udev"
/usr/bin/proxmox-low-level-installer dump-udev
+ echo "Fetching answers for automatic installation"
+ /usr/bin/proxmox-fetch-answer >/run/automatic-installer-answers
echo "Starting automatic installation"
- /usr/bin/proxmox-fetch-answer
+ /usr/bin/proxmox-auto-installer </run/automatic-installer-answers
else
echo "Starting the installer GUI - see tty2 (CTRL+ALT+F2) for any errors..."
xinit -- -dpi "$DPI" -s 0 >/dev/tty2 2>&1