diff --git a/data/kernel_branches.json b/data/kernel_branches.json index b800ed2..2b8c193 100644 --- a/data/kernel_branches.json +++ b/data/kernel_branches.json @@ -3,7 +3,7 @@ { "name": "kernel-cachyos", "db_url": "https://raw.githubusercontent.com/CosmicFusion/fedora-kernel-manager/main/data/db_kernel_cachy.json", - "init_script": "" + "init_script": "pkexec /usr/lib/fedora-kernel-manager/scripts/kernel-cachyos-init.sh" } ] } \ No newline at end of file diff --git a/data/scripts/core b/data/scripts/core deleted file mode 100644 index d599a76..0000000 Binary files a/data/scripts/core and /dev/null differ diff --git a/src/build_ui/mod.rs b/src/build_ui/mod.rs index 1989faf..ad01ac6 100644 --- a/src/build_ui/mod.rs +++ b/src/build_ui/mod.rs @@ -20,6 +20,7 @@ pub fn build_ui(app: &adw::Application) { name: "?".to_owned(), db_url: "?".to_owned(), db: "?".to_owned(), + init_script: "?".to_owned(), })); let db_load_complete = Rc::new(RefCell::new(false)); diff --git a/src/content/mod.rs b/src/content/mod.rs index 0adc355..065c94c 100644 --- a/src/content/mod.rs +++ b/src/content/mod.rs @@ -359,7 +359,7 @@ pub fn create_kernel_badge( fn get_kernel_branches() -> Vec { let mut kernel_branches_array: Vec = Vec::new(); let data = fs::read_to_string( - "/home/ward/RustroverProjects/fedora-kernel-manager/data/kernel_branches.json", + "/usr/lib/fedora-kernel-manager/kernel_branches.json", ) .expect("Unable to read file"); let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse"); @@ -372,6 +372,7 @@ fn get_kernel_branches() -> Vec { let branch = KernelBranch { name: branch["name"].as_str().to_owned().unwrap().to_string(), db_url: branch["db_url"].as_str().to_owned().unwrap().to_string(), + init_script: branch["init_script"].as_str().to_owned().unwrap().to_string(), db: reqwest::blocking::get( branch["db_url"].as_str().to_owned().unwrap().to_string(), ) @@ -380,6 +381,8 @@ fn get_kernel_branches() -> Vec { .unwrap(), }; println!("Download Complete!"); + println!("Running {} init script.", &branch.name); + let _ = cmd!(&branch.init_script).run(); kernel_branches_array.push(branch) } }; diff --git a/src/main.rs b/src/main.rs index bb009bb..891bd97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,7 @@ struct KernelBranch { name: String, db_url: String, db: String, + init_script: String } fn main() -> glib::ExitCode { diff --git a/src/sched_ext/mod.rs b/src/sched_ext/mod.rs index 96a8c1a..f443680 100644 --- a/src/sched_ext/mod.rs +++ b/src/sched_ext/mod.rs @@ -226,7 +226,7 @@ fn scx_sched_expandable(expander_row: &adw::ExpanderRow, .build(); let data = fs::read_to_string( - "/home/ward/RustroverProjects/fedora-kernel-manager/data/scx_scheds.json", + "/usr/lib/fedora-kernel-manager/scx_scheds.json", ) .expect("Unable to read file"); let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse"); @@ -307,7 +307,7 @@ fn change_scx_scheduler(scx_sched: &str, kernel_badges_size_group: >k::SizeGroup, kernel_badges_size_group0: >k::SizeGroup, kernel_badges_size_group1: >k::SizeGroup,) -> Result<(), io::Error> { - cmd!("pkexec", "bash", "-c", format!("/home/ward/RustroverProjects/fedora-kernel-manager/data/scripts/change_scx.sh {}", scx_sched)).run()?; + cmd!("pkexec", "bash", "-c", format!("/usr/lib/fedora-kernel-manager/scripts/scripts/change_scx.sh {}", scx_sched)).run()?; create_current_sched_badge( &badge_box, &get_running_kernel_info(),