| Line | |
|---|
| 1 | # -*-Shell-script-*- |
|---|
| 2 | # |
|---|
| 3 | # functions_dialog This file contains dialog's functions to be used by Oreon install scripts |
|---|
| 4 | # |
|---|
| 5 | |
|---|
| 6 | ## |
|---|
| 7 | ## Clear |
|---|
| 8 | ## |
|---|
| 9 | |
|---|
| 10 | function clear_all() { |
|---|
| 11 | rm $TEMP2 2> /dev/null |
|---|
| 12 | rm $TEMP_PATH 2> /dev/null |
|---|
| 13 | rm $TEMP 2> /dev/null |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | ## |
|---|
| 17 | ## Functions |
|---|
| 18 | ## |
|---|
| 19 | |
|---|
| 20 | # previous |
|---|
| 21 | function prev_funct() { |
|---|
| 22 | clear |
|---|
| 23 | clear_all |
|---|
| 24 | exit |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | # quit |
|---|
| 28 | function quit() { |
|---|
| 29 | |
|---|
| 30 | log_set_err "The script was aborted, Installation failed." |
|---|
| 31 | |
|---|
| 32 | clear |
|---|
| 33 | echo "" |
|---|
| 34 | echo "The script was aborted, Installation failed." |
|---|
| 35 | echo "" |
|---|
| 36 | clear_all |
|---|
| 37 | exit 1 |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | # test before quit |
|---|
| 41 | function test_quit() { |
|---|
| 42 | $DIALOG --backtitle "$BACKTITLE" --title "$TITLE" \ |
|---|
| 43 | --no-label "Yes" --yes-label "No"\ |
|---|
| 44 | --yesno "$1\n" 9 62 |
|---|
| 45 | resp=$? |
|---|
| 46 | if [ $resp != 0 ]; then |
|---|
| 47 | $DIALOG --backtitle "$BACKTITLE" --title "$TITLE" \ |
|---|
| 48 | --msgbox "\nCentreon Installatin was aborted." 7 50 |
|---|
| 49 | log_set_err "Centreon Installatin was aborted." |
|---|
| 50 | clear |
|---|
| 51 | clear_all |
|---|
| 52 | exit 1 |
|---|
| 53 | fi |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | ## |
|---|
| 57 | ## Dialog function |
|---|
| 58 | ## |
|---|
| 59 | |
|---|
| 60 | function dialog_input() { |
|---|
| 61 | rm $TEMP 2> /dev/null |
|---|
| 62 | temp=0 |
|---|
| 63 | $DIALOG --backtitle "$BACKTITLE" --title "$TITLE" \ |
|---|
| 64 | --extra-button --extra-label " Cancel "\ |
|---|
| 65 | --cancel-label " Previous " \ |
|---|
| 66 | --inputbox "$1" 9 62 "$2" 2> $TEMP |
|---|
| 67 | temp=$? |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | function dialog_input2() { |
|---|
| 71 | rm $TEMP 2> /dev/null |
|---|
| 72 | temp=0 |
|---|
| 73 | $DIALOG --backtitle "$BACKTITLE" --title "$TITLE" \ |
|---|
| 74 | --cancel-label " Cancel " \ |
|---|
| 75 | --inputbox "$1" 9 62 "$2" 2> $TEMP |
|---|
| 76 | temp=$? |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | function dialog_infobox2() { |
|---|
| 81 | temp=0 |
|---|
| 82 | dialog --backtitle "$BACKTITLE" --title "$TITLE" \ |
|---|
| 83 | --infobox "$1" 9 62 |
|---|
| 84 | temp=$? |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | function dialog_msgbox() { |
|---|
| 88 | temp=0 |
|---|
| 89 | $DIALOG --backtitle "$BACKTITLE" --title "$TITLE" \ |
|---|
| 90 | --msgbox "$1" 9 62 |
|---|
| 91 | temp=$? |
|---|
| 92 | } |
|---|