--- trunk/installer-simple/functions/common-dialogs.sh 2014/01/07 12:46:03 2391 +++ trunk/installer-simple/functions/common-dialogs.sh 2014/01/07 12:56:52 2393 @@ -6,12 +6,25 @@ # common dialog boxes messagebox() { - local header="$1" - local text="$2" - local height="$3" - local width="$4" + local header + local text + local height + local width + + # very basic getops + local OPTIND opt + while getopts ":h:y:x:" opt + do + case ${opt} in + h) header="${OPTARG}" ;; + y) height="${OPTARG}" ;; + x) width="${OPTARG}" ;; + esac + done + shift $((OPTIND-1)) + text="$@" - [[ -z ${header} ]] && die "no header given" + #[[ -z ${header} ]] && die "no header given" [[ -z ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 @@ -28,12 +41,25 @@ inputbox() { - local header="$1" - local text="$2" - local height="$3" - local width="$4" + local header + local text + local height + local width + + # very basic getops + local OPTIND opt + while getopts ":h:y:x:" opt + do + case ${opt} in + h) header="${OPTARG}" ;; + y) height="${OPTARG}" ;; + x) width="${OPTARG}" ;; + esac + done + shift $((OPTIND-1)) + text="$@" - [[ -z ${header} ]] && die "no header given" + #[[ -z ${header} ]] && die "no header given" [[ -z ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 @@ -48,12 +74,25 @@ passwordbox() { - local header="$1" - local text="$2" - local height="$3" - local width="$4" + local header + local text + local height + local width + + # very basic getops + local OPTIND opt + while getopts ":h:y:x:" opt + do + case ${opt} in + h) header="${OPTARG}" ;; + y) height="${OPTARG}" ;; + x) width="${OPTARG}" ;; + esac + done + shift $((OPTIND-1)) + text="$@" - [[ -z ${header} ]] && die "no header given" + #[[ -z ${header} ]] && die "no header given" [[ -z ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 @@ -69,12 +108,25 @@ gaugebox() { - local header="$1" - local text="$2" - local height="$3" - local width="$4" + local header + local text + local height + local width + + # very basic getops + local OPTIND opt + while getopts ":h:y:x:" opt + do + case ${opt} in + h) header="${OPTARG}" ;; + y) height="${OPTARG}" ;; + x) width="${OPTARG}" ;; + esac + done + shift $((OPTIND-1)) + text="$@" - [[ -z ${header} ]] && die "no header given" + #[[ -z ${header} ]] && die "no header given" [[ -z ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 @@ -88,12 +140,25 @@ yesnobox() { - local header="$1" - local text="$2" - local height="$3" - local width="$4" + local header + local text + local height + local width + + # very basic getops + local OPTIND opt + while getopts ":h:y:x:" opt + do + case ${opt} in + h) header="${OPTARG}" ;; + y) height="${OPTARG}" ;; + x) width="${OPTARG}" ;; + esac + done + shift $((OPTIND-1)) + text="$@" - [[ -z ${header} ]] && die "no header given" + #[[ -z ${header} ]] && die "no header given" [[ -z ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0