#! /bin/sh #---------------------------------------------------------------------------- # add-group - add a group # # Copyright (c) 2001-2003 Frank Meyer # # usage: add-group # or: add-group group gid # # Creation: 04.11.2001 fm # Last Update: 19.07.2003 fm # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- case $# in 0) interactive='true' group="" gid="" ;; 2) interactive='false' group="$1" gid="$2" ;; *) echo "usage: `basename $0`" >&2 echo " or: `basename $0` group gid" >&2 exit 1 ;; esac if [ "$interactive" = "true" ] then clrhome colecho "Add group" gn echo fi if [ "$gid" = "" ] then IFS=':' gid=200 while read line do set -- $line if [ $3 -gt $gid -a $3 -lt 300 ] then gid=$3 fi done /dev/null if [ $? = 0 ] then echo colecho "group $group already exists" br x br else echo "$group:x:$gid:" >>/etc/group fi ;; esac if [ "$interactive" = "true" ] then echo /var/install/bin/anykey fi