# $Id$ OK_LABEL=$"Next" CANCEL_LABEL=$"Back" # common dialog boxes messagebox() { 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 ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 [[ -z ${OK_LABEL} ]] && OK_LABEL="Next" dialog \ --colors \ --title "${header}" \ --backtitle "${TITLE}" \ --ok-label "${OK_LABEL}" \ --msgbox "${text}" "${height}" "${width}" } inputbox() { 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 ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 dialog \ --stdout \ --colors \ --title "${header}" \ --backtitle "${TITLE}" \ --inputbox "${text}" "${height}" "${width}" } passwordbox() { 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 ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 dialog \ --stdout \ --colors \ --title "${header}" \ --backtitle "${TITLE}" \ --insecure \ --passwordbox "${text}" "${height}" "${width}" } gaugebox() { 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 ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 dialog \ --colors \ --title "${header}" \ --backtitle "${TITLE}" \ --gauge "${text}" "${height}" "${width}" } yesnobox() { 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 ${text} ]] && die "no text given" [[ -z ${height} ]] && height=0 [[ -z ${width} ]] && width=0 dialog \ --colors \ --title "${header}" \ --backtitle "${TITLE}" \ --defaultno \ --yesno "${text}" "${height}" "${width}" } welcome() { messagebox "Welcome" "Welcome to the ${DEFAULT_TITLE}.\n\n\nPress [Enter] to continue." 10 45; } finish() { OK_LABEL="Exit" messagebox "Finish" "Installation was successfully finished." 10 40; }