#!/bin/bash
PIS_SBIN="${PIS_SBIN:-/sbin}"
if [ -z "${PIS_LIBDIR:-}" ]; then
    case "$(uname -m)" in x86_64) PIS_LIBDIR=/usr/lib64/pis ;; *) PIS_LIBDIR=/usr/lib/pis ;; esac
fi
. "$PIS_LIBDIR/pis_lib" 2>/dev/null || . "$(dirname "$0")/pis_lib" || exit 1
pis_init || exit 1
choice=$(dialog --stdout --backtitle "$PIS_BACKTITLE" --title "Wheel Group" \
    --menu "Current setting: $(pis_state_read wheel_group)" 0 0 0 \
    YES "Activate wheel administration" \
    NO "Deactivate wheel administration") || exit 0
if pis_apply_wheel "$choice"; then
    pis_info "Wheel Group" "Wheel administration was set to '$choice' and validated with visudo."
else
    pis_error "The wheel configuration could not be changed."
    exit 1
fi
