add branch init script
This commit is contained in:
parent
a87d458001
commit
7c3dbff13e
@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"name": "kernel-cachyos",
|
"name": "kernel-cachyos",
|
||||||
"db_url": "https://raw.githubusercontent.com/CosmicFusion/fedora-kernel-manager/main/data/db_kernel_cachy.json",
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Binary file not shown.
@ -20,6 +20,7 @@ pub fn build_ui(app: &adw::Application) {
|
|||||||
name: "?".to_owned(),
|
name: "?".to_owned(),
|
||||||
db_url: "?".to_owned(),
|
db_url: "?".to_owned(),
|
||||||
db: "?".to_owned(),
|
db: "?".to_owned(),
|
||||||
|
init_script: "?".to_owned(),
|
||||||
}));
|
}));
|
||||||
let db_load_complete = Rc::new(RefCell::new(false));
|
let db_load_complete = Rc::new(RefCell::new(false));
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ pub fn create_kernel_badge(
|
|||||||
fn get_kernel_branches() -> Vec<KernelBranch> {
|
fn get_kernel_branches() -> Vec<KernelBranch> {
|
||||||
let mut kernel_branches_array: Vec<KernelBranch> = Vec::new();
|
let mut kernel_branches_array: Vec<KernelBranch> = Vec::new();
|
||||||
let data = fs::read_to_string(
|
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");
|
.expect("Unable to read file");
|
||||||
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
||||||
@ -372,6 +372,7 @@ fn get_kernel_branches() -> Vec<KernelBranch> {
|
|||||||
let branch = KernelBranch {
|
let branch = KernelBranch {
|
||||||
name: branch["name"].as_str().to_owned().unwrap().to_string(),
|
name: branch["name"].as_str().to_owned().unwrap().to_string(),
|
||||||
db_url: branch["db_url"].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(
|
db: reqwest::blocking::get(
|
||||||
branch["db_url"].as_str().to_owned().unwrap().to_string(),
|
branch["db_url"].as_str().to_owned().unwrap().to_string(),
|
||||||
)
|
)
|
||||||
@ -380,6 +381,8 @@ fn get_kernel_branches() -> Vec<KernelBranch> {
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
};
|
};
|
||||||
println!("Download Complete!");
|
println!("Download Complete!");
|
||||||
|
println!("Running {} init script.", &branch.name);
|
||||||
|
let _ = cmd!(&branch.init_script).run();
|
||||||
kernel_branches_array.push(branch)
|
kernel_branches_array.push(branch)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -26,6 +26,7 @@ struct KernelBranch {
|
|||||||
name: String,
|
name: String,
|
||||||
db_url: String,
|
db_url: String,
|
||||||
db: String,
|
db: String,
|
||||||
|
init_script: String
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> glib::ExitCode {
|
fn main() -> glib::ExitCode {
|
||||||
|
@ -226,7 +226,7 @@ fn scx_sched_expandable(expander_row: &adw::ExpanderRow,
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
let data = fs::read_to_string(
|
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");
|
.expect("Unable to read file");
|
||||||
let res: serde_json::Value = serde_json::from_str(&data).expect("Unable to parse");
|
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_group: >k::SizeGroup,
|
||||||
kernel_badges_size_group0: >k::SizeGroup,
|
kernel_badges_size_group0: >k::SizeGroup,
|
||||||
kernel_badges_size_group1: >k::SizeGroup,) -> Result<(), io::Error> {
|
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(
|
create_current_sched_badge(
|
||||||
&badge_box,
|
&badge_box,
|
||||||
&get_running_kernel_info(),
|
&get_running_kernel_info(),
|
||||||
|
Loading…
Reference in New Issue
Block a user