#!/bin/sh . /etc/control.d/functions CONFIG1=/etc/pam.d/system-auth CONFIG2=/etc/pam.d/system-auth-use_first_pass new_summary "system authentication type" new_help local "local authentication" new_help ldap "authentication via LDAP" REQUEST="$*" case "$REQUEST" in help|'help '*) control_help "${REQUEST#help}" ;; list) control_list ;; summary) control_summary ;; status) CURRENT="$(readlink -e "$CONFIG1")" CURRENT="${CURRENT#$CONFIG1-}" CURRENT="${CURRENT##/*}" echo "${CURRENT:-unknown}" ;; *) if [ ! -f "$CONFIG1-$REQUEST" -o ! -f "$CONFIG2-$REQUEST" ]; then printf '%s: %s\n' "${0##*/}" "Invalid mode: $REQUEST" >&2 exit 1 fi ln -sf "${CONFIG1##*/}-$REQUEST" "$CONFIG1" ln -sf "${CONFIG2##*/}-$REQUEST" "$CONFIG2" ;; esac