1*19718649SNathan Whitehorn#! /bin/sh 2*19718649SNathan Whitehorn# $Id: inputmenu,v 1.19 2020/11/26 00:30:23 tom Exp $ 34c8945a0SNathan Whitehorn# 2002 - written by Tobias Rittweiler <[email protected]> 44c8945a0SNathan Whitehorn 54c8945a0SNathan Whitehorn. ./setup-vars 64c8945a0SNathan Whitehorn 7*19718649SNathan Whitehornuser="$USER" 8*19718649SNathan Whitehornuid=`id|sed -e 's/^uid=//' -e 's/(.*//'` 94c8945a0SNathan Whitehorngid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'` 104c8945a0SNathan Whitehornhome="$HOME" 114c8945a0SNathan Whitehorn 12*19718649SNathan Whitehornwhile [ "${returncode:-99}" -ne 1 ] && [ "${returncode:-99}" -ne 250 ]; do 134c8945a0SNathan Whitehorn exec 3>&1 144c8945a0SNathan Whitehorn returntext=`$DIALOG \ 154c8945a0SNathan Whitehorn --clear --ok-label "Create" \ 164c8945a0SNathan Whitehorn --backtitle "An Example for the use of --inputmenu:" "$@" \ 174c8945a0SNathan Whitehorn --inputmenu "Originally I designed --inputmenu for a \ 184c8945a0SNathan Whitehornconfiguration purpose. Here is a possible piece of a configuration program. \ 194c8945a0SNathan Whitehorn" 20 50 10 \ 204c8945a0SNathan Whitehorn"Username:" "$user" \ 21*19718649SNathan Whitehorn"UID:" "$uid" \ 224c8945a0SNathan Whitehorn"GID:" "$gid" \ 234c8945a0SNathan Whitehorn"HOME:" "$home" \ 244c8945a0SNathan Whitehorn2>&1 1>&3 ` 254c8945a0SNathan Whitehorn returncode=$? 26*19718649SNathan Whitehorn exec 3>&- 274c8945a0SNathan Whitehorn case $returncode in 284c8945a0SNathan Whitehorn $DIALOG_CANCEL) 294c8945a0SNathan Whitehorn "$DIALOG" \ 304c8945a0SNathan Whitehorn --clear --backtitle "An Example for the use of --inputmenu:" \ 314c8945a0SNathan Whitehorn --yesno "Really quit?" 10 30 324c8945a0SNathan Whitehorn case $? in 334c8945a0SNathan Whitehorn $DIALOG_OK) break;; 34*19718649SNathan Whitehorn $DIALOG_CANCEL) returncode=99;; 354c8945a0SNathan Whitehorn esac 364c8945a0SNathan Whitehorn ;; 374c8945a0SNathan Whitehorn $DIALOG_OK) 384c8945a0SNathan Whitehorn "$DIALOG" \ 394c8945a0SNathan Whitehorn --clear --backtitle "An Example for the use of --inputmenu:" \ 404c8945a0SNathan Whitehorn --msgbox "useradd \n\ 414c8945a0SNathan Whitehorn -d $home \n\ 42*19718649SNathan Whitehorn -u $uid \n\ 43*19718649SNathan Whitehorn -g $gid \n\ 44*19718649SNathan Whitehorn $user" 10 40 454c8945a0SNathan Whitehorn ;; 464c8945a0SNathan Whitehorn $DIALOG_EXTRA) 474c8945a0SNathan Whitehorn value=`echo "$returntext" | sed -e 's/^RENAMED //'` 484c8945a0SNathan Whitehorn tag=`echo "$value" | sed -e 's/:.*//'` 494c8945a0SNathan Whitehorn item=`echo "$value" | sed -e 's/^[^:]*:[ ][ ]*//'` 504c8945a0SNathan Whitehorn 514c8945a0SNathan Whitehorn case "$tag" in 524c8945a0SNathan Whitehorn Username) user="$item" ;; 534c8945a0SNathan Whitehorn UID) uid="$item" ;; 544c8945a0SNathan Whitehorn GID) gid="$item" ;; 554c8945a0SNathan Whitehorn HOME) home="$item" ;; 564c8945a0SNathan Whitehorn esac 574c8945a0SNathan Whitehorn ;; 584c8945a0SNathan Whitehorn 594c8945a0SNathan Whitehorn *) 604c8945a0SNathan Whitehorn . ./report-button 61 break 62 ;; 63 64 esac 65done 66