groupedit revision 240684
1238438Sdteske#!/bin/sh 2238438Sdteske#- 3238438Sdteske# Copyright (c) 2012 Ron McDowell 4238438Sdteske# Copyright (c) 2012 Devin Teske 5238438Sdteske# All rights reserved. 6238438Sdteske# 7238438Sdteske# Redistribution and use in source and binary forms, with or without 8238438Sdteske# modification, are permitted provided that the following conditions 9238438Sdteske# are met: 10238438Sdteske# 1. Redistributions of source code must retain the above copyright 11238438Sdteske# notice, this list of conditions and the following disclaimer. 12238438Sdteske# 2. Redistributions in binary form must reproduce the above copyright 13238438Sdteske# notice, this list of conditions and the following disclaimer in the 14238438Sdteske# documentation and/or other materials provided with the distribution. 15238438Sdteske# 16238438Sdteske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17238438Sdteske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18238438Sdteske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19238438Sdteske# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20238438Sdteske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21238438Sdteske# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22238438Sdteske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23238438Sdteske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24238438Sdteske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25238438Sdteske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26238438Sdteske# SUCH DAMAGE. 27238438Sdteske# 28238438Sdteske# $FreeBSD: head/usr.sbin/bsdconfig/usermgmt/groupedit 240684 2012-09-18 22:28:42Z dteske $ 29238438Sdteske# 30238438Sdteske############################################################ INCLUDES 31238438Sdteske 32240684SdteskeBSDCFG_SHARE="/usr/share/bsdconfig" 33240684Sdteske. $BSDCFG_SHARE/common.subr || exit 1 34240684Sdteskef_include $BSDCFG_SHARE/dialog.subr 35240684Sdteskef_include $BSDCFG_SHARE/mustberoot.subr 36240684Sdteskef_include $BSDCFG_SHARE/usermgmt/group_input.subr 37238438Sdteske 38240684SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt" 39238438Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr 40238438Sdteske 41238438Sdteskeipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) 42238438Sdteske[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm" 43238438Sdteske 44238438Sdteske############################################################ MAIN 45238438Sdteske 46238438Sdteske# Incorporate rc-file if it exists 47238438Sdteske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" 48238438Sdteske 49238438Sdteske# 50238438Sdteske# Process command-line arguments 51238438Sdteske# 52238438Sdteskewhile getopts hSX flag; do 53238438Sdteske case "$flag" in 54238438Sdteske h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; 55238438Sdteske esac 56238438Sdteskedone 57238438Sdteskeshift $(( $OPTIND - 1 )) 58238438Sdteske 59238438Sdteske# 60238438Sdteske# Initialize 61238438Sdteske# 62238438Sdteskef_dialog_init 63238438Sdteskef_dialog_title "$msg_edit_view $msg_group" 64238438Sdteskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm" 65238438Sdteskef_mustberoot_init 66238438Sdteske 67238438Sdteske# 68238438Sdteske# Loop until the user Exits, Cancels or presses ESC 69238438Sdteske# 70238438Sdteskewhile :; do 71238438Sdteske f_dialog_menu_group_list 72238438Sdteske retval=$? 73238438Sdteske mtag=$( f_dialog_menutag ) 74238438Sdteske f_dprintf "retval=$retval mtag=[$mtag]" 75238438Sdteske 76238438Sdteske [ $retval -eq 0 ] || f_die 77238438Sdteske 78238438Sdteske case "$mtag" in 79238438Sdteske "X $msg_exit") break ;; 80238438Sdteske 81238438Sdteske *) # anything else is a group name 82238438Sdteske $BSDCFG_LIBE/$APP_DIR/groupinput \ 83238438Sdteske ${USE_XDIALOG:+-X} mode="Edit/View" group="$mtag" 84238438Sdteske ;; 85238438Sdteske 86238438Sdteske esac 87238438Sdteskedone 88238438Sdteske 89238438Sdteskeexit $SUCCESS 90238438Sdteske 91238438Sdteske################################################################################ 92238438Sdteske# END 93238438Sdteske################################################################################ 94