From e009ef066c25bea93f8725b571dc04adf7f55793 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 00:20:36 -0600 Subject: [PATCH 01/26] allow different os-releases and hypr setup --- core/src/inner.rs | 16 +++++-- core/tabs/system-setup/arch/hyprland-kool.sh | 12 +++++ .../system-setup/debian/hyprland-kool-deb.sh | 7 +++ .../system-setup/fedora/hyprland-kool-fed.sh | 6 +++ core/tabs/system-setup/tab_data.toml | 46 +++++++++++++++++++ .../ubuntu/hyprland-kool-ubuntu24.sh | 7 +++ 6 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 core/tabs/system-setup/arch/hyprland-kool.sh create mode 100644 core/tabs/system-setup/debian/hyprland-kool-deb.sh create mode 100644 core/tabs/system-setup/fedora/hyprland-kool-fed.sh create mode 100644 core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh diff --git a/core/src/inner.rs b/core/src/inner.rs index a3a0fc9ce..fda703b8f 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -132,14 +132,15 @@ impl Entry { match data { SystemDataType::Environment(var_name) => std::env::var(var_name) .is_ok_and(|var| values.contains(&var) == *matches), - SystemDataType::File(path) => { - std::fs::read_to_string(path).is_ok_and(|data| { - values.iter().all(|matching| data.contains(matching)) == *matches - }) - } + SystemDataType::File(path) => path.exists() == *matches, SystemDataType::CommandExists => values .iter() .all(|command| which::which(command).is_ok() == *matches), + SystemDataType::FileContains { file, contains } => { + std::fs::read_to_string(file) + .map(|content| content.contains(contains) == *matches) + .unwrap_or(false) + } } }, ) @@ -164,6 +165,11 @@ enum SystemDataType { File(PathBuf), #[serde(rename = "command_exists")] CommandExists, + #[serde(untagged)] + FileContains { + file: PathBuf, + contains: String, + }, } fn filter_entries(entries: &mut Vec) { diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh new file mode 100644 index 000000000..0773f77a6 --- /dev/null +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Check if base-devel is installed, install if not +if ! pacman -Q base-devel &>/dev/null; then + echo "Installing base-devel..." + sudo pacman -S --noconfirm base-devel +fi + +git clone --depth=1 https://github.com/JaKooLit/Arch-Hyprland.git ~/Arch-Hyprland +cd ~/Arch-Hyprland +chmod +x install.sh +./install.sh diff --git a/core/tabs/system-setup/debian/hyprland-kool-deb.sh b/core/tabs/system-setup/debian/hyprland-kool-deb.sh new file mode 100644 index 000000000..9a64ad723 --- /dev/null +++ b/core/tabs/system-setup/debian/hyprland-kool-deb.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Hyprland Kool" +git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git ~/Debian-Hyprland +cd ~/Debian-Hyprland +chmod +x install.sh +./install.sh \ No newline at end of file diff --git a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh new file mode 100644 index 000000000..dc11e670d --- /dev/null +++ b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +git clone --depth=1 https://github.com/JaKooLit/Fedora-Hyprland.git ~/Fedora-Hyprland +cd ~/Fedora-Hyprland +chmod +x install.sh +./install.sh \ No newline at end of file diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 9f80eec04..4025068c3 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -15,6 +15,13 @@ script = "arch/server-setup.sh" task_list = "SI D" multi_select = false +[[data.entries]] +name = "Hyprland Kool" +description = "This script is designed to handle the installation and configuration of Hyprland Kool" +script = "arch/hyprland-kool.sh" +task_list = "I MP" +multi_select = false + [[data.entries]] name ="Linux Neptune for SteamDeck" description = "Valve's fork of Linux Kernel for the SteamDeck" @@ -50,6 +57,20 @@ description = "Yet Another Yogurt - An AUR Helper Written in Go. To know more ab script = "arch/yay-setup.sh" task_list = "I" +[[data]] +name = "Debian" + +[[data.preconditions]] +matches = true +data = { file = "/etc/os-release", contains = "ID=debian" } +values = [] + +[[data.entries]] +name = "Hyprland Kool" +description = "This script is designed to handle the installation and configuration of Hyprland Kool" +script = "debian/hyprland-kool-deb.sh" +task_list = "I MP" + [[data]] name = "Fedora" @@ -64,6 +85,12 @@ description = "Optimizes DNF for parallel downloads" script = "fedora/configure-dnf.sh" task_list = "PFM" +[[data.entries]] +name = "Hyprland Kool" +description = "This script is designed to handle the installation and configuration of Hyprland Kool" +script = "fedora/hyprland-kool-fed.sh" +task_list = "I MP" + [[data.entries]] name = "Multimedia Codecs" description = "This script is designed to install multimedia codecs, and to ensure RPM Fusion repositories are installed." @@ -105,6 +132,25 @@ matches = true data = "command_exists" values = [ "btrfs" ] +[[data]] +name = "Ubuntu" + +[[data.preconditions]] +matches = true +data = { file = "/etc/os-release", contains = "ID=ubuntu" } +values = [] + +[[data.entries]] +name = "Hyprland Kool" +description = "This script is designed to handle the installation and configuration of Hyprland Kool" +script = "ubuntu/hyprland-kool-ubuntu24.sh" +task_list = "I MP" + +[[data.preconditions]] +matches = true +data = { file = "/etc/os-release", contains = 'VERSION_ID="24.04"' } +values = [] + [[data]] name = "Build Prerequisites" description = "This script is designed to handle the installation of various software dependencies across different Linux distributions" diff --git a/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh new file mode 100644 index 000000000..126d7ea3e --- /dev/null +++ b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Hyprland Kool" +git clone -b 24.04 --depth=1 https://github.com/JaKooLit/Ubuntu-Hyprland.git ~/Ubuntu-Hyprland-24.04 +cd ~/Ubuntu-Hyprland-24.04 +chmod +x install.sh +./install.sh \ No newline at end of file From 4b72e84b8db824ad36da797783d5359f89bf76f1 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:19:39 -0600 Subject: [PATCH 02/26] Update core/src/inner.rs Co-authored-by: Adam Perkowski --- core/src/inner.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/inner.rs b/core/src/inner.rs index fda703b8f..91ceb3f1f 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -166,10 +166,7 @@ enum SystemDataType { #[serde(rename = "command_exists")] CommandExists, #[serde(untagged)] - FileContains { - file: PathBuf, - contains: String, - }, + FileContains { file: PathBuf, contains: String }, } fn filter_entries(entries: &mut Vec) { From fc6acb256624edcbe78056a86a9650565fc24766 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:19:44 -0600 Subject: [PATCH 03/26] Update core/tabs/system-setup/debian/hyprland-kool-deb.sh Co-authored-by: Adam Perkowski --- core/tabs/system-setup/debian/hyprland-kool-deb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/debian/hyprland-kool-deb.sh b/core/tabs/system-setup/debian/hyprland-kool-deb.sh index 9a64ad723..908c05978 100644 --- a/core/tabs/system-setup/debian/hyprland-kool-deb.sh +++ b/core/tabs/system-setup/debian/hyprland-kool-deb.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo "Hyprland Kool" +echo "Hyprland JaKooLit" git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git ~/Debian-Hyprland cd ~/Debian-Hyprland chmod +x install.sh From 45d299532b4ec835f8cfca359a258e32d4267877 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:19:53 -0600 Subject: [PATCH 04/26] Update core/tabs/system-setup/arch/hyprland-kool.sh Co-authored-by: Adam Perkowski --- core/tabs/system-setup/arch/hyprland-kool.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index 0773f77a6..7f83cccf2 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -1,6 +1,7 @@ #!/bin/bash -# Check if base-devel is installed, install if not +echo "Hyprland JaKooLit" + if ! pacman -Q base-devel &>/dev/null; then echo "Installing base-devel..." sudo pacman -S --noconfirm base-devel From b6bb2273dbd6dfa5d6fc765d704cf441b20e9e0f Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:19:59 -0600 Subject: [PATCH 05/26] Update core/tabs/system-setup/fedora/hyprland-kool-fed.sh Co-authored-by: Adam Perkowski --- core/tabs/system-setup/fedora/hyprland-kool-fed.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh index dc11e670d..9cbd7ccd2 100644 --- a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh +++ b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo "Hyprland JaKooLit" + git clone --depth=1 https://github.com/JaKooLit/Fedora-Hyprland.git ~/Fedora-Hyprland cd ~/Fedora-Hyprland chmod +x install.sh From 5391ade6d2ca30d2341cdeaf614d3b5301a3a398 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:20:06 -0600 Subject: [PATCH 06/26] Update core/tabs/system-setup/tab_data.toml Co-authored-by: Adam Perkowski --- core/tabs/system-setup/tab_data.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 4025068c3..ebd66c291 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -66,8 +66,8 @@ data = { file = "/etc/os-release", contains = "ID=debian" } values = [] [[data.entries]] -name = "Hyprland Kool" -description = "This script is designed to handle the installation and configuration of Hyprland Kool" +name = "Hyprland JaKooLit" +description = "Install JaKooLit's Hyprland configuration" script = "debian/hyprland-kool-deb.sh" task_list = "I MP" From 63e0b82cfb7c7ddd81275e64c9167e947897cc1d Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:20:18 -0600 Subject: [PATCH 07/26] Update core/tabs/system-setup/tab_data.toml Co-authored-by: Adam Perkowski --- core/tabs/system-setup/tab_data.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index ebd66c291..4e71261f2 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -16,8 +16,8 @@ task_list = "SI D" multi_select = false [[data.entries]] -name = "Hyprland Kool" -description = "This script is designed to handle the installation and configuration of Hyprland Kool" +name = "Hyprland JaKooLit" +description = "Install JaKooLit's Hyprland configuration" script = "arch/hyprland-kool.sh" task_list = "I MP" multi_select = false From b977560de32a290db6a2a51fb0d8a6804b8b24ee Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:20:25 -0600 Subject: [PATCH 08/26] Update core/tabs/system-setup/tab_data.toml Co-authored-by: Adam Perkowski --- core/tabs/system-setup/tab_data.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 4e71261f2..f4308e2fc 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -86,8 +86,8 @@ script = "fedora/configure-dnf.sh" task_list = "PFM" [[data.entries]] -name = "Hyprland Kool" -description = "This script is designed to handle the installation and configuration of Hyprland Kool" +name = "Hyprland JaKooLit" +description = "Install JaKooLit's Hyprland configuration" script = "fedora/hyprland-kool-fed.sh" task_list = "I MP" From f8900e47f452f1f2dc68dd3cd520cdcf39e7a0fe Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:20:32 -0600 Subject: [PATCH 09/26] Update core/tabs/system-setup/tab_data.toml Co-authored-by: Adam Perkowski --- core/tabs/system-setup/tab_data.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index f4308e2fc..29015bda9 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -141,8 +141,8 @@ data = { file = "/etc/os-release", contains = "ID=ubuntu" } values = [] [[data.entries]] -name = "Hyprland Kool" -description = "This script is designed to handle the installation and configuration of Hyprland Kool" +name = "Hyprland JaKooLit" +description = "Install JaKooLit's Hyprland configuration" script = "ubuntu/hyprland-kool-ubuntu24.sh" task_list = "I MP" From a7766820d2a577e750f1f9553f4dc320a559d5a9 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sun, 2 Feb 2025 12:20:39 -0600 Subject: [PATCH 10/26] Update core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh Co-authored-by: Adam Perkowski --- core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh index 126d7ea3e..23b8dc0d1 100644 --- a/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh +++ b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh @@ -1,6 +1,7 @@ #!/bin/bash -echo "Hyprland Kool" +echo "Hyprland JaKooLit" + git clone -b 24.04 --depth=1 https://github.com/JaKooLit/Ubuntu-Hyprland.git ~/Ubuntu-Hyprland-24.04 cd ~/Ubuntu-Hyprland-24.04 chmod +x install.sh From c1735964060c7177aea2b535312028e55aa57733 Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Tue, 4 Feb 2025 12:40:45 -0600 Subject: [PATCH 11/26] refactor: Improve File Contains precondition (#1016) --- core/src/inner.rs | 26 +++++++++++--------------- core/tabs/system-setup/tab_data.toml | 20 ++++++++++---------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/core/src/inner.rs b/core/src/inner.rs index 91ceb3f1f..16d12cbe1 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -111,12 +111,10 @@ fn default_true() -> bool { } #[derive(Deserialize)] +#[serde(rename_all = "snake_case")] enum EntryType { - #[serde(rename = "entries")] Entries(Vec), - #[serde(rename = "command")] Command(String), - #[serde(rename = "script")] Script(PathBuf), } @@ -132,15 +130,16 @@ impl Entry { match data { SystemDataType::Environment(var_name) => std::env::var(var_name) .is_ok_and(|var| values.contains(&var) == *matches), - SystemDataType::File(path) => path.exists() == *matches, + SystemDataType::ContainingFile(file) => std::fs::read_to_string(file) + .is_ok_and(|data| { + values + .iter() + .all(|matching| data.contains(matching) == *matches) + }), SystemDataType::CommandExists => values .iter() .all(|command| which::which(command).is_ok() == *matches), - SystemDataType::FileContains { file, contains } => { - std::fs::read_to_string(file) - .map(|content| content.contains(contains) == *matches) - .unwrap_or(false) - } + SystemDataType::FileExists => values.iter().all(|p| Path::new(p).is_file()), } }, ) @@ -158,15 +157,12 @@ struct Precondition { } #[derive(Deserialize)] +#[serde(rename_all = "snake_case")] enum SystemDataType { - #[serde(rename = "environment")] Environment(String), - #[serde(rename = "file")] - File(PathBuf), - #[serde(rename = "command_exists")] + ContainingFile(PathBuf), + FileExists, CommandExists, - #[serde(untagged)] - FileContains { file: PathBuf, contains: String }, } fn filter_entries(entries: &mut Vec) { diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 29015bda9..51aa47459 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -23,15 +23,15 @@ task_list = "I MP" multi_select = false [[data.entries]] -name ="Linux Neptune for SteamDeck" +name = "Linux Neptune for SteamDeck" description = "Valve's fork of Linux Kernel for the SteamDeck" script = "arch/linux-neptune.sh" task_list = "I PFM K" [[data.entries.preconditions]] matches = true -data = { file = "/sys/devices/virtual/dmi/id/board_vendor" } -values = [ "Valve" ] +data = { containing_file = "/sys/devices/virtual/dmi/id/board_vendor" } +values = ["Valve"] [[data.entries]] name = "Nvidia Drivers && Hardware Acceleration" @@ -62,8 +62,8 @@ name = "Debian" [[data.preconditions]] matches = true -data = { file = "/etc/os-release", contains = "ID=debian" } -values = [] +data = { containing_file = "/etc/os-release" } +values = ["ID=debian"] [[data.entries]] name = "Hyprland JaKooLit" @@ -130,15 +130,15 @@ task_list = "I PFM SS" [[data.preconditions]] matches = true data = "command_exists" -values = [ "btrfs" ] +values = ["btrfs"] [[data]] name = "Ubuntu" [[data.preconditions]] matches = true -data = { file = "/etc/os-release", contains = "ID=ubuntu" } -values = [] +data = { containing_file = "/etc/os-release" } +values = ["ID=ubuntu"] [[data.entries]] name = "Hyprland JaKooLit" @@ -148,8 +148,8 @@ task_list = "I MP" [[data.preconditions]] matches = true -data = { file = "/etc/os-release", contains = 'VERSION_ID="24.04"' } -values = [] +data = { containing_file = "/etc/os-release" } +values = ['VERSION_ID="24.04"'] [[data]] name = "Build Prerequisites" From d872d84aaf27af325be061e0a7d08b6593bdfc75 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 4 Feb 2025 12:49:31 -0600 Subject: [PATCH 12/26] Update inner.rs (#1021) --- core/src/inner.rs | 311 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 300 insertions(+), 11 deletions(-) diff --git a/core/src/inner.rs b/core/src/inner.rs index 16d12cbe1..cda6571f8 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -111,10 +111,12 @@ fn default_true() -> bool { } #[derive(Deserialize)] -#[serde(rename_all = "snake_case")] enum EntryType { + #[serde(rename = "entries")] Entries(Vec), + #[serde(rename = "command")] Command(String), + #[serde(rename = "script")] Script(PathBuf), } @@ -130,16 +132,14 @@ impl Entry { match data { SystemDataType::Environment(var_name) => std::env::var(var_name) .is_ok_and(|var| values.contains(&var) == *matches), - SystemDataType::ContainingFile(file) => std::fs::read_to_string(file) - .is_ok_and(|data| { - values - .iter() - .all(|matching| data.contains(matching) == *matches) - }), + SystemDataType::File(path) => { + std::fs::read_to_string(path).is_ok_and(|data| { + values.iter().all(|matching| data.contains(matching)) == *matches + }) + } SystemDataType::CommandExists => values .iter() .all(|command| which::which(command).is_ok() == *matches), - SystemDataType::FileExists => values.iter().all(|p| Path::new(p).is_file()), } }, ) @@ -157,11 +157,300 @@ struct Precondition { } #[derive(Deserialize)] -#[serde(rename_all = "snake_case")] enum SystemDataType { + #[serde(rename = "environment")] Environment(String), - ContainingFile(PathBuf), - FileExists, + #[serde(rename = "file")] + File(PathBuf), + #[serde(rename = "command_exists")] + CommandExists, +} + +fn filter_entries(entries: &mut Vec) { + entries.retain_mut(|entry| { + if !entry.is_supported() { + return false; + } + if let EntryType::Entries(entries) = &mut entry.entry_type { + filter_entries(entries); + !entries.is_empty() + } else { + true + } + }); +} + +fn create_directory( + data: Vec, + node: &mut NodeMut>, + command_dir: &Path, + validate: bool, + parent_multi_select: bool, +) { + for entry in data { + let multi_select = parent_multi_select && entry.multi_select; + + match entry.entry_type { + EntryType::Entries(entries) => { + let mut node = node.append(Rc::new(ListNode { + name: entry.name, + description: entry.description, + command: Command::None, + task_list: String::new(), + multi_select, + })); + create_directory(entries, &mut node, command_dir, validate, multi_select); + } + EntryType::Command(command) => { + node.append(Rc::new(ListNode { + name: entry.name, + description: entry.description, + command: Command::Raw(command), + task_list: String::new(), + multi_select, + })); + } + EntryType::Script(script) => { + let script = command_dir.join(script); + if !script.exists() { + panic!("Script {} does not exist", script.display()); + } + + if let Some((executable, args)) = get_shebang(&script, validate) { + node.append(Rc::new(ListNode { + name: entry.name, + description: entry.description, + command: Command::LocalFile { + executable, + args, + file: script, + }, + task_list: entry.task_list, + multi_select, + })); + } + } + } + } +} + +fn get_shebang(script_path: &Path, validate: bool) -> Option<(String, Vec)> { + let default_executable = || Some(("/bin/sh".into(), vec!["-e".into()])); + + let script = File::open(script_path).expect("Failed to open script file"); + let mut reader = BufReader::new(script); + + // Take the first 2 characters from the reader; check whether it's a shebang + let mut two_chars = [0; 2]; + if reader.read_exact(&mut two_chars).is_err() || two_chars != *b"#!" { + return default_executable(); + } + + let first_line = reader.lines().next().unwrap().unwrap(); + + let mut parts = first_line.split_whitespace(); + + let Some(executable) = parts.next() else { + return default_executable(); + }; + + let is_valid = !validate || is_executable(Path::new(executable)); + + is_valid.then(|| { + let mut args: Vec = parts.map(ToString::to_string).collect(); + args.push(script_path.to_string_lossy().to_string()); + (executable.to_string(), args) + }) +} + +fn is_executable(path: &Path) -> bool { + path.metadata() + .map(|metadata| metadata.is_file() && metadata.permissions().mode() & 0o111 != 0) + .unwrap_or(false) +} + +impl TabDirectories { + fn get_tabs() -> (TempDir, Vec) { + let temp_dir = TempDir::with_prefix("linutil_scripts").unwrap(); + TAB_DATA + .extract(&temp_dir) + .expect("Failed to extract the saved directory"); + + let tab_files = std::fs::read_to_string(temp_dir.path().join("tabs.toml")) + .expect("Failed to read tabs.toml"); + let data: Self = toml::from_str(&tab_files).expect("Failed to parse tabs.toml"); + let tab_paths = data + .directories + .iter() + .map(|path| temp_dir.path().join(path).join("tab_data.toml")) + .collect(); + (temp_dir, tab_paths) + } +}use crate::{Command, ListNode, Tab}; +use ego_tree::{NodeMut, Tree}; +use include_dir::{include_dir, Dir}; +use serde::Deserialize; +use std::{ + fs::File, + io::{BufRead, BufReader, Read}, + ops::{Deref, DerefMut}, + os::unix::fs::PermissionsExt, + path::{Path, PathBuf}, + rc::Rc, +}; +use temp_dir::TempDir; + +const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs"); + +// Allow the unused TempDir to be stored for later destructor call +#[allow(dead_code)] +pub struct TabList(pub Vec, TempDir); + +// Implement deref to allow Vec methods to be called on TabList +impl Deref for TabList { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl DerefMut for TabList { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl IntoIterator for TabList { + type Item = Tab; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } +} + +pub fn get_tabs(validate: bool) -> TabList { + let (temp_dir, tab_files) = TabDirectories::get_tabs(); + + let tabs: Vec<_> = tab_files + .into_iter() + .map(|path| { + let directory = path.parent().unwrap().to_owned(); + let data = std::fs::read_to_string(path).expect("Failed to read tab data"); + let mut tab_data: TabEntry = toml::from_str(&data).expect("Failed to parse tab data"); + + if validate { + filter_entries(&mut tab_data.data); + } + (tab_data, directory) + }) + .collect(); + + let tabs: Vec = tabs + .into_iter() + .map(|(TabEntry { name, data }, directory)| { + let mut tree = Tree::new(Rc::new(ListNode { + name: "root".to_string(), + description: String::new(), + command: Command::None, + task_list: String::new(), + multi_select: false, + })); + let mut root = tree.root_mut(); + create_directory(data, &mut root, &directory, validate, true); + Tab { name, tree } + }) + .collect(); + + if tabs.is_empty() { + panic!("No tabs found"); + } + TabList(tabs, temp_dir) +} + +#[derive(Deserialize)] +struct TabDirectories { + directories: Vec, +} + +#[derive(Deserialize)] +struct TabEntry { + name: String, + data: Vec, +} + +#[derive(Deserialize)] +struct Entry { + name: String, + #[allow(dead_code)] + #[serde(default)] + description: String, + #[serde(default)] + preconditions: Option>, + #[serde(flatten)] + entry_type: EntryType, + #[serde(default)] + task_list: String, + #[serde(default = "default_true")] + multi_select: bool, +} + +fn default_true() -> bool { + true +} + +#[derive(Deserialize)] +enum EntryType { + #[serde(rename = "entries")] + Entries(Vec), + #[serde(rename = "command")] + Command(String), + #[serde(rename = "script")] + Script(PathBuf), +} + +impl Entry { + fn is_supported(&self) -> bool { + self.preconditions.as_deref().map_or(true, |preconditions| { + preconditions.iter().all( + |Precondition { + matches, + data, + values, + }| { + match data { + SystemDataType::Environment(var_name) => std::env::var(var_name) + .is_ok_and(|var| values.contains(&var) == *matches), + SystemDataType::File(path) => { + std::fs::read_to_string(path).is_ok_and(|data| { + values.iter().all(|matching| data.contains(matching)) == *matches + }) + } + SystemDataType::CommandExists => values + .iter() + .all(|command| which::which(command).is_ok() == *matches), + } + }, + ) + }) + } +} + +#[derive(Deserialize)] +struct Precondition { + // If true, the data must be contained within the list of values. + // Otherwise, the data must not be contained within the list of values + matches: bool, + data: SystemDataType, + values: Vec, +} + +#[derive(Deserialize)] +enum SystemDataType { + #[serde(rename = "environment")] + Environment(String), + #[serde(rename = "file")] + File(PathBuf), + #[serde(rename = "command_exists")] CommandExists, } From 599ad20c7aa1692680bf5a41850c0d7230005cfd Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 4 Feb 2025 12:50:45 -0600 Subject: [PATCH 13/26] Update inner.rs (#1022) --- core/src/inner.rs | 288 ---------------------------------------------- 1 file changed, 288 deletions(-) diff --git a/core/src/inner.rs b/core/src/inner.rs index cda6571f8..a3a0fc9ce 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -269,294 +269,6 @@ fn is_executable(path: &Path) -> bool { .unwrap_or(false) } -impl TabDirectories { - fn get_tabs() -> (TempDir, Vec) { - let temp_dir = TempDir::with_prefix("linutil_scripts").unwrap(); - TAB_DATA - .extract(&temp_dir) - .expect("Failed to extract the saved directory"); - - let tab_files = std::fs::read_to_string(temp_dir.path().join("tabs.toml")) - .expect("Failed to read tabs.toml"); - let data: Self = toml::from_str(&tab_files).expect("Failed to parse tabs.toml"); - let tab_paths = data - .directories - .iter() - .map(|path| temp_dir.path().join(path).join("tab_data.toml")) - .collect(); - (temp_dir, tab_paths) - } -}use crate::{Command, ListNode, Tab}; -use ego_tree::{NodeMut, Tree}; -use include_dir::{include_dir, Dir}; -use serde::Deserialize; -use std::{ - fs::File, - io::{BufRead, BufReader, Read}, - ops::{Deref, DerefMut}, - os::unix::fs::PermissionsExt, - path::{Path, PathBuf}, - rc::Rc, -}; -use temp_dir::TempDir; - -const TAB_DATA: Dir = include_dir!("$CARGO_MANIFEST_DIR/tabs"); - -// Allow the unused TempDir to be stored for later destructor call -#[allow(dead_code)] -pub struct TabList(pub Vec, TempDir); - -// Implement deref to allow Vec methods to be called on TabList -impl Deref for TabList { - type Target = Vec; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl DerefMut for TabList { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} -impl IntoIterator for TabList { - type Item = Tab; - type IntoIter = std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -pub fn get_tabs(validate: bool) -> TabList { - let (temp_dir, tab_files) = TabDirectories::get_tabs(); - - let tabs: Vec<_> = tab_files - .into_iter() - .map(|path| { - let directory = path.parent().unwrap().to_owned(); - let data = std::fs::read_to_string(path).expect("Failed to read tab data"); - let mut tab_data: TabEntry = toml::from_str(&data).expect("Failed to parse tab data"); - - if validate { - filter_entries(&mut tab_data.data); - } - (tab_data, directory) - }) - .collect(); - - let tabs: Vec = tabs - .into_iter() - .map(|(TabEntry { name, data }, directory)| { - let mut tree = Tree::new(Rc::new(ListNode { - name: "root".to_string(), - description: String::new(), - command: Command::None, - task_list: String::new(), - multi_select: false, - })); - let mut root = tree.root_mut(); - create_directory(data, &mut root, &directory, validate, true); - Tab { name, tree } - }) - .collect(); - - if tabs.is_empty() { - panic!("No tabs found"); - } - TabList(tabs, temp_dir) -} - -#[derive(Deserialize)] -struct TabDirectories { - directories: Vec, -} - -#[derive(Deserialize)] -struct TabEntry { - name: String, - data: Vec, -} - -#[derive(Deserialize)] -struct Entry { - name: String, - #[allow(dead_code)] - #[serde(default)] - description: String, - #[serde(default)] - preconditions: Option>, - #[serde(flatten)] - entry_type: EntryType, - #[serde(default)] - task_list: String, - #[serde(default = "default_true")] - multi_select: bool, -} - -fn default_true() -> bool { - true -} - -#[derive(Deserialize)] -enum EntryType { - #[serde(rename = "entries")] - Entries(Vec), - #[serde(rename = "command")] - Command(String), - #[serde(rename = "script")] - Script(PathBuf), -} - -impl Entry { - fn is_supported(&self) -> bool { - self.preconditions.as_deref().map_or(true, |preconditions| { - preconditions.iter().all( - |Precondition { - matches, - data, - values, - }| { - match data { - SystemDataType::Environment(var_name) => std::env::var(var_name) - .is_ok_and(|var| values.contains(&var) == *matches), - SystemDataType::File(path) => { - std::fs::read_to_string(path).is_ok_and(|data| { - values.iter().all(|matching| data.contains(matching)) == *matches - }) - } - SystemDataType::CommandExists => values - .iter() - .all(|command| which::which(command).is_ok() == *matches), - } - }, - ) - }) - } -} - -#[derive(Deserialize)] -struct Precondition { - // If true, the data must be contained within the list of values. - // Otherwise, the data must not be contained within the list of values - matches: bool, - data: SystemDataType, - values: Vec, -} - -#[derive(Deserialize)] -enum SystemDataType { - #[serde(rename = "environment")] - Environment(String), - #[serde(rename = "file")] - File(PathBuf), - #[serde(rename = "command_exists")] - CommandExists, -} - -fn filter_entries(entries: &mut Vec) { - entries.retain_mut(|entry| { - if !entry.is_supported() { - return false; - } - if let EntryType::Entries(entries) = &mut entry.entry_type { - filter_entries(entries); - !entries.is_empty() - } else { - true - } - }); -} - -fn create_directory( - data: Vec, - node: &mut NodeMut>, - command_dir: &Path, - validate: bool, - parent_multi_select: bool, -) { - for entry in data { - let multi_select = parent_multi_select && entry.multi_select; - - match entry.entry_type { - EntryType::Entries(entries) => { - let mut node = node.append(Rc::new(ListNode { - name: entry.name, - description: entry.description, - command: Command::None, - task_list: String::new(), - multi_select, - })); - create_directory(entries, &mut node, command_dir, validate, multi_select); - } - EntryType::Command(command) => { - node.append(Rc::new(ListNode { - name: entry.name, - description: entry.description, - command: Command::Raw(command), - task_list: String::new(), - multi_select, - })); - } - EntryType::Script(script) => { - let script = command_dir.join(script); - if !script.exists() { - panic!("Script {} does not exist", script.display()); - } - - if let Some((executable, args)) = get_shebang(&script, validate) { - node.append(Rc::new(ListNode { - name: entry.name, - description: entry.description, - command: Command::LocalFile { - executable, - args, - file: script, - }, - task_list: entry.task_list, - multi_select, - })); - } - } - } - } -} - -fn get_shebang(script_path: &Path, validate: bool) -> Option<(String, Vec)> { - let default_executable = || Some(("/bin/sh".into(), vec!["-e".into()])); - - let script = File::open(script_path).expect("Failed to open script file"); - let mut reader = BufReader::new(script); - - // Take the first 2 characters from the reader; check whether it's a shebang - let mut two_chars = [0; 2]; - if reader.read_exact(&mut two_chars).is_err() || two_chars != *b"#!" { - return default_executable(); - } - - let first_line = reader.lines().next().unwrap().unwrap(); - - let mut parts = first_line.split_whitespace(); - - let Some(executable) = parts.next() else { - return default_executable(); - }; - - let is_valid = !validate || is_executable(Path::new(executable)); - - is_valid.then(|| { - let mut args: Vec = parts.map(ToString::to_string).collect(); - args.push(script_path.to_string_lossy().to_string()); - (executable.to_string(), args) - }) -} - -fn is_executable(path: &Path) -> bool { - path.metadata() - .map(|metadata| metadata.is_file() && metadata.permissions().mode() & 0o111 != 0) - .unwrap_or(false) -} - impl TabDirectories { fn get_tabs() -> (TempDir, Vec) { let temp_dir = TempDir::with_prefix("linutil_scripts").unwrap(); From 9e34347b5b9f52855d937fd3c73e378bfcab261b Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Tue, 4 Feb 2025 12:55:54 -0600 Subject: [PATCH 14/26] revert to liams commit --- core/src/inner.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/core/src/inner.rs b/core/src/inner.rs index a3a0fc9ce..16d12cbe1 100644 --- a/core/src/inner.rs +++ b/core/src/inner.rs @@ -111,12 +111,10 @@ fn default_true() -> bool { } #[derive(Deserialize)] +#[serde(rename_all = "snake_case")] enum EntryType { - #[serde(rename = "entries")] Entries(Vec), - #[serde(rename = "command")] Command(String), - #[serde(rename = "script")] Script(PathBuf), } @@ -132,14 +130,16 @@ impl Entry { match data { SystemDataType::Environment(var_name) => std::env::var(var_name) .is_ok_and(|var| values.contains(&var) == *matches), - SystemDataType::File(path) => { - std::fs::read_to_string(path).is_ok_and(|data| { - values.iter().all(|matching| data.contains(matching)) == *matches - }) - } + SystemDataType::ContainingFile(file) => std::fs::read_to_string(file) + .is_ok_and(|data| { + values + .iter() + .all(|matching| data.contains(matching) == *matches) + }), SystemDataType::CommandExists => values .iter() .all(|command| which::which(command).is_ok() == *matches), + SystemDataType::FileExists => values.iter().all(|p| Path::new(p).is_file()), } }, ) @@ -157,12 +157,11 @@ struct Precondition { } #[derive(Deserialize)] +#[serde(rename_all = "snake_case")] enum SystemDataType { - #[serde(rename = "environment")] Environment(String), - #[serde(rename = "file")] - File(PathBuf), - #[serde(rename = "command_exists")] + ContainingFile(PathBuf), + FileExists, CommandExists, } From b83cee7ef71fe2ef294948fad9c755febe3367b3 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:07:06 -0600 Subject: [PATCH 15/26] Update core/tabs/system-setup/arch/hyprland-kool.sh Co-authored-by: nyx --- core/tabs/system-setup/arch/hyprland-kool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index 7f83cccf2..d7206275a 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -8,6 +8,6 @@ if ! pacman -Q base-devel &>/dev/null; then fi git clone --depth=1 https://github.com/JaKooLit/Arch-Hyprland.git ~/Arch-Hyprland -cd ~/Arch-Hyprland +cd "$HOME/Arch-Hyprland" chmod +x install.sh ./install.sh From d69c4e1de85ad7b6bad87aef9f4297f9c6c0f8f1 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:07:15 -0600 Subject: [PATCH 16/26] Update core/tabs/system-setup/debian/hyprland-kool-deb.sh Co-authored-by: nyx --- core/tabs/system-setup/debian/hyprland-kool-deb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/debian/hyprland-kool-deb.sh b/core/tabs/system-setup/debian/hyprland-kool-deb.sh index 908c05978..e12d0e909 100644 --- a/core/tabs/system-setup/debian/hyprland-kool-deb.sh +++ b/core/tabs/system-setup/debian/hyprland-kool-deb.sh @@ -2,6 +2,6 @@ echo "Hyprland JaKooLit" git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git ~/Debian-Hyprland -cd ~/Debian-Hyprland +cd "$HOME/Debian-Hyprland" chmod +x install.sh ./install.sh \ No newline at end of file From 5731a9b855bb388c00f19014fc29d98d0df7bc60 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:07:23 -0600 Subject: [PATCH 17/26] Update core/tabs/system-setup/fedora/hyprland-kool-fed.sh Co-authored-by: nyx --- core/tabs/system-setup/fedora/hyprland-kool-fed.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh index 9cbd7ccd2..1ea2a977f 100644 --- a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh +++ b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh @@ -3,6 +3,6 @@ echo "Hyprland JaKooLit" git clone --depth=1 https://github.com/JaKooLit/Fedora-Hyprland.git ~/Fedora-Hyprland -cd ~/Fedora-Hyprland +cd "$HOME/Fedora-Hyprland" chmod +x install.sh ./install.sh \ No newline at end of file From ad05a0d4680d2f6b26102017919f752270469e0b Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:07:36 -0600 Subject: [PATCH 18/26] Update core/tabs/system-setup/arch/hyprland-kool.sh Co-authored-by: nyx --- core/tabs/system-setup/arch/hyprland-kool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index d7206275a..78a6fc04e 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -7,7 +7,7 @@ if ! pacman -Q base-devel &>/dev/null; then sudo pacman -S --noconfirm base-devel fi -git clone --depth=1 https://github.com/JaKooLit/Arch-Hyprland.git ~/Arch-Hyprland +git clone --depth=1 https://github.com/JaKooLit/Arch-Hyprland.git "$HOME/Arch-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Arch-Hyprland repo${RC}"; exit 1; } cd "$HOME/Arch-Hyprland" chmod +x install.sh ./install.sh From 7fa4d2dcf0f1abecdeea2033509f0f92335d9ad7 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:07:49 -0600 Subject: [PATCH 19/26] Update core/tabs/system-setup/debian/hyprland-kool-deb.sh Co-authored-by: nyx --- core/tabs/system-setup/debian/hyprland-kool-deb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/debian/hyprland-kool-deb.sh b/core/tabs/system-setup/debian/hyprland-kool-deb.sh index e12d0e909..6341b0e18 100644 --- a/core/tabs/system-setup/debian/hyprland-kool-deb.sh +++ b/core/tabs/system-setup/debian/hyprland-kool-deb.sh @@ -1,7 +1,7 @@ #!/bin/bash echo "Hyprland JaKooLit" -git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git ~/Debian-Hyprland +git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git "$HOME/Debian-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Debian-Hyprland repo${RC}"; exit 1; } cd "$HOME/Debian-Hyprland" chmod +x install.sh ./install.sh \ No newline at end of file From 2b17c048988464163e8d7940773907f64127ff08 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:07:58 -0600 Subject: [PATCH 20/26] Update core/tabs/system-setup/debian/hyprland-kool-deb.sh Co-authored-by: nyx --- core/tabs/system-setup/debian/hyprland-kool-deb.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/tabs/system-setup/debian/hyprland-kool-deb.sh b/core/tabs/system-setup/debian/hyprland-kool-deb.sh index 6341b0e18..b5f6d03fe 100644 --- a/core/tabs/system-setup/debian/hyprland-kool-deb.sh +++ b/core/tabs/system-setup/debian/hyprland-kool-deb.sh @@ -1,5 +1,7 @@ #!/bin/bash +. ../../common-script.sh + echo "Hyprland JaKooLit" git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git "$HOME/Debian-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Debian-Hyprland repo${RC}"; exit 1; } cd "$HOME/Debian-Hyprland" From f37778dc216306bb2e83084af2c11da2b5981e3d Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:08:06 -0600 Subject: [PATCH 21/26] Update core/tabs/system-setup/arch/hyprland-kool.sh Co-authored-by: nyx --- core/tabs/system-setup/arch/hyprland-kool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index 78a6fc04e..bc293acd0 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -3,7 +3,7 @@ echo "Hyprland JaKooLit" if ! pacman -Q base-devel &>/dev/null; then - echo "Installing base-devel..." + printf "%b\n" "${YELLOW}Installing base-devel...${RC}" sudo pacman -S --noconfirm base-devel fi From 7ec3333f827198ec5906f8e62990e66e3b46420a Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:08:13 -0600 Subject: [PATCH 22/26] Update core/tabs/system-setup/arch/hyprland-kool.sh Co-authored-by: nyx --- core/tabs/system-setup/arch/hyprland-kool.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index bc293acd0..970488bc3 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -1,5 +1,7 @@ #!/bin/bash +. ../../common-script.sh + echo "Hyprland JaKooLit" if ! pacman -Q base-devel &>/dev/null; then From 6e20e3366ac888b26ed5e651d8710e9c29a32238 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:08:21 -0600 Subject: [PATCH 23/26] Update core/tabs/system-setup/arch/hyprland-kool.sh Co-authored-by: nyx --- core/tabs/system-setup/arch/hyprland-kool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index 970488bc3..00fed29e3 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -2,7 +2,7 @@ . ../../common-script.sh -echo "Hyprland JaKooLit" +printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" if ! pacman -Q base-devel &>/dev/null; then printf "%b\n" "${YELLOW}Installing base-devel...${RC}" From e5fdbfff7d1893b531d0120bdee814f5798124ec Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Wed, 5 Feb 2025 11:08:29 -0600 Subject: [PATCH 24/26] Update core/tabs/system-setup/arch/hyprland-kool.sh Co-authored-by: nyx --- core/tabs/system-setup/arch/hyprland-kool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index 00fed29e3..44cb4ec3c 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -6,7 +6,7 @@ printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" if ! pacman -Q base-devel &>/dev/null; then printf "%b\n" "${YELLOW}Installing base-devel...${RC}" - sudo pacman -S --noconfirm base-devel + "$ESCALATION_TOOL" pacman -S --noconfirm base-devel fi git clone --depth=1 https://github.com/JaKooLit/Arch-Hyprland.git "$HOME/Arch-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Arch-Hyprland repo${RC}"; exit 1; } From 072c08d9ceedf9c026d896029c0f5f94f470d6b6 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Thu, 6 Feb 2025 15:04:45 -0600 Subject: [PATCH 25/26] fix bashisms --- core/tabs/system-setup/debian/hyprland-kool-deb.sh | 2 +- core/tabs/system-setup/fedora/hyprland-kool-fed.sh | 6 ++++-- core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/tabs/system-setup/debian/hyprland-kool-deb.sh b/core/tabs/system-setup/debian/hyprland-kool-deb.sh index b5f6d03fe..88ef1940e 100644 --- a/core/tabs/system-setup/debian/hyprland-kool-deb.sh +++ b/core/tabs/system-setup/debian/hyprland-kool-deb.sh @@ -2,7 +2,7 @@ . ../../common-script.sh -echo "Hyprland JaKooLit" +printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git "$HOME/Debian-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Debian-Hyprland repo${RC}"; exit 1; } cd "$HOME/Debian-Hyprland" chmod +x install.sh diff --git a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh index 1ea2a977f..c14d5d019 100644 --- a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh +++ b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh @@ -1,8 +1,10 @@ #!/bin/bash -echo "Hyprland JaKooLit" +. ../../common-script.sh -git clone --depth=1 https://github.com/JaKooLit/Fedora-Hyprland.git ~/Fedora-Hyprland +printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" + +git clone --depth=1 https://github.com/JaKooLit/Fedora-Hyprland.git "$HOME/Fedora-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Fedora-Hyprland repo${RC}"; exit 1; } cd "$HOME/Fedora-Hyprland" chmod +x install.sh ./install.sh \ No newline at end of file diff --git a/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh index 23b8dc0d1..6a6355baa 100644 --- a/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh +++ b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh @@ -1,8 +1,10 @@ #!/bin/bash -echo "Hyprland JaKooLit" +. ../../common-script.sh -git clone -b 24.04 --depth=1 https://github.com/JaKooLit/Ubuntu-Hyprland.git ~/Ubuntu-Hyprland-24.04 -cd ~/Ubuntu-Hyprland-24.04 +printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" + +git clone -b 24.04 --depth=1 https://github.com/JaKooLit/Ubuntu-Hyprland.git "$HOME/Ubuntu-Hyprland-24.04" || { printf "%b\n" "${RED}Failed to clone Jakoolits Ubuntu-Hyprland repo${RC}"; exit 1; } +cd "$HOME/Ubuntu-Hyprland-24.04" chmod +x install.sh ./install.sh \ No newline at end of file From 01535e2e1f9278c32627e2e3370664614f05a77a Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Thu, 6 Feb 2025 15:10:58 -0600 Subject: [PATCH 26/26] Switch to SH from bash --- core/tabs/system-setup/arch/hyprland-kool.sh | 6 +++--- core/tabs/system-setup/debian/hyprland-kool-deb.sh | 4 ++-- core/tabs/system-setup/fedora/hyprland-kool-fed.sh | 4 ++-- core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/tabs/system-setup/arch/hyprland-kool.sh b/core/tabs/system-setup/arch/hyprland-kool.sh index 44cb4ec3c..7c85f857f 100644 --- a/core/tabs/system-setup/arch/hyprland-kool.sh +++ b/core/tabs/system-setup/arch/hyprland-kool.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/bin/sh . ../../common-script.sh printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" -if ! pacman -Q base-devel &>/dev/null; then +if ! pacman -Q base-devel >/dev/null 2>&1; then printf "%b\n" "${YELLOW}Installing base-devel...${RC}" "$ESCALATION_TOOL" pacman -S --noconfirm base-devel fi git clone --depth=1 https://github.com/JaKooLit/Arch-Hyprland.git "$HOME/Arch-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Arch-Hyprland repo${RC}"; exit 1; } -cd "$HOME/Arch-Hyprland" +cd "$HOME/Arch-Hyprland" || { printf "%b\n" "${RED}Failed to navigate to Arch-Hyprland directory${RC}"; exit 1; } chmod +x install.sh ./install.sh diff --git a/core/tabs/system-setup/debian/hyprland-kool-deb.sh b/core/tabs/system-setup/debian/hyprland-kool-deb.sh index 88ef1940e..582297929 100644 --- a/core/tabs/system-setup/debian/hyprland-kool-deb.sh +++ b/core/tabs/system-setup/debian/hyprland-kool-deb.sh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/bin/sh . ../../common-script.sh printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git "$HOME/Debian-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Debian-Hyprland repo${RC}"; exit 1; } -cd "$HOME/Debian-Hyprland" +cd "$HOME/Debian-Hyprland" || { printf "%b\n" "${RED}Failed to navigate to Debian-Hyprland directory${RC}"; exit 1; } chmod +x install.sh ./install.sh \ No newline at end of file diff --git a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh index c14d5d019..3a7ebd922 100644 --- a/core/tabs/system-setup/fedora/hyprland-kool-fed.sh +++ b/core/tabs/system-setup/fedora/hyprland-kool-fed.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh . ../../common-script.sh printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" git clone --depth=1 https://github.com/JaKooLit/Fedora-Hyprland.git "$HOME/Fedora-Hyprland" || { printf "%b\n" "${RED}Failed to clone Jakoolits Fedora-Hyprland repo${RC}"; exit 1; } -cd "$HOME/Fedora-Hyprland" +cd "$HOME/Fedora-Hyprland" || { printf "%b\n" "${RED}Failed to navigate to Fedora-Hyprland directory${RC}"; exit 1; } chmod +x install.sh ./install.sh \ No newline at end of file diff --git a/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh index 6a6355baa..bd12ef76b 100644 --- a/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh +++ b/core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh . ../../common-script.sh printf "%b\n" "${YELLOW}Starting Hyprland JaKooLit installation${RC}" -git clone -b 24.04 --depth=1 https://github.com/JaKooLit/Ubuntu-Hyprland.git "$HOME/Ubuntu-Hyprland-24.04" || { printf "%b\n" "${RED}Failed to clone Jakoolits Ubuntu-Hyprland repo${RC}"; exit 1; } -cd "$HOME/Ubuntu-Hyprland-24.04" +git clone -b 24.04 --depth=1 https://github.com/JaKooLit/Ubuntu-Hyprland.git "$HOME/Ubuntu-Hyprland-24.04" || { printf "%b\n" "${RED}Failed to clone Jakoolits Ubuntu-Hyprland repo${RC}"; exit 1; } +cd "$HOME/Ubuntu-Hyprland-24.04" || { printf "%b\n" "${RED}Failed to navigate to Ubuntu-Hyprland-24.04 directory${RC}"; exit 1; } chmod +x install.sh ./install.sh \ No newline at end of file