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