#!/bin/sh

. /etc/control.d/functions

CONFIG=/etc/doas.conf

# Comment or uncomment the permit :wheel rule in the doas configuration
new_subst disabled \
    '^[[:space:]]*#[[:space:]]*permit[[:space:]]*:wheel\>.*$' \
    's,^[[:space:]]*\(permit[[:space:]]*:wheel\>.*\)$,# \1,'
new_subst enabled \
    '^[[:space:]]*permit[[:space:]]*:wheel\>.*$' \
    's,^[[:space:]]*#[[:space:]]*\(permit[[:space:]]*:wheel\>.*\)$,\1,'

new_help enabled  'Enable doas for wheel group members'
new_help disabled 'Disable doas for wheel group members'

new_summary 'doas rule "permit :wheel" for wheel users'

control_subst "$CONFIG" "$*" || exit 1
