Fixing hand off absense after F2 stage, and F2 times display.

This commit is contained in:
kira committed 2026-10-13 01:00:13 +02:00
1 parent 0862b4f37f
commit d5a4151808
4 files changed
+23 -15

No files matched your search

Generated
+1 -1
View File
@@ -284,7 +284,7 @@ checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f"
[[package]]
name = "nyanit"
version = "0.2.7"
version = "0.2.8"
dependencies = [
"nix",
"ratatui",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "nyanit"
version = "0.2.7"
version = "0.2.8"
edition = "2024"
[dependencies]
+9 -3
View File
@@ -267,6 +267,7 @@ impl NyanitTUI<'_> {
let mut tty_input_async = termion::async_stdin().keys();
self.time_counter = 0;
self.time_counter_sec = 0;
while !self.exit {
terminal.draw(|frame| self.draw(frame))?;
self.handle_events(&mut tty_input_async)?;
@@ -321,7 +322,7 @@ impl NyanitTUI<'_> {
let f2_lines: Vec<Line> = vec![
Line::from("Press F2 for options"),
Line::default(),
Line::from((WAIT_FOR_F2_SEC.saturating_sub(self.time_counter)).to_string()),
Line::from((WAIT_FOR_F2_SEC.saturating_sub(self.time_counter_sec)).to_string()),
];
let f2_paragraph = Paragraph::new(f2_lines).centered().magenta().bold();
@@ -411,8 +412,6 @@ impl NyanitTUI<'_> {
ok_text,
vertical_chunks[1].centered_vertically(Constraint::Length(3)),
);
// just some time to look at beez
thread::sleep(Duration::from_millis(1000))
}
_ => (),
};
@@ -540,6 +539,13 @@ impl NyanitTUI<'_> {
}
_ => (),
},
NyanitState::HandOff => {
// just some time to look at beez
thread::sleep(Duration::from_millis(1000));
if let Err(ex) = nyan_system::hand_off_control(TMP_ROOT, SYS_INIT) {
self.state = NyanitState::Error(ex.to_string())
}
}
_ => (),
}
}
+12 -10
View File
@@ -19,10 +19,9 @@
*/
use nix;
use regex_lite::Regex;
use std::fs;
use std::process::Command;
use regex_lite::Regex;
/// timeout for block deices population
const WAIT_FOR_BLK_DEVS: u64 = 5u64;
@@ -138,7 +137,6 @@ pub fn exec_command(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError>
}
}
#[derive(PartialEq)]
pub struct BlkIdRes {
pub fs_type: String,
@@ -149,8 +147,7 @@ impl BlkIdRes {
pub fn is_bcachefs(&self) -> bool {
if self.fs_type == "bcachefs" {
true
}
else {
} else {
false
}
}
@@ -186,17 +183,23 @@ pub fn find_partlabel(partlabel: &str) -> Result<Option<BlkIdRes>, ExecCommandEr
])
.output()?;
if out.status.success() {
let re = Regex::new(r#"^(/dev/[a-z0-9-]+): TYPE="([a-z]+)" PARTLABEL="[a-z0-9-]+""#)
.unwrap();
let re =
Regex::new(r#"^(/dev/[a-z0-9-]+): TYPE="([a-z]+)" PARTLABEL="[a-z0-9-]+""#).unwrap();
let out_text = String::from_utf8(out.stdout)?;
let out_text_trimmed = out_text.trim();
if let Some(captured) = re.captures(out_text_trimmed) {
// let part_no = captured[1];
// let parent_dev = captured[2];
let res = BlkIdRes{ fs_type: captured[2].to_string(), dev_node: captured[1].to_string()};
let res = BlkIdRes {
fs_type: captured[2].to_string(),
dev_node: captured[1].to_string(),
};
Ok(Some(res))
} else {
Err(ExecCommandError::Other(format!("Unexpected blkid output format: \"{}\"", out_text)))
Err(ExecCommandError::Other(format!(
"Unexpected blkid output format: \"{}\"",
out_text
)))
}
} else {
if let Some(code) = out.status.code()
@@ -512,7 +515,6 @@ impl Iterator for RollBackIterator {
}
}
///
/// Checks if pac_lock file exist and returns date-time from it if it does,
/// Otherwise return None