From 3e5d0bef5d51253f8930227c1b762bb0044358da Mon Sep 17 00:00:00 2001 From: dreamyukii <49896401+dreamyukii@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:43:12 +0700 Subject: [PATCH 1/4] feat: openrazer-daemon --- build_files/base/02-install-copr-repos.sh | 3 ++ build_files/base/17-cleanup.sh | 1 + packages.json | 1 + .../lib/systemd/system/aurora-groups.service | 10 +++++++ .../shared/usr/libexec/aurora-groups.sh | 28 +++++++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 system_files/shared/usr/lib/systemd/system/aurora-groups.service create mode 100644 system_files/shared/usr/libexec/aurora-groups.sh diff --git a/build_files/base/02-install-copr-repos.sh b/build_files/base/02-install-copr-repos.sh index b115a66b..48f07134 100755 --- a/build_files/base/02-install-copr-repos.sh +++ b/build_files/base/02-install-copr-repos.sh @@ -13,3 +13,6 @@ 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-"${FEDORA_MAJOR_VERSION}".repo https://download.opensuse.org/repositories/hardware:/razer/Fedora_"${FEDORA_MAJOR_VERSION}"/hardware:razer.repo \ No newline at end of file diff --git a/build_files/base/17-cleanup.sh b/build_files/base/17-cleanup.sh index aa9df2cc..53f35aa9 100755 --- a/build_files/base/17-cleanup.sh +++ b/build_files/base/17-cleanup.sh @@ -33,6 +33,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-"${FEDORA_MAJOR_VERSION}".repo for i in /etc/yum.repos.d/rpmfusion-*; do sed -i 's@enabled=1@enabled=0@g' "$i" done diff --git a/packages.json b/packages.json index 3b8f9b23..0fa8b7c7 100644 --- a/packages.json +++ b/packages.json @@ -37,6 +37,7 @@ "nerd-fonts", "oddjob-mkhomedir", "opendyslexic-fonts", + "openrazer-daemon", "printer-driver-brlaser", "pulseaudio-utils", "python3-pip", diff --git a/system_files/shared/usr/lib/systemd/system/aurora-groups.service b/system_files/shared/usr/lib/systemd/system/aurora-groups.service new file mode 100644 index 00000000..dc027a98 --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/aurora-groups.service @@ -0,0 +1,10 @@ +[Unit] +Description=Add plugdev groups +[Service] +Type=oneshot +ExecStart=/usr/libexec/aurora-groups +Restart=on-failure +RestartSec=30 +StartLimitInterval=0 +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/system_files/shared/usr/libexec/aurora-groups.sh b/system_files/shared/usr/libexec/aurora-groups.sh new file mode 100644 index 00000000..5ab2c389 --- /dev/null +++ b/system_files/shared/usr/libexec/aurora-groups.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# SCRIPT VERSION +GROUP_SETUP_VER=1 +GROUP_SETUP_VER_FILE="/etc/ublue/aurora-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 +done +# Prevent future executions +echo "Writing state file" +echo "$GROUP_SETUP_VER" > "$GROUP_SETUP_VER_FILE" \ No newline at end of file From 5d5a36b575dfe123ae3f0bd4194a963994c13997 Mon Sep 17 00:00:00 2001 From: dreamyukii <49896401+dreamyukii@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:02:46 +0700 Subject: [PATCH 2/4] fix: update add openrazer-repo --- build_files/base/02-install-copr-repos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/base/02-install-copr-repos.sh b/build_files/base/02-install-copr-repos.sh index 48f07134..670330a2 100755 --- a/build_files/base/02-install-copr-repos.sh +++ b/build_files/base/02-install-copr-repos.sh @@ -15,4 +15,4 @@ curl --retry 3 -Lo /etc/yum.repos.d/_copr_sentry-switcheroo-control_discrete.rep 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-"${FEDORA_MAJOR_VERSION}".repo https://download.opensuse.org/repositories/hardware:/razer/Fedora_"${FEDORA_MAJOR_VERSION}"/hardware:razer.repo \ No newline at end of file +curl -Lo /etc/yum.repos.d/hardware:razer.repo https://openrazer.github.io/hardware:razer.repo \ No newline at end of file From 40b3dcc863493ef1e8a8ba549953887cd987e4ad Mon Sep 17 00:00:00 2001 From: dreamyukii <49896401+dreamyukii@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:03:35 +0700 Subject: [PATCH 3/4] fix: cleanup for openrazer repo --- build_files/base/17-cleanup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_files/base/17-cleanup.sh b/build_files/base/17-cleanup.sh index 53f35aa9..61755c8e 100755 --- a/build_files/base/17-cleanup.sh +++ b/build_files/base/17-cleanup.sh @@ -33,7 +33,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-"${FEDORA_MAJOR_VERSION}".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 From 5b33c63804041e2986e9e9518da1d871e43ab780 Mon Sep 17 00:00:00 2001 From: dreamyukii <49896401+dreamyukii@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:45:08 +0700 Subject: [PATCH 4/4] feat: enable service for plugdev group --- build_files/base/17-cleanup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_files/base/17-cleanup.sh b/build_files/base/17-cleanup.sh index 61755c8e..502c400f 100755 --- a/build_files/base/17-cleanup.sh +++ b/build_files/base/17-cleanup.sh @@ -13,6 +13,7 @@ systemctl enable ublue-guest-user.service systemctl enable brew-setup.service systemctl enable brew-upgrade.timer systemctl enable brew-update.timer +systemctl enable aurora-groups.service systemctl --global enable ublue-user-setup.service systemctl --global enable podman-auto-update.timer systemctl enable check-sb-key.service