Giter VIP home page Giter VIP logo

aoscdk-rs's Introduction

DeployKit

DeployKit is the AOSC OS system installer.

Usage

DeployKit comes pre-installed with LiveKit. Simply run the deploykit command to launch the installer. You shouldn't need to compile or install LiveKit manually unless you would like to help with development or debugging.

Building DeployKit

Please note that you'd only need to use the DeployKit pre-installed with LiveKit to install AOSC OS.

If you would like to compile your own DeployKit (or trying it out on a different distribution, please install the following dependencies:

  • OpenSSL >= 1.1
  • Glibc
  • C/C++ Compiler (GCC or Clang)
  • ncurses
  • pkg-config
  • libparted
  • Rust + Cargo
  • unsquashfs (from squashfs-tools)

If you are using AOSC OS, please install the dependencies with the following command:

sudo oma install llvm pkg-config gcc parted ncurses openssl squashfs-tools

And run the following command to build DeployKit:

cargo build --release

Retro

If you would like to build DeployKit for AOSC OS/Retro, please enable the is_retro feature:

$ cargo build --release --features is_retro

Debugging

If you would like to debug DeployKit, please follow the following steps.

  1. Create a hard disk image on which to install AOSC OS.
// Ensuring that you have loaded the loop kernel module, if the following
// command returns an error, you may need to recompile your kernel.
# modprobe loop

// Create a 35GiB hard disk image (to install AOSC OS KDE), naming it test.img.
$ dd if=/dev/zero of=/path/to/aoscdk-rs-src/test.img bs=1M count=35840 status=progress

// Mount the image as /dev/loop10 with losetup.
# losetup /dev/loop10 /path/to/aoscdk-rs-src/test.img

// Partition the image. The first partition should be the system partition.
// If you are using EFI, please create an ESP (EFI System Partition) as the
// second partition.
# cfdisk /dev/loop10

// Inform the kernel about partition changes.
# partprobe /dev/loop10
  1. Building DeployKit for debugging.
// Build a debug version of DeployKit, leave out the --release parameter.
$ cargo build

// Launch debug DeployKit.
# /path/to/aoscdk-rs-src/target/debug/aoscdk-rs

You may want to use a beefy device to debug DeployKit to spare yourself some grey hair.

If you would like DeployKit to print log to the terminal - and since that it would be difficult to check real-time log with a TUI application - you may want to use the test function.

Take the frontend/mod for example:

#[test]
fn test_download_amd64() {
    use tempfile::TempDir;
    let json = r#"{"variant":{"name":"Base","size":821730832,"install_size":4157483520,"date":"20210602","sha256sum":"b5a5b9d889888a0e4f16b9f299b8a820ae2c8595aa363eb1e797d32ed0e957ed","url":"os-amd64/base/aosc-os_base_20210602_amd64.tar.xz"},"partition":{"path":"/dev/loop0p1","parent_path":"/dev/loop0","fs_type":"ext4","size":3145728},"mirror":{"name":"Beijing Foreign Studies University","name-tr":"bfsu-name","loc":"China","loc-tr":"bfsu-loc","url":"https://mirrors.bfsu.edu.cn/anthon/aosc-os/"},"user":"test","password":"test","hostname":"test","locale":"","continent":"Asia","city":"Shanghai","tc":"UTC"}"#;
    let config = serde_json::from_str(json).unwrap();
    let (tx, _rx) = std::sync::mpsc::channel();
    let tempdir = TempDir::new().unwrap().into_path();
    begin_install(tx, config, tempdir).unwrap();
}

Run the following to begin real-time logging:

$ cargo test --nocapture

// You should see something like this.
 Running unittests (target/debug/deps/aoscdk_rs-3b358921c017024b)

// Run the following command to begin debugging with logging.
# target/debug/deps/aoscdk_rs-3b358921c017024b --nocapture

Resources

  • languagelist from ubiquity.
  • zone1970tab from tzdata.

aoscdk-rs's People

Contributors

cthbleachbit avatar eatradish avatar jiegec avatar liushuyu avatar mingcongbai avatar xiangzhai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aoscdk-rs's Issues

"enum_(unnamed_at_/usr/include/linux/loop_h_16_1)" is not a valid Ident

Hi,

Reproduced rust-bindgen issue: rust-lang/rust-bindgen#2312

   Compiling loopdev v0.4.0
   Compiling enumset_derive v0.6.1
   Compiling libparted-sys v0.3.1
   Compiling num-iter v0.1.43
   Compiling typenum v1.16.0
error: failed to run custom build command for `loopdev v0.4.0`

Caused by:
  process didn't exit successfully: `/mnt/repo/AOSC-Dev/aoscdk-rs/target/debug/build/loopdev-334d105e9633682c/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at '"enum_(unnamed_at_/usr/include/linux/loop_h_16_1)" is not a valid Ident', /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/fallback.rs:811:9
  stack backtrace:
     0:     0x5555589d78e0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h36a7aec67b0db3ef
     1:     0x5555589fc4f4 - core::fmt::write::h7d78873c9f7a736d
     2:     0x5555589c72b0 - std::io::Write::write_fmt::h3653f72623b2c5b1
     3:     0x5555589d7720 - std::sys_common::backtrace::print::h4ba366dab4d8d880
     4:     0x5555589ca00c - std::panicking::default_hook::{{closure}}::h0fa66bbe12df1171
     5:     0x5555589c9e1c - std::panicking::default_hook::h997043e2b640b851
     6:     0x5555589ca508 - std::panicking::rust_panic_with_hook::h8492e5d1cb5e4152
     7:     0x5555589d7bfc - std::panicking::begin_panic_handler::{{closure}}::hc3d9ead452698424
     8:     0x5555589d7b20 - std::sys_common::backtrace::__rust_end_short_backtrace::h45c79ef3fdbb2db0
     9:     0x5555589ca164 - rust_begin_unwind
    10:     0x5555585e8590 - core::panicking::panic_fmt::h5171e01556971d91
    11:     0x5555589a1a40 - proc_macro2::fallback::validate_ident::h0601b9ba85e86d80
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/fallback.rs:811:9
    12:     0x5555589a183c - proc_macro2::fallback::Ident::_new::h5c5a3dd6d5d1333a
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/fallback.rs:753:9
    13:     0x5555589a1894 - proc_macro2::fallback::Ident::new::hb478cdf21b2a2164
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/fallback.rs:763:9
    14:     0x5555589a3b50 - proc_macro2::imp::Ident::new::hf85e65ac44bfeba0
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/wrapper.rs:701:50
    15:     0x55555899e1f8 - proc_macro2::Ident::new::haa727b5dacb72a99
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/lib.rs:972:21
    16:     0x555558703c0c - bindgen::ir::context::BindgenContext::rust_ident_raw::h7fe653644ad08f40
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/ir/context.rs:878:9
    17:     0x55555870394c - bindgen::ir::context::BindgenContext::rust_ident::h54f0931149f1595a
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/ir/context.rs:870:9
    18:     0x55555863f778 - <bindgen::ir::enum_ty::Enum as bindgen::codegen::CodeGenerator>::codegen::hfbc6992d49936a93
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:2907:21
    19:     0x55555869e614 - <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen::h5894f41bfffe3c9a
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:1004:39
    20:     0x55555867475c - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::he58367f13a6d1306
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:492:17
    21:     0x5555586bef10 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::h6b8d0b9c5c08232d
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:515:21
    22:     0x5555586748e4 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h4fd846797a789e6c
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:545:13
    23:     0x555558674740 - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::he58367f13a6d1306
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:483:17
    24:     0x5555586c6734 - bindgen::codegen::codegen::{{closure}}::h138681c6119125a8
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:4287:9
    25:     0x5555587058e8 - bindgen::ir::context::BindgenContext::gen::h1d55eee5c268c43c
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/ir/context.rs:1190:19
    26:     0x5555586c60c8 - bindgen::codegen::codegen::hf049004d6b1de9ff
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/codegen/mod.rs:4251:5
    27:     0x5555586ca8c8 - bindgen::Bindings::generate::h404ebfe61246e21d
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/lib.rs:2374:32
    28:     0x5555586c829c - bindgen::Builder::generate::h5aaaf4b9918c10df
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/lib.rs:1478:9
    29:     0x5555585ea1f8 - build_script_build::main::h79ef15ec79813006
                                 at /home/loongson/.cargo/registry/src/index.crates.io-6f17d22bba15001f/loopdev-0.4.0/build.rs:7:20
    30:     0x5555585e8e84 - core::ops::function::FnOnce::call_once::h9ff9070868288659
                                 at /mnt/repo/loongarch-rs/rust/library/core/src/ops/function.rs:250:5
    31:     0x5555585e9990 - std::sys_common::backtrace::__rust_begin_short_backtrace::h88f0965c716e200a
                                 at /mnt/repo/loongarch-rs/rust/library/std/src/sys_common/backtrace.rs:134:18
    32:     0x5555585e90a4 - std::rt::lang_start::{{closure}}::h2df3e43a012c05db
                                 at /mnt/repo/loongarch-rs/rust/library/std/src/rt.rs:166:18
    33:     0x5555589d4e1c - std::panicking::try::do_call::hba1e5d0eda70a380
    34:     0x5555589d4f08 - __rust_try
    35:     0x5555589d4e68 - std::panicking::try::do_call::hbe1d7d7c58560c8f
    36:     0x5555589d4f08 - __rust_try
    37:     0x5555589d4d64 - std::panicking::try::h974a23446c059bb7
    38:     0x5555589c6770 - std::rt::lang_start_internal::hefe79b88b52e0197
    39:     0x5555585e9078 - std::rt::lang_start::h90fdfc890dc45f39
                                 at /mnt/repo/loongarch-rs/rust/library/std/src/rt.rs:165:17
    40:     0x5555585ea3c8 - main
    41:     0x7ffff11e575c - <unknown>
    42:     0x7ffff11e5848 - __libc_start_main
    43:     0x5555585e8d30 - _start
    44:                0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...

Fixed by: rust-lang/rust-bindgen#2319 And I backported the patch to bindgen-0.58.1 and bindgen-0.59.2, cargo build passed!

Could you give me some suggestion please?

Thanks,
Leslie Zhai

Wait for multi-threaded decomp

xz2 might be receiving multi-threaded decompression soon: alexcrichton/xz2-rs#113. When that lands we would get much better install performance, maybe finally enough to saturate a hard drive's write speed.

(It does require a properly-compressed tarball though. Are they compressed with threads?)

Smarter download

Right now the downloady part does a single request stream, so I have to deal with a 1.5 MB/s speed to Tencent mirror of all places. And there's no possibility for continuation, so it's not like I even dare to interrupt it.

This is a step backwards from axel. Bear with me, but maybe downloading large files is not what a general-purpose request library should do.

Now about solutions.

  • Just call axel. Command line calls are not that evil.
  • https://github.com/x0f5c3/manic is a layer over reqwest that implements a multithreaded download client. It's not as awesome as axel (no multi-server, no continue), but it will probably do.
  • or what if we just hooked this thing up to libtorrent? It's got multi-server webseeds AND continue. You even get file integrity on block level. Big dependency, I know, but game studios are doing it too!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.