diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc0616e..704be5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,48 +42,11 @@ jobs: run: | export ANDROID_NDK_HOME="$HOME/ndk" export ANDROID_NDK_ROOT="$ANDROID_NDK_HOME" - cd oukaro cargo ndk -t arm64-v8a build --release - cp target/aarch64-linux-android/release/oukaro ../module/ + cp target/aarch64-linux-android/release/oukaro ./module/ - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: oukaromanager-module path: module/ retention-days: 30 - build-okrmng: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Setup NDK - run: | - ndk_url=$(wget -qO- https://github.com/android/ndk/releases/latest \ - | grep -oP 'href="\Khttps://dl.google.com/android/repository/android-ndk-[^"]*-linux.zip' \ - | head -n1) - wget -O ndk.zip "$ndk_url" -nv - unzip -q ndk.zip -d "$HOME" - mv "$HOME/android-ndk-"* "$HOME/ndk" - - name: Setup Rust toolchains - run: | - rustup default nightly - rustup target add aarch64-linux-android - rustup component add rust-src - - name: Install build dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -y gcc-multilib - cargo install --locked cargo-ndk - - name: Build - run: | - export ANDROID_NDK_HOME="$HOME/ndk" - export ANDROID_NDK_ROOT="$ANDROID_NDK_HOME" - cd okrmng - cargo ndk -t arm64-v8a build --release - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: okrmng - path: okrmng/target/aarch64-linux-android/release/okrmng - retention-days: 30 - \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed41da9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target/ +**.bak diff --git a/oukaro/Cargo.lock b/Cargo.lock similarity index 100% rename from oukaro/Cargo.lock rename to Cargo.lock diff --git a/oukaro/Cargo.toml b/Cargo.toml similarity index 100% rename from oukaro/Cargo.toml rename to Cargo.toml diff --git a/module/skip_mount b/module/skip_mount deleted file mode 100644 index e69de29..0000000 diff --git a/okrmng/.gitignore b/okrmng/.gitignore deleted file mode 100644 index 9f97022..0000000 --- a/okrmng/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/ \ No newline at end of file diff --git a/okrmng/Cargo.lock b/okrmng/Cargo.lock deleted file mode 100644 index 1010f4f..0000000 --- a/okrmng/Cargo.lock +++ /dev/null @@ -1,301 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "anstream" -version = "0.6.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" - -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys", -] - -[[package]] -name = "anyhow" -version = "1.0.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" - -[[package]] -name = "clap" -version = "4.5.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.49" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" - -[[package]] -name = "colorchoice" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "hashbrown" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "indexmap" -version = "2.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - -[[package]] -name = "okrmng" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "serde", - "toml", -] - -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - -[[package]] -name = "proc-macro2" -version = "1.0.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_spanned" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" -dependencies = [ - "serde_core", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.110" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "toml" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" -dependencies = [ - "indexmap", - "serde_core", - "serde_spanned", - "toml_datetime", - "toml_parser", - "toml_writer", - "winnow", -] - -[[package]] -name = "toml_datetime" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_parser" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" -dependencies = [ - "winnow", -] - -[[package]] -name = "toml_writer" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" - -[[package]] -name = "unicode-ident" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "winnow" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" diff --git a/okrmng/Cargo.toml b/okrmng/Cargo.toml deleted file mode 100644 index b4973a1..0000000 --- a/okrmng/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "okrmng" -version = "0.1.0" -edition = "2024" - -[dependencies] -anyhow = "1.0.100" -clap = { version = "4.5.51", features = ["derive"] } -serde = { version = "1.0.228", features = ["derive"] } -toml = "0.9.8" diff --git a/okrmng/src/cli.rs b/okrmng/src/cli.rs deleted file mode 100644 index 2a4b040..0000000 --- a/okrmng/src/cli.rs +++ /dev/null @@ -1,93 +0,0 @@ -use std::fs; - -use anyhow::{Context, Result}; -use clap::{Parser, Subcommand}; - -use crate::{config, defs::CONFIG_PATH}; - -#[derive(Parser)] -#[command(author, version = "0.1", about, long_about = None)] -struct Args { - #[command(subcommand)] - command: Commands, -} - -#[derive(Subcommand)] -enum SystemApp { - Add { - #[arg(long, short)] - package: String, - }, - Rm { - #[arg(long, short)] - package: String, - }, -} - -#[derive(Subcommand)] -enum PrivApp { - Add { - #[arg(long, short)] - package: String, - }, - Rm { - #[arg(long, short)] - package: String, - }, -} - -#[derive(Subcommand)] -enum Commands { - SystemApp { - #[command(subcommand)] - command: SystemApp, - }, - PrivApp { - #[command(subcommand)] - command: PrivApp, - }, -} - -pub fn run() -> Result<()> { - let args = Args::parse(); - let mut config = config::Config::new()?; - - match args.command { - Commands::PrivApp { command } => { - println!("setting priv-app"); - - match command { - PrivApp::Add { package } => { - config.app.priv_app.insert(package); - println!("added new package"); - } - PrivApp::Rm { package } => { - config.app.priv_app.remove(&package); - println!("removed package"); - } - } - } - Commands::SystemApp { command } => { - println!("setting system-app"); - - - match command { - SystemApp::Add { package } => { - config.app.system_app.insert(package); - println!("added new package"); - } - SystemApp::Rm { package } => { - config.app.system_app.remove(&package); - println!("removed package"); - } - } - } - } - - fs::write( - CONFIG_PATH, - toml::to_string(&config).context("Failed to change config")?, - )?; - - Ok(()) -} diff --git a/okrmng/src/config.rs b/okrmng/src/config.rs deleted file mode 100644 index 58b73a4..0000000 --- a/okrmng/src/config.rs +++ /dev/null @@ -1,29 +0,0 @@ -use std::{collections::HashSet, fs, path::Path}; - -use anyhow::Result; -use serde::{Deserialize, Serialize}; - -use crate::defs::CONFIG_PATH; - -#[derive(Debug, Clone, Deserialize, Serialize)] -pub struct Config { - pub app: App, -} - -#[derive(Debug, Clone, Deserialize, Serialize)] -pub struct App { - pub system_app: HashSet, - pub priv_app: HashSet, -} - -impl Config { - pub fn new() -> Result { - let config = Path::new(CONFIG_PATH); - if !config.exists() { - panic!("config file is no exists!!"); - } - let buf = fs::read_to_string(config)?; - let toml: Self = toml::from_str(buf.as_str())?; - Ok(Self { app: toml.app }) - } -} diff --git a/okrmng/src/defs.rs b/okrmng/src/defs.rs deleted file mode 100644 index d076a52..0000000 --- a/okrmng/src/defs.rs +++ /dev/null @@ -1 +0,0 @@ -pub const CONFIG_PATH: &str = "/data/adb/modules/oukaro_manager/config.toml"; diff --git a/okrmng/src/main.rs b/okrmng/src/main.rs deleted file mode 100644 index a23682f..0000000 --- a/okrmng/src/main.rs +++ /dev/null @@ -1,12 +0,0 @@ -mod cli; -mod config; -mod defs; - -fn main() { - cli::run().unwrap_or_else(|e| { - for c in e.chain() { - eprintln!("{c:#?}"); - } - eprintln!("{:#?}", e.backtrace()); - }); -} diff --git a/oukaro/.gitignore b/oukaro/.gitignore deleted file mode 100644 index 9f97022..0000000 --- a/oukaro/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/ \ No newline at end of file diff --git a/oukaro/src/config.rs b/src/config.rs similarity index 100% rename from oukaro/src/config.rs rename to src/config.rs diff --git a/oukaro/src/defs.rs b/src/defs.rs similarity index 100% rename from oukaro/src/defs.rs rename to src/defs.rs diff --git a/oukaro/src/main.rs b/src/main.rs similarity index 100% rename from oukaro/src/main.rs rename to src/main.rs diff --git a/oukaro/src/utils.rs b/src/utils.rs similarity index 100% rename from oukaro/src/utils.rs rename to src/utils.rs