12a3e3873SBaptiste Daroussin#! /bin/sh 2*a96ef450SBaptiste Daroussin# $Id: inputmenu,v 1.19 2020/11/26 00:30:23 tom Exp $ 34c8945a0SNathan Whitehorn# 2002 - written by Tobias Rittweiler <tobrit@freebits.de> 44c8945a0SNathan Whitehorn 54c8945a0SNathan Whitehorn. ./setup-vars 64c8945a0SNathan Whitehorn 72a3e3873SBaptiste Daroussinuser="$USER" 82a3e3873SBaptiste Daroussinuid=`id|sed -e 's/^uid=//' -e 's/(.*//'` 92a3e3873SBaptiste Daroussingid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'` 102a3e3873SBaptiste Daroussinhome="$HOME" 114c8945a0SNathan Whitehorn 12*a96ef450SBaptiste Daroussinwhile [ "${returncode:-99}" -ne 1 ] && [ "${returncode:-99}" -ne 250 ]; do 134c8945a0SNathan Whitehorn exec 3>&1 14*a96ef450SBaptiste Daroussin returntext=`$DIALOG \ 152a3e3873SBaptiste Daroussin --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" \ 214c8945a0SNathan Whitehorn"UID:" "$uid" \ 224c8945a0SNathan Whitehorn"GID:" "$gid" \ 234c8945a0SNathan Whitehorn"HOME:" "$home" \ 242a3e3873SBaptiste Daroussin2>&1 1>&3 ` 254c8945a0SNathan Whitehorn returncode=$? 264c8945a0SNathan Whitehorn exec 3>&- 274c8945a0SNathan Whitehorn case $returncode in 284c8945a0SNathan Whitehorn $DIALOG_CANCEL) 292a3e3873SBaptiste Daroussin "$DIALOG" \ 302a3e3873SBaptiste Daroussin --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;; 344c8945a0SNathan Whitehorn $DIALOG_CANCEL) returncode=99;; 354c8945a0SNathan Whitehorn esac 364c8945a0SNathan Whitehorn ;; 374c8945a0SNathan Whitehorn $DIALOG_OK) 382a3e3873SBaptiste Daroussin "$DIALOG" \ 392a3e3873SBaptiste Daroussin --clear --backtitle "An Example for the use of --inputmenu:" \ 404c8945a0SNathan Whitehorn --msgbox "useradd \n\ 414c8945a0SNathan Whitehorn -d $home \n\ 424c8945a0SNathan Whitehorn -u $uid \n\ 434c8945a0SNathan Whitehorn -g $gid \n\ 444c8945a0SNathan Whitehorn $user" 10 40 454c8945a0SNathan Whitehorn ;; 464c8945a0SNathan Whitehorn $DIALOG_EXTRA) 47*a96ef450SBaptiste Daroussin value=`echo "$returntext" | sed -e 's/^RENAMED //'` 482a3e3873SBaptiste Daroussin tag=`echo "$value" | sed -e 's/:.*//'` 492a3e3873SBaptiste Daroussin 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 59*a96ef450SBaptiste Daroussin *) 60*a96ef450SBaptiste Daroussin . ./report-button 614c8945a0SNathan Whitehorn break 624c8945a0SNathan Whitehorn ;; 634c8945a0SNathan Whitehorn 644c8945a0SNathan Whitehorn esac 654c8945a0SNathan Whitehorndone 66