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

feat: add openrazer-daemon #1402

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build_files/base/02-install-copr-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ curl --retry 3 -Lo /etc/yum.repos.d/_copr_sentry-switcheroo-control_discrete.rep
# Add Nerd Fonts Repo
curl --retry 3 -Lo /etc/yum.repos.d/_copr_che-nerd-fonts-"$(rpm -E %fedora)".repo https://copr.fedorainfracloud.org/coprs/che/nerd-fonts/repo/fedora-"$(rpm -E %fedora)"/che-nerd-fonts-fedora-"$(rpm -E %fedora)".repo


# Add openrazer repo
curl -Lo /etc/yum.repos.d/hardware:razer.repo https://openrazer.github.io/hardware:razer.repo

echo "::endgroup::"
2 changes: 2 additions & 0 deletions build_files/base/17-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ systemctl enable ublue-guest-user.service
systemctl enable brew-setup.service
systemctl enable brew-upgrade.timer
systemctl enable brew-update.timer
systemctl enable bluefin-groups.service
systemctl --global enable ublue-user-setup.service
systemctl --global enable podman-auto-update.timer
systemctl enable check-sb-key.service
Expand All @@ -35,6 +36,7 @@ sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/ublue-os-staging-fedora-"${FED
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-cisco-openh264.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/hardware:razer.repo
for i in /etc/yum.repos.d/rpmfusion-*; do
sed -i 's@enabled=1@enabled=0@g' "$i"
done
Expand Down
3 changes: 2 additions & 1 deletion packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"nerd-fonts",
"oddjob-mkhomedir",
"opendyslexic-fonts",
"openrazer-daemon",
"printer-driver-brlaser",
"pulseaudio-utils",
"powertop",
Expand Down Expand Up @@ -209,4 +210,4 @@
"dx": []
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Add plugdev groups

[Service]
Type=oneshot
ExecStart=/usr/libexec/bluefin-groups.sh
Restart=on-failure
RestartSec=30
StartLimitInterval=0

[Install]
WantedBy=default.target
34 changes: 34 additions & 0 deletions system_files/shared/usr/libexec/bluefin-groups.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

# SCRIPT VERSION
GROUP_SETUP_VER=1
GROUP_SETUP_VER_FILE="/etc/ublue/bluefin-groups"
GROUP_SETUP_VER_RAN=$(cat "$GROUP_SETUP_VER_FILE")

# Run script if updated
if [[ -f $GROUP_SETUP_VER_FILE && "$GROUP_SETUP_VER" = "$GROUP_SETUP_VER_RAN" ]]; then
echo "Group setup has already run. Exiting..."
exit 0
fi

# Function to append a group entry to /etc/group
append_group() {
local group_name="$1"
if ! grep -q "^$group_name:" /etc/group; then
echo "Appending $group_name to /etc/group"
grep "^$group_name:" /usr/lib/group | tee -a /etc/group > /dev/null
fi
}

# Setup Groups
append_group plugdev

wheelarray=($(getent group wheel | cut -d ":" -f 4 | tr ',' '\n'))
for user in "${wheelarray[@]}"
do
usermod -aG plugdev $user

Check warning on line 29 in system_files/shared/usr/libexec/bluefin-groups.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

system_files/shared/usr/libexec/bluefin-groups.sh#L29

Double quote to prevent globbing and word splitting.
done

# Prevent future executions
echo "Writing state file"
echo "$GROUP_SETUP_VER" > "$GROUP_SETUP_VER_FILE"