From 2664e0b8f1912de37316357d6a45387a31648a37 Mon Sep 17 00:00:00 2001 From: dreamyukii <49896401+dreamyukii@users.noreply.github.com> Date: Sat, 11 Jan 2025 03:27:49 +0700 Subject: [PATCH 1/3] fix: forgot to chmod +x aurora-groups.sh --- .../shared/usr/lib/systemd/system/aurora-groups.service | 2 ++ system_files/shared/usr/libexec/aurora-groups.sh | 6 ++++++ 2 files changed, 8 insertions(+) mode change 100644 => 100755 system_files/shared/usr/libexec/aurora-groups.sh diff --git a/system_files/shared/usr/lib/systemd/system/aurora-groups.service b/system_files/shared/usr/lib/systemd/system/aurora-groups.service index dc027a9..ebe012c 100644 --- a/system_files/shared/usr/lib/systemd/system/aurora-groups.service +++ b/system_files/shared/usr/lib/systemd/system/aurora-groups.service @@ -1,10 +1,12 @@ [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 old mode 100644 new mode 100755 index 5ab2c38..2ebd815 --- a/system_files/shared/usr/libexec/aurora-groups.sh +++ b/system_files/shared/usr/libexec/aurora-groups.sh @@ -1,13 +1,16 @@ #!/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" @@ -16,13 +19,16 @@ append_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 93dda105526a65778f2bfa0e2b7094284e9031c6 Mon Sep 17 00:00:00 2001 From: dreamyuki <49896401+dreamyukii@users.noreply.github.com> Date: Sat, 11 Jan 2025 15:42:51 +0700 Subject: [PATCH 2/3] Update system_files/shared/usr/lib/systemd/system/aurora-groups.service using full path for the script Co-authored-by: Adam Fidel --- .../shared/usr/lib/systemd/system/aurora-groups.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_files/shared/usr/lib/systemd/system/aurora-groups.service b/system_files/shared/usr/lib/systemd/system/aurora-groups.service index ebe012c..2135e53 100644 --- a/system_files/shared/usr/lib/systemd/system/aurora-groups.service +++ b/system_files/shared/usr/lib/systemd/system/aurora-groups.service @@ -3,7 +3,7 @@ Description=Add plugdev groups [Service] Type=oneshot -ExecStart=/usr/libexec/aurora-groups +ExecStart=/usr/libexec/aurora-groups.sh Restart=on-failure RestartSec=30 StartLimitInterval=0 From ff6b22e97512e23ab2d940126bf5447fd3bda744 Mon Sep 17 00:00:00 2001 From: Adam Fidel Date: Sat, 11 Jan 2025 09:13:20 -0600 Subject: [PATCH 3/3] fix: bash array iteration --- system_files/shared/usr/libexec/aurora-groups.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_files/shared/usr/libexec/aurora-groups.sh b/system_files/shared/usr/libexec/aurora-groups.sh index 2ebd815..7cf18bd 100755 --- a/system_files/shared/usr/libexec/aurora-groups.sh +++ b/system_files/shared/usr/libexec/aurora-groups.sh @@ -24,7 +24,7 @@ append_group() { append_group plugdev wheelarray=($(getent group wheel | cut -d ":" -f 4 | tr ',' '\n')) -for user in $wheelarray +for user in "${wheelarray[@]}" do usermod -aG plugdev $user done