groupadd revision 263980
148156Sjlemon#!/bin/sh
257828Sjlemon#-
348156Sjlemon# Copyright (c) 2012 Ron McDowell
448156Sjlemon# Copyright (c) 2012-2014 Devin Teske
548156Sjlemon# All rights reserved.
648156Sjlemon#
748156Sjlemon# Redistribution and use in source and binary forms, with or without
848156Sjlemon# modification, are permitted provided that the following conditions
948156Sjlemon# are met:
1048156Sjlemon# 1. Redistributions of source code must retain the above copyright
1148156Sjlemon#    notice, this list of conditions and the following disclaimer.
1248156Sjlemon# 2. Redistributions in binary form must reproduce the above copyright
1348156Sjlemon#    notice, this list of conditions and the following disclaimer in the
1448156Sjlemon#    documentation and/or other materials provided with the distribution.
1548156Sjlemon#
1648156Sjlemon# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1748156Sjlemon# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1848156Sjlemon# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1948156Sjlemon# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2048156Sjlemon# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2148156Sjlemon# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2248156Sjlemon# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2348156Sjlemon# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2448156Sjlemon# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2548156Sjlemon# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2650477Speter# SUCH DAMAGE.
2748156Sjlemon#
2848156Sjlemon# $FreeBSD: stable/10/usr.sbin/bsdconfig/usermgmt/groupadd 263980 2014-04-01 00:19:13Z dteske $
2948156Sjlemon#
3048156Sjlemon############################################################ INCLUDES
3148156Sjlemon
3248156SjlemonBSDCFG_SHARE="/usr/share/bsdconfig"
3348156Sjlemon. $BSDCFG_SHARE/common.subr || exit 1
34124471Smdoddf_dprintf "%s: loading includes..." "$0"
3548156Sjlemonf_include $BSDCFG_SHARE/dialog.subr
36124471Smdoddf_include $BSDCFG_SHARE/mustberoot.subr
37239740Sjhbf_include $BSDCFG_SHARE/usermgmt/group.subr
38124471Smdodd
39239740SjhbBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
40124471Smdoddf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
41239740Sjhb
4257828Sjlemonf_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
43124471Smdodd	pgm="${ipgm:-$pgm}"
44239740Sjhb
45124471Smdodd############################################################ MAIN
46239740Sjhb
47124471Smdodd# Incorporate rc-file if it exists
48239740Sjhb[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
4957828Sjlemon
5048156Sjlemon#
5148156Sjlemon# Process command-line arguments
5248156Sjlemon#
5348156Sjlemonwhile getopts h$GETOPTS_STDARGS flag; do
5448156Sjlemon	case "$flag" in
5548156Sjlemon	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
5648156Sjlemon	esac
5748156Sjlemondone
5848156Sjlemonshift $(( $OPTIND - 1 ))
5948156Sjlemon
6048156Sjlemon#
6148156Sjlemon# Initialize
6248156Sjlemon#
6348156Sjlemonf_dialog_title "$msg_add $msg_group"
6448156Sjlemonf_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
6548156Sjlemonf_mustberoot_init
6648156Sjlemon
6748156Sjlemon#
6848156Sjlemon# Add a group
6948156Sjlemon#
7048156Sjlemon# NB: If given an argument on the command-line use it; otherwise fall-back to
71124471Smdodd#     environment variable $group (handle $VAR_GROUP).
7248156Sjlemon#
7348156Sjlemonf_group_add ${1:+"$1"}
7448156Sjlemon
7548156Sjlemon################################################################################
7648156Sjlemon# END
7748156Sjlemon################################################################################
7848156Sjlemon