20 Commits
Author SHA256 Message Date
kira 62a9e244a6 More verbose err, and setting up /usr/bin /usr/lib to env paths. 2026-07-15 01:13:28 +02:00
kira 32a1491537 Removing modprobe bcachefs (as we have it build in into kernel) and bumping app version. 2026-07-13 01:39:42 +02:00
kira 56d181864a Working on release workflow. 2026-07-02 23:31:30 +02:00
kira ba4cca635b Adding release workflow. 2026-07-02 23:21:25 +02:00
kira 92cb61dccc Some action cleanup. 2026-07-01 04:16:11 +02:00
kira f15fa368ac Finished plaing with actions. Build Release action should be functional now. 2026-06-30 19:03:09 +02:00
kira 70246f0d97 more play with build_release action. 2026-06-30 18:55:36 +02:00
kira 856a759315 more play with build_release action. 2026-06-30 18:47:58 +02:00
kira 4d01705527 more play with build_release action. 2026-06-30 18:45:43 +02:00
kira e6a3425109 more play with build_release action. 2026-06-30 18:43:16 +02:00
kira 81a0f4f8a2 more play with build_release action. 2026-06-30 18:36:50 +02:00
kira 0b4291b97e more play with build_release action. 2026-06-30 17:38:17 +02:00
kira f74461f6fb more fixes for build_release action. 2026-06-30 07:50:55 +02:00
kira 4396c5011b fixing release_build action. 2026-06-30 04:44:07 +02:00
kira acdf923ce0 fixing release_build action. 2026-06-30 04:34:24 +02:00
kira 68c19d84cf Addidg build-release gitea action, and bumping version in Cargo.toml for test purposes. 2026-06-30 03:58:01 +02:00
kira 33cabc86c9 Figuring actions thing up
Build Release / build (push) Failing after 53s
2026-06-30 03:26:08 +02:00
kira 379a992421 Adding gitlab action for test purposes.
Build Release / build (push) Failing after 39s
2026-06-30 03:18:49 +02:00
kira ab7ba83428 Fixing wait for F2 bug when it swiched to HandOff state from Error state. 2026-06-24 19:02:26 +02:00
kira 75c043b652 Add -k session to bcachefs unlock command. 2026-06-24 18:46:04 +02:00
7 changed files with 175 additions and 41 deletions
@@ -0,0 +1,43 @@
name: "Build Release Binary"
run-name: "Build Release: ${{ inputs.tag_name }}"
on:
# Allows triggering from another workflow
workflow_call:
inputs:
tag_name:
description: 'Git tag to build (e.g., v1.0.0)'
required: true
type: string
workflow_dispatch: # Enables manual triggering
inputs:
tag_name:
description: 'Git tag to build (e.g., v1.0.0)'
required: true
type: string
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
env:
GIT_DEFAULT_HASH: sha256
with:
# If triggered manually, use the input tag.
# If triggered by push, GITHUB_REF_NAME is the tag.
ref: ${{ inputs.tag_name || gitea.ref_name }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build Release Binary
run: cargo build --release
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: nyanit-${{ inputs.tag_name || gitea.ref_name }}
path: target/release/nyanit
+40
View File
@@ -0,0 +1,40 @@
name: Create Release with Binary
on:
workflow_dispatch: # Enables manual triggering
inputs:
tag_name:
description: 'Git tag to build (e.g., v1.0.0)'
required: true
type: string
rel_description:
description: 'Release description'
required: false
type: string
jobs:
# This job calls the reusable workflow
build-binary:
uses: ./.gitea/workflows/build-release-binary.yml
with:
tag_name: "${{ inputs.tag_name }}"
create-release:
needs: build-binary # Wait for the reusable workflow to finish
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: nyanit-${{ inputs.tag_name }}
- name: Create Release and Attach Binary
uses: actions/release-action@main
with:
artifacts: "nyanit-${{ inputs.tag_name }}"
api_key: ${{ secrets.bzzpss_release_psszz }}
tag_name: ${{ inputs.tag_name }}
name: Release ${{ inputs.tag_name }}
body: "Automated release for ${{ inputs.tag_name }}\n${{ inputs.rel_description }}"
Generated
+25 -26
View File
@@ -242,18 +242,18 @@ dependencies = [
[[package]] [[package]]
name = "lru" name = "lru"
version = "0.18.0" version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a860605968fce16869fd239cf4237a82f3ac470723415db603b0e8b6c8d4fb9" checksum = "0b6180140927ee907000b0aa540091f6ea512ead4447c92b8fc35bc72788a5a6"
dependencies = [ dependencies = [
"hashbrown 0.17.1", "hashbrown 0.17.1",
] ]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.8.2" version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
[[package]] [[package]]
name = "num-conv" name = "num-conv"
@@ -287,7 +287,7 @@ checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f"
[[package]] [[package]]
name = "nyanit" name = "nyanit"
version = "0.1.0" version = "0.1.3"
dependencies = [ dependencies = [
"ratatui", "ratatui",
"ratatui-textarea", "ratatui-textarea",
@@ -342,18 +342,18 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.45" version = "1.0.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]] [[package]]
name = "ratatui" name = "ratatui"
version = "0.30.1" version = "0.30.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1695748e3a735b34968c887ceea5a380b43545903868ae8f5b666593100f6b68" checksum = "3274ba0a2c5e1bcad2a2005d20f4dc59dad26b2eb0940fb094500dba4099d57d"
dependencies = [ dependencies = [
"instability", "instability",
"ratatui-core", "ratatui-core",
@@ -364,14 +364,13 @@ dependencies = [
[[package]] [[package]]
name = "ratatui-core" name = "ratatui-core"
version = "0.1.1" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42d3603f354bba8c595fa47860e60142d7372b7210c27044c6a7d0e1a4336b44" checksum = "cbb175c433c8e28a809d1f5773a2ae96e68c0ce40db865cbab1020bf33ae479c"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"compact_str", "compact_str",
"hashbrown 0.17.1", "hashbrown 0.17.1",
"indoc",
"itertools", "itertools",
"kasuari", "kasuari",
"lru", "lru",
@@ -386,9 +385,9 @@ dependencies = [
[[package]] [[package]]
name = "ratatui-termion" name = "ratatui-termion"
version = "0.1.1" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c16cc35a9d9114e0b2bb4b22018b96ae7f5fe60e2595dc73e622b4e78624835" checksum = "87c732202fa5a71a9da0991013f0853e53f87048f45198e3a1ca3ee722accc2f"
dependencies = [ dependencies = [
"instability", "instability",
"ratatui-core", "ratatui-core",
@@ -410,9 +409,9 @@ dependencies = [
[[package]] [[package]]
name = "ratatui-widgets" name = "ratatui-widgets"
version = "0.3.1" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef4f17dd7ac3abf5adc2b920a03c61eee4bfe6a88fa5191936895525371d79c" checksum = "66e3d19bcc9130ca376277d93b60767ff121ace3be06f5f95f81dd68956407d1"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"hashbrown 0.17.1", "hashbrown 0.17.1",
@@ -430,9 +429,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.12.4" version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -442,9 +441,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.4.14" version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -459,9 +458,9 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.22" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
[[package]] [[package]]
name = "ryu" name = "ryu"
@@ -534,9 +533,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.117" version = "2.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -575,9 +574,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.49" version = "0.3.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711a53c2d47bbd818258c498c8dbfe186a2526c631495cfe7e078567f86b8469" checksum = "18dfaaeddcb932337b5e7866ee7d0ce9b76d2fd092997146f187ec09b4558a50"
dependencies = [ dependencies = [
"deranged", "deranged",
"libc", "libc",
+2 -2
View File
@@ -1,12 +1,12 @@
[package] [package]
name = "nyanit" name = "nyanit"
version = "0.1.0" version = "0.1.3"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
ratatui = { version = "0.30", default-features = false, features = ["termion"] } ratatui = { version = "0.30", default-features = false, features = ["termion"] }
ratatui-textarea = { version = "0.9", default-features = false, features = ["termion"] } ratatui-textarea = { version = "0.9", default-features = false, features = ["termion"] }
regex = "1.12.4" regex = "1.1"
termion = "4" termion = "4"
+19 -1
View File
@@ -1,3 +1,21 @@
# nyanit # nyanit
Init program for initrd Kira-Linux init program for initrd
1. It looks for partitoin with GPT labelve **bee-root** what will shown in dev tree as **/dev/disk/by-partlabel/bee-root**
And this partition should be formated to bcachefs.
2. Nyanit checks if bcachefs is encrypted, and asks for unlock password if it is.
3. Then it mounts it to **/mnt/bee-root**.
4. And looks for snapshots with name pattern **/mnt/bee-root/bzz_snaps/bzz-yyyy-mm-ddTHH-MM-SS**
5. If no snapshots are found it calls **switch_root** for **/mnt/bee-root**
6. Othervise vait for F2 for few seconds.
And if F2 pressed provides list of snapshoots to boot from.
7. After some snapshoot or just **/mnt/bee-root** is selected, Nyanit doing **switch_root** to it.
+17 -9
View File
@@ -92,10 +92,10 @@ fn mount_and_check_snaps() -> Result<NyanitState, ExecCommandError> {
fn init_stage() -> Result<NyanitState, ExecCommandError> { fn init_stage() -> Result<NyanitState, ExecCommandError> {
// mount sysfss // mount sysfss
nyan_system::prepare_env()?; nyan_system::prepare_env().map_err(|ex| format!("prepare_env error: {}", ex))?;
// check if device is encrypted // check if device is encrypted
if nyan_system::bzzpss_dev_encrypted(ROOT_DEV)? { if nyan_system::bzzpss_dev_encrypted(ROOT_DEV).map_err(|ex| format!("Error checking if device is encrypted: {}", ex))? {
// if encrypted return EnterPassword so used get promted for pass // if encrypted return EnterPassword so used get promted for pass
return Ok(NyanitState::EnterPassword); return Ok(NyanitState::EnterPassword);
} }
@@ -241,7 +241,6 @@ impl NyanitTUI<'_> {
frame.render_widget(ok_text, vertical_chunks[1]); frame.render_widget(ok_text, vertical_chunks[1]);
// just some time to look at message // just some time to look at message
thread::sleep(Duration::from_millis(1000)) thread::sleep(Duration::from_millis(1000))
} }
_ => (), _ => (),
}; };
@@ -285,7 +284,10 @@ impl NyanitTUI<'_> {
if unlocked { if unlocked {
// need to check for subvolumes and stuff // need to check for subvolumes and stuff
self.state = match mount_and_check_snaps() { self.state = match mount_and_check_snaps() {
Ok(st) => st, Ok(st) => {
self.time_counter = 0;
st
}
Err(ex) => NyanitState::Error(ex.to_string()), Err(ex) => NyanitState::Error(ex.to_string()),
} }
} }
@@ -321,18 +323,24 @@ impl NyanitTUI<'_> {
} else { } else {
// Tick time // Tick time
thread::sleep(Duration::from_millis(500)); thread::sleep(Duration::from_millis(500));
self.time_counter = self.time_counter.wrapping_add(1u32);
// 2.5 sec wait if let NyanitState::WaitForF2(_) = self.state {
if self.time_counter > 5 { self.time_counter = self.time_counter.wrapping_add(1u32);
// boot from root // 2.5 sec wait
self.state = NyanitState::HandOff(TMP_ROOT.into()); if self.time_counter > 5 {
// boot from root
self.state = NyanitState::HandOff(TMP_ROOT.into());
}
} }
} }
Ok(()) Ok(())
} }
} }
fn main() -> ExitCode { fn main() -> ExitCode {
nyan_system::set_env_vars_unsafe();
let mut app = NyanitTUI::new().unwrap(); let mut app = NyanitTUI::new().unwrap();
app.run().unwrap(); app.run().unwrap();
// Terminal restores automatically when `stdout` (RawTerminal) is dropped // Terminal restores automatically when `stdout` (RawTerminal) is dropped
+29 -3
View File
@@ -145,9 +145,10 @@ pub fn bcachefs_unlock(pass: String, dev: &str) -> Result<bool, ExecCommandError
use std::io::Read; use std::io::Read;
use std::io::Write; use std::io::Write;
use std::process::Stdio; use std::process::Stdio;
// "-k", "session" is important as it stores key in sessyin keyring what allows
// system to mount filesystem after switch_root
let mut child = Command::new("bcachefs") let mut child = Command::new("bcachefs")
.arg("unlock") .args(&vec!["unlock", "-k", "session", dev])
.arg(dev)
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.stderr(Stdio::piped()) .stderr(Stdio::piped())
@@ -222,10 +223,35 @@ pub fn prepare_env() -> Result<(), ExecCommandError> {
exec_command("mount", &vec!["-t", "sysfs", "none", "/sys"])?; exec_command("mount", &vec!["-t", "sysfs", "none", "/sys"])?;
// modprobe bcachefs // modprobe bcachefs
exec_command("modprobe", &vec!["bcachefs"])?; // exec_command("modprobe", &vec!["bcachefs"])?;
Ok(()) Ok(())
} }
///
/// MUST be done before spawning any threads or async runtimes
pub fn set_env_vars_unsafe() -> () {
use std::env;
// 1. Define your custom paths
let custom_bin = "/usr/bin";
let custom_lib = "/usr/lib";
// 2. Retrieve existing paths to append/prepend (optional but recommended)
let existing_path = env::var("PATH").unwrap_or_else(|_| String::new());
let existing_ld_path = env::var("LD_LIBRARY_PATH").unwrap_or_else(|_| String::new());
// 3. Construct new path strings
// Prepend custom paths so they take precedence
let new_path = format!("{}:{}", custom_bin, existing_path);
let new_ld_path = format!("{}:{}", custom_lib, existing_ld_path);
// 4. Set environment variables (UNSAFE in Rust 2024+)
// MUST be done before spawning any threads or async runtimes
unsafe {
env::set_var("PATH", new_path);
env::set_var("LD_LIBRARY_PATH", new_ld_path);
}
}
// # Mount the real root filesystem // # Mount the real root filesystem
pub fn mount_bee_root(mount_point: &str, dev_name: &str) -> Result<(), ExecCommandError> { pub fn mount_bee_root(mount_point: &str, dev_name: &str) -> Result<(), ExecCommandError> {
exec_command("mount", &vec!["-o", "ro", dev_name, mount_point])?; exec_command("mount", &vec!["-o", "ro", dev_name, mount_point])?;