groupedit revision 259054
1139826Simp#!/bin/sh 253541Sshin#- 353541Sshin# Copyright (c) 2012 Ron McDowell 453541Sshin# Copyright (c) 2012-2013 Devin Teske 553541Sshin# All rights reserved. 653541Sshin# 753541Sshin# Redistribution and use in source and binary forms, with or without 853541Sshin# modification, are permitted provided that the following conditions 953541Sshin# are met: 1053541Sshin# 1. Redistributions of source code must retain the above copyright 1153541Sshin# notice, this list of conditions and the following disclaimer. 1253541Sshin# 2. Redistributions in binary form must reproduce the above copyright 1353541Sshin# notice, this list of conditions and the following disclaimer in the 1453541Sshin# documentation and/or other materials provided with the distribution. 1553541Sshin# 1653541Sshin# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1753541Sshin# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1853541Sshin# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1953541Sshin# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2053541Sshin# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2153541Sshin# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2253541Sshin# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2353541Sshin# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2453541Sshin# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2553541Sshin# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2653541Sshin# SUCH DAMAGE. 2753541Sshin# 28174510Sobrien# $FreeBSD: head/usr.sbin/bsdconfig/usermgmt/groupedit 259054 2013-12-07 00:31:01Z dteske $ 29174510Sobrien# 3053541Sshin############################################################ INCLUDES 3153541Sshin 32174510SobrienBSDCFG_SHARE="/usr/share/bsdconfig" 33174510Sobrien. $BSDCFG_SHARE/common.subr || exit 1 34174510Sobrienf_dprintf "%s: loading includes..." "$0" 3553541Sshinf_include $BSDCFG_SHARE/dialog.subr 3653541Sshinf_include $BSDCFG_SHARE/mustberoot.subr 3753541Sshinf_include $BSDCFG_SHARE/usermgmt/group_input.subr 3853541Sshin 3953541SshinBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="070.usermgmt" 4053541Sshinf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr 4178064Sume 4253541Sshinf_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm && 43181803Sbz pgm="${ipgm:-$pgm}" 4453541Sshin 4553541Sshin############################################################ MAIN 4653541Sshin 4753541Sshin# Incorporate rc-file if it exists 4853541Sshin[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" 4953541Sshin 5053541Sshin# 5153541Sshin# Process command-line arguments 5253541Sshin# 5381127Sumewhile getopts h$GETOPTS_STDARGS flag; do 5453541Sshin case "$flag" in 5562587Sitojun h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;; 5653541Sshin esac 5778064Sumedone 5881127Sumeshift $(( $OPTIND - 1 )) 5953541Sshin 6053541Sshin# 6153541Sshin# Initialize 6262587Sitojun# 6353541Sshinf_dialog_title "$msg_edit_view $msg_group" 6462587Sitojunf_dialog_backtitle "${ipgm:+bsdconfig }$pgm" 6553541Sshinf_mustberoot_init 6678064Sume 6778064Sume# 6878064Sume# Loop until the user Exits, Cancels or presses ESC 69163306Sume# 7078064Sumedefaultitem="" 7178064Sumewhile :; do 7278064Sume f_dialog_menu_group_list "$defaultitem" 7378064Sume retval=$? 7481127Sume f_dialog_menutag_fetch mtag 7581127Sume f_dprintf "retval=%s mtag=[%s]" $retval "$mtag" 7681127Sume defaultitem="$mtag" 77175162Sobrien 78175162Sobrien [ $retval -eq $DIALOG_OK ] || f_die 79175162Sobrien 80175162Sobrien [ "$mtag" = "X $msg_exit" ] && break 81175162Sobrien 82175162Sobrien # Anything else is a group name 8353541Sshin 8462587Sitojun $BSDCFG_LIBE/$APP_DIR/groupinput \ 8562587Sitojun ${USE_XDIALOG:+-X} mode="Edit/View" group="$mtag" 8662587Sitojundone 8762587Sitojun 8862587Sitojunexit $SUCCESS 8962587Sitojun 9062587Sitojun################################################################################ 9153541Sshin# END 9262587Sitojun################################################################################ 9362587Sitojun