rlm@1: #!/bin/bash rlm@1: # Copyright (c) 2000,2004 Matthias S. Benkmann
rlm@1: # You may do everything with this code except misrepresent its origin. rlm@1: # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND! rlm@1: rlm@1: # rlm@1: # This is a primitive script to serve as groupadd until the real groupadd rlm@1: # has been installed. It has little error checking, so don't pass it anything rlm@1: # stupid or it'll mess up your /etc/group file. rlm@1: # rlm@1: rlm@1: if [ $# -ne 3 -o z$1 != z-g ]; then rlm@1: echo 1>&2 USAGE: groupadd -g gid groupname rlm@1: exit 1 rlm@1: fi rlm@1: rlm@1: #test if group already exists rlm@1: grep "^${3}:.*" /etc/group rlm@1: if [ $? -eq 0 ]; then rlm@1: echo 1>&2 $0: Group does already exist rlm@1: exit 1 rlm@1: fi rlm@1: rlm@1: cp /etc/group /tmp/group123456 rlm@1: echo ${3}:x:${2}: | sort -t : -k3,3n -m /tmp/group123456 - > /etc/group rlm@1: