#!/bin/bash
#
# Adding the first user to the _nmconnect group
#

# chkconfig: 2345 10 92
# description:  Adding the first user to the _nmconnect group
#
### BEGIN INIT INFO
# Provides:       nm-group
# Required-Start:
# Required-Stop:
# Default-Start:  2 3 4 5
# Default-Stop:
# Description:    Adding the first user to the _nmconnect group
### END INIT INFO


# Source function library.
. /etc/rc.d/init.d/functions

start() {
# adding first user to a group _nmconnect

getent group _nmconnect>/dev/null 2>&1 || groupadd -r _nmconnect>/dev/null 2>&1
for n in `awk -F: '{if ($3==500) print $1}' /etc/passwd`
    do
	id -Gn $n|grep -c _nmconnect>/dev/null 2>&1 || gpasswd -a $n _nmconnect>/dev/null 2>&1
done

chkconfig nm-group off
}

case "$1" in
    start)
    start
    ;;
    *)
        echo $"Usage: $0 {start}"
        exit 1
esac
exit 0
