dotfiles 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 "Dotfiles master v1.1" \
  16. --title "Menu" \
  17. --clear \
  18. --cancel-label "Exit" \
  19. --menu "Please select:" $HEIGHT $WIDTH 4 \
  20. "1" "Inspect" \
  21. "2" "Backup" \
  22. "3" "Install" \
  23. 2>&1 1>&3)
  24. exit_status=$?
  25. exec 3>&-
  26. case $exit_status in
  27. $DIALOG_CANCEL)
  28. clear
  29. echo "Program terminated."
  30. exit
  31. ;;
  32. $DIALOG_ESC)
  33. clear
  34. echo "Program aborted." >&2
  35. exit 1
  36. ;;
  37. esac
  38. case $selection in
  39. 1 )
  40. vim dotfiles
  41. ;;
  42. 2 )
  43. cp ~/.bashrc ./
  44. cp ~/.conkyrc ./
  45. cp ~/.gtkrc-2.0 ./
  46. cp ~/.xinitrc ./
  47. cp ~/.Xresources ./
  48. cp -r ~/.config/ ./
  49. ;;
  50. 3 )
  51. cp .bashrc ~/
  52. cp .conkyrc ~/
  53. cp .gtkrc-2.0 ~/
  54. cp .xinitrc ~/
  55. cp .Xresources ~/
  56. cp -r .config/ ~/
  57. ;;
  58. esac
  59. done