1217309Snwhitehorn#! /bin/sh 2217309Snwhitehorn# $Id: passwordform1,v 1.5 2010/01/13 10:47:35 tom Exp $ 3217309Snwhitehorn 4217309Snwhitehorn. ./setup-vars 5217309Snwhitehorn 6217309Snwhitehornbacktitle="An Example for the use of --form:" 7217309Snwhitehorn 8217309Snwhitehornids=`id|sed -e 's/([^)]*)//g'` 9217309Snwhitehornuid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` 10217309Snwhitehorngid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` 11217309Snwhitehorn 12217309Snwhitehornuser="$USER" 13217309Snwhitehornhome="$HOME" 14217309Snwhitehorn 15217309Snwhitehornreturncode=0 16217309Snwhitehornwhile test $returncode != 1 && test $returncode != 250 17217309Snwhitehorndo 18217309Snwhitehornexec 3>&1 19217309Snwhitehornvalue=`$DIALOG --ok-label "Submit" \ 20217309Snwhitehorn --backtitle "$backtitle" \ 21217309Snwhitehorn --insecure "$@" \ 22217309Snwhitehorn --passwordform "Here is a possible piece of a configuration program." \ 23217309Snwhitehorn20 50 0 \ 24217309Snwhitehorn "Username:" 1 1 "$user" 1 10 10 0 \ 25217309Snwhitehorn "UID:" 2 1 "$uid" 2 10 8 0 \ 26217309Snwhitehorn "GID:" 3 1 "$gid" 3 10 8 0 \ 27217309Snwhitehorn "HOME:" 4 1 "$home" 4 10 40 0 \ 28217309Snwhitehorn2>&1 1>&3` 29217309Snwhitehornreturncode=$? 30217309Snwhitehornexec 3>&- 31217309Snwhitehorn 32217309Snwhitehornshow=`echo "$value" |sed -e 's/^/ /'` 33217309Snwhitehorn 34217309Snwhitehorn case $returncode in 35217309Snwhitehorn $DIALOG_CANCEL) 36217309Snwhitehorn "$DIALOG" \ 37217309Snwhitehorn --clear \ 38217309Snwhitehorn --backtitle "$backtitle" \ 39217309Snwhitehorn --yesno "Really quit?" 10 30 40217309Snwhitehorn case $? in 41217309Snwhitehorn $DIALOG_OK) 42217309Snwhitehorn break 43217309Snwhitehorn ;; 44217309Snwhitehorn $DIALOG_CANCEL) 45217309Snwhitehorn returncode=99 46217309Snwhitehorn ;; 47217309Snwhitehorn esac 48217309Snwhitehorn ;; 49217309Snwhitehorn $DIALOG_OK) 50217309Snwhitehorn "$DIALOG" \ 51217309Snwhitehorn --clear \ 52217309Snwhitehorn --backtitle "$backtitle" --no-collapse --cr-wrap \ 53217309Snwhitehorn --msgbox "Resulting data:\n\ 54217309Snwhitehorn$show" 10 40 55217309Snwhitehorn ;; 56217309Snwhitehorn $DIALOG_HELP) 57217309Snwhitehorn echo "Button 2 (Help) pressed." 58217309Snwhitehorn exit 59217309Snwhitehorn ;; 60217309Snwhitehorn $DIALOG_EXTRA) 61217309Snwhitehorn echo "Button 3 (Extra) pressed." 62217309Snwhitehorn exit 63217309Snwhitehorn ;; 64217309Snwhitehorn *) 65217309Snwhitehorn echo "Return code was $returncode" 66217309Snwhitehorn exit 67217309Snwhitehorn ;; 68217309Snwhitehorn esac 69217309Snwhitehorndone 70