Skip to content
Draft
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
2 changes: 1 addition & 1 deletion delayed-admin.sudoers
Original file line number Diff line number Diff line change
@@ -1 +1 @@
%delayed-admin ALL = /usr/local/bin/delayed
%delayed-admin ALL = NOPASSWD: /usr/local/bin/delayed
33 changes: 30 additions & 3 deletions lib/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,43 @@ function distro_id() {
echo $ID
}
function admin_group() {
case $(distro_id) in
ubuntu|debian)
local id
id=$(distro_id)
case $id in
ubuntu|kubuntu|debian|linuxmint|pop|neon|elementary|zorin)
echo "sudo"
;;
centos|fedora|rhel|arch|manjaro|endeavouros)
centos|fedora|rhel|arch|manjaro|endeavouros|opensuse*|sles)
echo "wheel"
;;
*)
# Fallback: use ID_LIKE from /etc/os-release
local id_like
id_like=$(grep '^ID_LIKE=' /etc/os-release 2>/dev/null | cut -d= -f2- | tr -d '"')
case "$id_like" in
*ubuntu*|*debian*)
echo "sudo"
;;
*rhel*|*fedora*|*centos*|*suse*)
echo "wheel"
;;
*)
# Last resort: check which admin group actually exists on this system.
# If neither exists, admin_group() returns empty and the check below will abort.
if getent group sudo > /dev/null 2>&1; then
echo "sudo"
elif getent group wheel > /dev/null 2>&1; then
echo "wheel"
fi
;;
esac
;;
esac
}
readonly ADMIN_GROUP=$(admin_group)
if [ -z "$ADMIN_GROUP" ]; then
die "Could not determine the admin group for this OS (ID=$(distro_id)). Please file a bug report."
fi
#TODO Implement these
function check_atd_is_running { true; }
function start_atd { true; }