Compare commits

..

10 Commits

Author SHA1 Message Date
c7e0d01d84 change
Some checks failed
Rust / build (push) Failing after 44s
2025-05-22 02:04:47 +02:00
9fb659f779 Merge commit '77ca11c56347e8894b79c76d3b57c2f144f93f9f' 2025-05-22 01:24:20 +02:00
37a086fb67 fix & update 2025-05-22 01:10:16 +02:00
77ca11c563 gitea/workflows/rust.yaml aktualisiert
Some checks failed
Rust / build (push) Failing after 1m54s
2025-05-21 19:02:58 +02:00
24b7cb3144 gitea/workflows/rust.yaml hinzugefügt 2025-05-21 19:00:40 +02:00
df3b4c32a9 fail
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-01-07 19:48:13 +01:00
9c10606ff0 update
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-01-07 19:46:14 +01:00
b8c492cb62 update
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-01-07 19:41:08 +01:00
4d20bfaaec update
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
2025-01-07 19:14:48 +01:00
9d255103fe Depends & update 2025-01-07 19:04:58 +01:00
9 changed files with 805 additions and 294 deletions

View File

@@ -0,0 +1,31 @@
name: Rust
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
name: Check format
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
name: Run clippy
with:
command: clippy
args: --all-targets --locked -- -D warnings
- uses: actions-rs/cargo@v1
name: Run tests
with:
command: test

View File

@@ -34,7 +34,7 @@ pipeline:
commands: commands:
- dpkg --add-architecture armel - dpkg --add-architecture armel
- apt-get update - apt-get update
- apt-get install -y crossbuild-essential-armel libdbus-1-dev:armel --no-install-recommends - apt-get install -y crossbuild-essential-armel libdbus-1-dev:armel libdbus-1-3:armel --no-install-recommends
- rustup target add arm-unknown-linux-gnueabi - rustup target add arm-unknown-linux-gnueabi
- PKG_CONFIG=arm-linux-gnueabi-pkg-config CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc cargo build --release --target arm-unknown-linux-gnueabi - PKG_CONFIG=arm-linux-gnueabi-pkg-config CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc cargo build --release --target arm-unknown-linux-gnueabi
- mv target/arm-unknown-linux-gnueabi/release/alma alma-arm - mv target/arm-unknown-linux-gnueabi/release/alma alma-arm

1001
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,16 +5,16 @@ authors = ["Roey Darwish Dror, PurpleCow"]
edition = "2021" edition = "2021"
[dependencies] [dependencies]
which = "4.4" which = "7.0.3"
log = "0.4" log = "0.4.27"
structopt = "0.3" structopt = "0.3.26"
tempfile = "3" tempfile = "3"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
toml = "0.7" toml = "0.8.22"
byte-unit = "4.0" byte-unit = "5.1.6"
nix = "0.26" nix = { version = "0.30.1", features = ["mount"] }
env_logger = "0.10" env_logger = "0.11.8"
pretty_env_logger = "0.5" pretty_env_logger = "0.5"
dialoguer = "0.10" dialoguer = "0.11"
console = "0.15" console = "0.15.11"
anyhow = "1" anyhow = "1"

31
gitea/workflows/rust.yaml Normal file
View File

@@ -0,0 +1,31 @@
name: Rust
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
name: Check format
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
name: Run clippy
with:
command: clippy
args: --all-targets --locked -- -D warnings
- uses: actions-rs/cargo@v1
name: Run tests
with:
command: test

View File

@@ -6,7 +6,7 @@ use structopt::StructOpt;
/// Parse size argument as bytes /// Parse size argument as bytes
/// e.g. 10GB, 10GiB, etc. /// e.g. 10GB, 10GiB, etc.
fn parse_bytes(src: &str) -> Result<Byte, &'static str> { fn parse_bytes(src: &str) -> Result<Byte, &'static str> {
Byte::from_str(src).map_err(|_| "Invalid image size") Byte::parse_str(src, false).map_err(|_| "Invalid image size")
} }
#[derive(StructOpt)] #[derive(StructOpt)]

View File

@@ -78,7 +78,7 @@ fn create_image(path: &Path, size: Byte, overwrite: bool) -> anyhow::Result<Loop
} }
let file = options.open(path).context("Error creating the image")?; let file = options.open(path).context("Error creating the image")?;
file.set_len(size.get_bytes() as u64) file.set_len(size.as_u64())
.context("Error creating the image")?; .context("Error creating the image")?;
} }

View File

@@ -23,7 +23,7 @@ impl<'a> MountStack<'a> {
filesystem: &'a Filesystem, filesystem: &'a Filesystem,
target: PathBuf, target: PathBuf,
options: Option<&str>, options: Option<&str>,
) -> nix::Result<()> { ) -> Result<(), nix::Error> {
let source = filesystem.block().path(); let source = filesystem.block().path();
debug!("Mounting {:?} to {:?}", filesystem, target); debug!("Mounting {:?} to {:?}", filesystem, target);
mount( mount(
@@ -42,7 +42,7 @@ impl<'a> MountStack<'a> {
source: PathBuf, source: PathBuf,
target: PathBuf, target: PathBuf,
options: Option<&str>, options: Option<&str>,
) -> nix::Result<()> { ) -> Result<(), nix::Error> {
debug!("Mounting {:?} to {:?}", source, target); debug!("Mounting {:?} to {:?}", source, target);
mount::<_, _, str, _>( mount::<_, _, str, _>(
Some(&source), Some(&source),

View File

@@ -1,5 +1,5 @@
use anyhow::Context; use anyhow::Context;
use byte_unit::Byte; use byte_unit::{Byte, UnitType};
use std::{fmt, fs}; use std::{fmt, fs};
#[derive(Debug)] #[derive(Debug)]
@@ -17,7 +17,7 @@ impl fmt::Display for Device {
"{} {} ({})", "{} {} ({})",
self.vendor, self.vendor,
self.model, self.model,
self.size.get_appropriate_unit(true) self.size.get_appropriate_unit(UnitType::Decimal)
) )
} }
} }
@@ -60,14 +60,14 @@ pub fn get_storage_devices(allow_non_removable: bool) -> anyhow::Result<Vec<Devi
vendor: fs::read_to_string(entry.path().join("device/vendor")) vendor: fs::read_to_string(entry.path().join("device/vendor"))
.map(trimmed) .map(trimmed)
.context("Error querying storage devices")?, .context("Error querying storage devices")?,
size: Byte::from_bytes( size: Byte::from_u128(
fs::read_to_string(entry.path().join("size")) fs::read_to_string(entry.path().join("size"))
.context("Error querying storage devices")? .context("Error querying storage devices")?
.trim() .trim()
.parse::<u128>() .parse::<u128>()
.context("Could not parse block size to unsigned integer (u128)")? .context("Could not parse block size to unsigned integer (u128)")?
* 512, * 512,
), ).expect("Invalid byte size"),
}); });
} }