Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow different os-releases and hyprland setup #1013

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
13 changes: 8 additions & 5 deletions core/src/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Comment on lines +139 to +143
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this what the previous file precondition was doing? See linux neptune for example

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me test that out, for some odd reason I thought that was just matching the entire value of the file. It was late and I probably just missed this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it iterated through values[] and ensured each was contained within the file.

I feel as though the 'contains' in the FileContains variant also is redundant, given values[] already stores strings to validate.

I would personally keep the previous implementation of the File precondition (perhaps renaming it to FileContains) and create a new FileExists precondition, which would match the pattern with the existing CommandExists.

}
},
)
Expand All @@ -164,6 +165,8 @@ enum SystemDataType {
File(PathBuf),
#[serde(rename = "command_exists")]
CommandExists,
#[serde(untagged)]
FileContains { file: PathBuf, contains: String },
}

fn filter_entries(entries: &mut Vec<Entry>) {
Expand Down
13 changes: 13 additions & 0 deletions core/tabs/system-setup/arch/hyprland-kool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo "Hyprland JaKooLit"

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

Check warning on line 11 in core/tabs/system-setup/arch/hyprland-kool.sh

View workflow job for this annotation

GitHub Actions / Shellcheck

[shellcheck] reported by reviewdog 🐶 Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Raw Output: ./core/tabs/system-setup/arch/hyprland-kool.sh:11:1: warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. (ShellCheck.SC2164)
chmod +x install.sh
./install.sh
7 changes: 7 additions & 0 deletions core/tabs/system-setup/debian/hyprland-kool-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "Hyprland JaKooLit"
git clone --depth=1 https://github.com/JaKooLit/Debian-Hyprland.git ~/Debian-Hyprland
cd ~/Debian-Hyprland

Check warning on line 5 in core/tabs/system-setup/debian/hyprland-kool-deb.sh

View workflow job for this annotation

GitHub Actions / Shellcheck

[shellcheck] reported by reviewdog 🐶 Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Raw Output: ./core/tabs/system-setup/debian/hyprland-kool-deb.sh:5:1: warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. (ShellCheck.SC2164)
chmod +x install.sh
./install.sh
8 changes: 8 additions & 0 deletions core/tabs/system-setup/fedora/hyprland-kool-fed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

ChrisTitusTech marked this conversation as resolved.
Show resolved Hide resolved
echo "Hyprland JaKooLit"

git clone --depth=1 https://github.com/JaKooLit/Fedora-Hyprland.git ~/Fedora-Hyprland
cd ~/Fedora-Hyprland

Check warning on line 6 in core/tabs/system-setup/fedora/hyprland-kool-fed.sh

View workflow job for this annotation

GitHub Actions / Shellcheck

[shellcheck] reported by reviewdog 🐶 Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Raw Output: ./core/tabs/system-setup/fedora/hyprland-kool-fed.sh:6:1: warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. (ShellCheck.SC2164)
chmod +x install.sh
./install.sh
46 changes: 46 additions & 0 deletions core/tabs/system-setup/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ script = "arch/server-setup.sh"
task_list = "SI D"
multi_select = false

[[data.entries]]
name = "Hyprland JaKooLit"
description = "Install JaKooLit's Hyprland configuration"
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"
Expand Down Expand Up @@ -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 JaKooLit"
description = "Install JaKooLit's Hyprland configuration"
script = "debian/hyprland-kool-deb.sh"
task_list = "I MP"

[[data]]
name = "Fedora"

Expand All @@ -64,6 +85,12 @@ description = "Optimizes DNF for parallel downloads"
script = "fedora/configure-dnf.sh"
task_list = "PFM"

[[data.entries]]
name = "Hyprland JaKooLit"
description = "Install JaKooLit's Hyprland configuration"
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."
Expand Down Expand Up @@ -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 JaKooLit"
description = "Install JaKooLit's Hyprland configuration"
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"
Expand Down
8 changes: 8 additions & 0 deletions core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

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

Check warning on line 6 in core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh

View workflow job for this annotation

GitHub Actions / Shellcheck

[shellcheck] reported by reviewdog 🐶 Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Raw Output: ./core/tabs/system-setup/ubuntu/hyprland-kool-ubuntu24.sh:6:1: warning: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. (ShellCheck.SC2164)
chmod +x install.sh
./install.sh
Loading