rspm.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # Rosetta Stone Package Manager
  3. # https://github.com/Digit/witch/issues/18
  4. #this is just an initial laying out ... much change is expected, and it is not expected to work yet.
  5. PACKAGEMGR=$(sed -n '4p' $WITCH/config.base.txt)
  6. #basics first. AFTER we get these, we can futz over the finer grained nuanced commands.
  7. #install
  8. #remove
  9. #update
  10. #upgrade
  11. #search
  12. case $PACKAGEMGR in
  13. "PORTAGE")
  14. case $1 in
  15. "install") emerge $2 ;;
  16. "remove") emerge -C $2 ;;
  17. "update") emerge --sync ;;
  18. "upgrade") emerge -DuN ;;
  19. "search")
  20. if [ $eix == "true" ]; then #FIXME
  21. eix $2
  22. else
  23. emerge --search $2
  24. fi
  25. ;;
  26. esac
  27. ;;
  28. "PALUDIS")
  29. case $1 in
  30. "install") cave resolve -x $2 ;;
  31. "remove") cave resolve -Px $2 ;; # ~ er, i've forgotten the paludis commands. ...
  32. "update") cave sync ;;
  33. "upgrade") cave resolve world -x ;;
  34. "search") cave search $2 ;;
  35. esac
  36. # etc
  37. ;;
  38. "APTGET")
  39. case $1 in
  40. "install") apt-get install $2 ;;
  41. "remove") apt-get remove $2 ;;
  42. "update") apt-get update ;;
  43. "upgrade") apt-get upgrade ;;
  44. "search") apt-cache search $2 ;;
  45. esac
  46. ;;
  47. "SLAPTGET")
  48. case $1 in
  49. "install") slapt-get install $2 ;;
  50. "remove") slapt-get remove $2 ;;
  51. "update") slapt-get update ;;
  52. "upgrade") slapt-get upgrade ;;
  53. "search") slapt-cache search $2 ;; #that right?? FIXME
  54. esac
  55. ;;
  56. "XBPS")
  57. case $1 in
  58. "install") xbps-install $2 ;;
  59. "remove") xbps-remove $2 ;;
  60. "update") xbps-install -S ;;
  61. "upgrade") xbps-install -Su ;;
  62. "search") xbps-query -Rs $2 ;;
  63. esac
  64. ;;
  65. "PACMAN")
  66. case $1 in
  67. "install") pacman -S $2 ;;
  68. "remove") pacman -Rc $2 ;;
  69. "update") pacman -Sy ;;
  70. "upgrade") pacman -Syu ;;
  71. "search") pacman -Ss $2 ;;
  72. esac
  73. ;;
  74. "ZYPPER")
  75. case $1 in
  76. "install") zypper in $2 ;;
  77. "remove") zypper rm $2 ;;
  78. "update") zypper ref ;;
  79. "upgrade") zypper up ;;
  80. "search") zypper se $2 ;;
  81. esac
  82. ;;
  83. "GUIX")
  84. case $1 in
  85. "install") guix package -i $2 ;;
  86. "remove") guix package -r $2 ;;
  87. "update") guix pull ;;
  88. "upgrade") guix package -u $2 ;;
  89. "search") guix package -s $2 ;;
  90. esac
  91. ;;
  92. esac
  93. # ^ something like that. basic jist. now clean up, and repeat for other package managers.
  94. # feel free to come up with a better way... this is just an initial jotting down of the concept... not clean code. SO LETS NOT PUT rspm COMMANDS ANYWHERE UNTIL IT IS REAL WORKING CODE. ;)