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

fix: make aurora-groups.sh executable #102

Open
wants to merge 3 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
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[Unit]
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

[Install]
WantedBy=default.target
8 changes: 7 additions & 1 deletion system_files/shared/usr/libexec/aurora-groups.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
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"