CRUX 858 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # while-menu-dialog: a menu driven system information program
  3. DIALOG_CANCEL=1
  4. DIALOG_ESC=255
  5. HEIGHT=0
  6. WIDTH=0
  7. display_result() {
  8. dialog --title "$1" \
  9. --no-collapse \
  10. --msgbox "$result" 0 0
  11. }
  12. while true; do
  13. exec 3>&1
  14. selection=$(dialog \
  15. --backtitle "CRUX updater" \
  16. --title "Menu" \
  17. --clear \
  18. --cancel-label "Exit" \
  19. --menu "Please select:" $HEIGHT $WIDTH 4 \
  20. "1" "CRUX ports update" \
  21. "2" "CRUX system update" \
  22. 2>&1 1>&3)
  23. exit_status=$?
  24. exec 3>&-
  25. case $exit_status in
  26. $DIALOG_CANCEL)
  27. clear
  28. echo "Program terminated."
  29. exit
  30. ;;
  31. $DIALOG_ESC)
  32. clear
  33. echo "Program aborted." >&2
  34. exit 1
  35. ;;
  36. esac
  37. case $selection in
  38. 1 )
  39. sudo ports -u
  40. scun notify
  41. ;;
  42. 2 )
  43. sudo prt-get sysup -is -im -if
  44. ;;
  45. esac
  46. done