Skip to content

Commit 50fc39b

Browse files
committed
feat: init apt options on main.rs
1 parent 1d90a3d commit 50fc39b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use lang::LANGUAGE_LOADER;
3232
use oma_console::OmaLayer;
3333
use oma_console::print::{OmaColorFormat, termbg};
3434
use oma_console::writer::{MessageType, Writer, writeln_inner};
35+
use oma_pm::apt::AptConfig;
3536
use oma_utils::OsRelease;
3637
use oma_utils::dbus::{create_dbus_connection, get_another_oma_status};
3738
use reqwest::Client;
@@ -210,6 +211,8 @@ fn main() {
210211
}
211212
}
212213

214+
init_apt_config(&oma);
215+
213216
let code = match try_main(oma, config, matches) {
214217
Ok(exit_code) => {
215218
unlock_oma().ok();
@@ -233,6 +236,17 @@ fn main() {
233236
exit(code);
234237
}
235238

239+
fn init_apt_config(oma: &OhManagerAilurus) {
240+
let apt_config = AptConfig::new();
241+
apt_config.set("Dir", &oma.global.sysroot.to_string_lossy());
242+
243+
for kv in &oma.global.apt_options {
244+
let (k, v) = kv.split_once('=').unwrap_or((kv.as_str(), ""));
245+
debug!("Set apt option: {k}={v}");
246+
apt_config.set(k, v);
247+
}
248+
}
249+
236250
fn parse_args() -> (ArgMatches, OhManagerAilurus) {
237251
let matches = match OhManagerAilurus::command().try_get_matches() {
238252
Ok(m) => m,

0 commit comments

Comments
 (0)