Crates.io | deb-rust |
lib.rs | deb-rust |
version | 0.1.2 |
source | src |
created_at | 2023-01-25 04:53:20.616715 |
updated_at | 2023-02-04 23:01:14.54214 |
description | Rust library for building and reading Deb packages |
homepage | |
repository | https://codeberg.org/notsludgebomb/deb-rust |
max_upload_size | |
id | 767135 |
size | 90,045 |
A pure Rust library for building and reading Deb packages.
deb-rust provides an easy to use, programmatic interface for reading and writing Deb packages. It currently supports only binary deb packages.
You can use deb-rust via crates.io
use std::fs::File;
use deb_rust::*;
use deb_rust::binary::*;
fn main() -> std::io::Result<()> {
let mut package = DebPackage::new("example");
package = package
.set_version("0.1.0")
.set_description("deb-rust example")
.set_architecture(DebArchitecture::Amd64)
.with_depend("bash")
.with_file(DebFile::from_path(
"target/release/example",
"/usr/bin/example",
)?);
package.build()?.write(File::create("example.deb")?)?;
Ok(())
}
use std::fs;
use std::fs::File;
use deb_rust::*;
use deb_rust::binary::*;
fn main() -> std::io::Result<()> {
let package = DebPackage::from(File::open("example.deb")?)?;
let name = package.name();
let version = package.version();
for file in package.files() {
fs::write(file.path(), file.contents())?;
}
Ok(())
}
use std::fs::File;
use deb_rust::*;
use deb_rust::binary::*;
fn main() -> std::io::Result<()> {
let mut package = DebPackage::from(File::open("example.deb")?)?;
package = package
.set_name("rename")
.set_description("some example idfk");
package.build()?.write(File::create("new.deb")?)?;
Ok(())
}