123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #!/bin/bash
- # while-menu-dialog: a menu driven system information program
- DIALOG_CANCEL=1
- DIALOG_ESC=255
- HEIGHT=0
- WIDTH=0
- display_result() {
- dialog --title "$1" \
- --no-collapse \
- --msgbox "$result" 0 0
- }
- while true; do
- exec 3>&1
- selection=$(dialog \
- --backtitle "CRUX updater" \
- --title "Menu" \
- --clear \
- --cancel-label "Exit" \
- --menu "Please select:" $HEIGHT $WIDTH 4 \
- "1" "CRUX ports update" \
- "2" "CRUX system update" \
- 2>&1 1>&3)
- exit_status=$?
- exec 3>&-
- case $exit_status in
- $DIALOG_CANCEL)
- clear
- echo "Program terminated."
- exit
- ;;
- $DIALOG_ESC)
- clear
- echo "Program aborted." >&2
- exit 1
- ;;
- esac
- case $selection in
- 1 )
- sudo ports -u
- scun notify
- ;;
- 2 )
- sudo prt-get sysup -is -im -if
- ;;
- esac
- done
|