#!/bin/sh -efu

. install2-init-functions

LISTS=

[ ! -f /usr/share/install3/default-groups ] ||
	LISTS=/usr/share/install3/default-groups

[ ! -f /etc/alterator/auth/user-groups ] ||
	LISTS="$LISTS /etc/alterator/auth/user-groups"

[ ! -f /etc/alterator/auth/admin-groups ] ||
	LISTS="$LISTS /etc/alterator/auth/admin-groups"

[ -n "$LISTS" ] || exit 0

cat $LISTS | sort -u \
| while read LIST; do
    [ -s "$destdir$LIST" ] || continue
    for GROUP in $(cat "$destdir$LIST"); do
        exec_chroot groupadd -r "$GROUP" &>/dev/null ||:
    done
done
