dnf 949 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/bash
  2. updatey() {
  3. if test $# = 0
  4. then
  5. apt-get -y update && apt-get -y upgrade
  6. else
  7. apt-get -y install $@
  8. fi
  9. }
  10. yes() {
  11. if test "$1" = "install"
  12. then
  13. apt-get -y install ${@:2}
  14. elif test "$1" = "install"
  15. then
  16. apt-get -y purge ${@:2}
  17. apt-get -y install ${@:2}
  18. elif test "$1" = "upgrade"
  19. then
  20. updatey ${@:2}
  21. elif test "$1" = "remove"
  22. then
  23. apt-get -y purge ${@:2}
  24. else
  25. echo E: Invalid operation $1
  26. fi
  27. }
  28. update() {
  29. if test $# = 0
  30. then
  31. apt-get update && apt-get upgrade
  32. else
  33. apt-get install $@
  34. fi
  35. }
  36. if test "$2" = "-y"
  37. then
  38. yes $1 ${@:3}
  39. exit
  40. fi
  41. if test "$1" = "install"
  42. then
  43. apt-get install ${@:2}
  44. elif test "$1" = "reinstall"
  45. then
  46. apt-get purge ${@:2}
  47. apt-get install ${@:2}
  48. elif test "$1" = "autoremove"
  49. then
  50. apt-get autoremove
  51. elif test "$1" = "upgrade"
  52. then
  53. update $2
  54. elif test "$1" = "info"
  55. then
  56. apt-cache show $2
  57. elif test "$1" = "remove"
  58. then
  59. apt-get purge ${@:2}
  60. else
  61. echo E: Invalid operation $1
  62. fi