143725Syokota#!/bin/sh
243725Syokota#-
343725Syokota# Copyright (c) 2012 Ron McDowell
443725Syokota# Copyright (c) 2012-2014 Devin Teske
543725Syokota# All rights reserved.
643725Syokota#
743725Syokota# Redistribution and use in source and binary forms, with or without
843725Syokota# modification, are permitted provided that the following conditions
943725Syokota# are met:
1043725Syokota# 1. Redistributions of source code must retain the above copyright
1143725Syokota#    notice, this list of conditions and the following disclaimer.
1243725Syokota# 2. Redistributions in binary form must reproduce the above copyright
1343725Syokota#    notice, this list of conditions and the following disclaimer in the
1443725Syokota#    documentation and/or other materials provided with the distribution.
1543725Syokota#
1643725Syokota# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1743725Syokota# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1843725Syokota# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1943725Syokota# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2043725Syokota# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2143725Syokota# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2243725Syokota# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2343725Syokota# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2443725Syokota# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2543725Syokota# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2643725Syokota# SUCH DAMAGE.
2750476Speter#
2843725Syokota# $FreeBSD: releng/11.0/usr.sbin/bsdconfig/usermgmt/groupadd 262909 2014-03-07 22:24:53Z dteske $
29293034Sdes#
3053200Sphantom############################################################ INCLUDES
3165013Ssheldonh
3243725SyokotaBSDCFG_SHARE="/usr/share/bsdconfig"
3343725Syokota. $BSDCFG_SHARE/common.subr || exit 1
3465013Ssheldonhf_dprintf "%s: loading includes..." "$0"
3543725Syokotaf_include $BSDCFG_SHARE/dialog.subr
3676175Sschweikhf_include $BSDCFG_SHARE/mustberoot.subr
3743725Syokotaf_include $BSDCFG_SHARE/usermgmt/group.subr
3843725Syokota
3943725SyokotaBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt"
4076175Sschweikhf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
4143725Syokota
4243725Syokotaf_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
4343725Syokota	pgm="${ipgm:-$pgm}"
4465013Ssheldonh
4562978Sdannyboy############################################################ MAIN
4665009Ssheldonh
4765009Ssheldonh# Incorporate rc-file if it exists
4865009Ssheldonh[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
4965013Ssheldonh
5076175Sschweikh#
5165009Ssheldonh# Process command-line arguments
5265009Ssheldonh#
5365009Ssheldonhwhile getopts h$GETOPTS_STDARGS flag; do
5443725Syokota	case "$flag" in
5576175Sschweikh	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
5643725Syokota	esac
5743725Syokotadone
5843725Syokotashift $(( $OPTIND - 1 ))
5962978Sdannyboy
6057676Ssheldonh#
6143844Syokota# Initialize
6243725Syokota#
6343844Syokotaf_dialog_title "$msg_add $msg_group"
6443844Syokotaf_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
6555268Shoekf_mustberoot_init
6643725Syokota
6743844Syokota#
6843844Syokota# Add a group
69274749Semaste#
7043844Syokota# NB: If given an argument on the command-line use it; otherwise fall-back to
7165009Ssheldonh#     environment variable $group (handle $VAR_GROUP).
7265009Ssheldonh#
7345628Sdesf_group_add ${1:+"$1"}
7445628Sdes
7545628Sdes################################################################################
7645628Sdes# END
77228445Seadler################################################################################
78228445Seadler