build: Preparing stuff to create debian package

- Added deb binary target to generate incomplete control file
- Added CLI init option to insert impl_path in config
This commit is contained in:
Alexey 2025-12-19 16:22:02 +03:00
commit 9d1261b74d
4 changed files with 29 additions and 0 deletions

View file

@ -5,6 +5,7 @@ members = ["cli", "discord"]
version = "0.10.0" version = "0.10.0"
edition = "2024" edition = "2024"
repository = "https://2ndbeam.ru/git/2ndbeam/squad-quest" repository = "https://2ndbeam.ru/git/2ndbeam/squad-quest"
homepage = "https://2ndbeam.ru/git/2ndbeam/squad-quest"
license = "MIT" license = "MIT"
[package] [package]
@ -13,6 +14,7 @@ edition.workspace = true
version.workspace = true version.workspace = true
repository.workspace = true repository.workspace = true
license.workspace = true license.workspace = true
homepage.workspace = true
[dependencies] [dependencies]
serde = { version = "1.0.228", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] }

View file

@ -40,4 +40,6 @@ pub enum Objects {
pub struct InitArgs { pub struct InitArgs {
#[arg(long,short)] #[arg(long,short)]
pub path: Option<PathBuf>, pub path: Option<PathBuf>,
#[arg(long,short)]
pub implpath: Option<PathBuf>,
} }

View file

@ -71,6 +71,7 @@ fn main() {
let config = Config { let config = Config {
path: path.clone(), path: path.clone(),
impl_path: args.implpath.clone(),
..Default::default() ..Default::default()
}; };

24
src/bin/deb.rs Normal file
View file

@ -0,0 +1,24 @@
//! This binary generates DEBIAN/control text for use in debian package
use std::process::Command;
fn main() {
let version = env!("CARGO_PKG_VERSION");
let homepage = env!("CARGO_PKG_HOMEPAGE");
let dpkg_arch = {
let output = match Command::new("dpkg")
.arg("--print-architecture")
.output() {
Ok(out) => out,
Err(error) => panic!("error running dpkg: {error}"),
};
String::from_utf8(output.stdout).expect("dpkg returned ill UTF-8")
};
println!("Package: squad-quest\n\
Version: {version}-1\n\
Architecture: {dpkg_arch}\
Section: misc\n\
Priority: optional\n\
Homepage: {homepage}\n\
Description: Simple RPG-like system for hosting events\n\
Maintainer: Alexey Mirenkov <2ndbeam@disroot.org>");
}