rspm.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #!/bin/bash
  2. # Rosetta Stone Package Manager
  3. # originally developed as part of witch
  4. # https://github.com/Digit/witch/issues/18
  5. #~ now hacking to be stand alone
  6. # https://notabug.org/digit/rspm
  7. #this is still just doodling around a proof of concept
  8. #put this file in your $PATH somewhere (like /bin/rspm)
  9. #make this executable (like sudo chmod +x /bin/rspm)
  10. #run it. (like rspm update && rspm install tmux)
  11. ##################################################
  12. #set your package manager here
  13. #as part of witch:
  14. #PACKAGEMGR=$(sed -n '4p' $WITCH/config.base.txt)
  15. #stand alone:
  16. #PACKAGEMGR=APTGET
  17. #used in bedrock:
  18. #PACKAGEMANAGER=${insert fancy script here}
  19. #and also now that pmm is a thing, consider wrapping for it too! :D
  20. ##################################################
  21. #basics first. AFTER we get these, we can futz over the finer grained nuanced commands.
  22. #install
  23. #remove
  24. #update
  25. #upgrade
  26. #search
  27. case $PACKAGEMGR in
  28. "PORTAGE") #like in gentoo
  29. case $1 in
  30. "install") emerge $2 ;;
  31. "remove") emerge -C $2 ;;
  32. "update") emerge --sync ;;
  33. "upgrade") emerge -DuN ;;
  34. "search")
  35. if [ $eix == "true" ]; then #FIXME
  36. eix $2
  37. else
  38. emerge --search $2
  39. fi
  40. ;;
  41. esac
  42. ;;
  43. "PALUDIS") #like in exherbo
  44. case $1 in
  45. "install") cave resolve -x $2 ;;
  46. "remove") cave resolve -Px $2 ;; # ~ er, i've forgotten the paludis commands. ...
  47. "update") cave sync ;;
  48. "upgrade") cave resolve world -x ;;
  49. "search") cave search $2 ;;
  50. esac
  51. # etc
  52. ;;
  53. "APTGET") #like in devuan
  54. case $1 in
  55. "install") apt-get install $2 ;;
  56. "remove") apt-get remove $2 ;;
  57. "update") apt-get update ;;
  58. "upgrade") apt-get upgrade ;;
  59. "search") apt-cache search $2 ;;
  60. esac
  61. ;;
  62. "SLAPTGET") #like in slackware?
  63. case $1 in
  64. "install") slapt-get install $2 ;;
  65. "remove") slapt-get remove $2 ;;
  66. "update") slapt-get update ;;
  67. "upgrade") slapt-get upgrade ;;
  68. "search") slapt-cache search $2 ;; #that right?? FIXME
  69. esac
  70. ;;
  71. "XBPS") #like in voidlinux
  72. case $1 in
  73. "install") xbps-install $2 ;;
  74. "remove") xbps-remove $2 ;;
  75. "update") xbps-install -S ;;
  76. "upgrade") xbps-install -Su ;;
  77. "search") xbps-query -Rs $2 ;;
  78. esac
  79. ;;
  80. "PACMAN") #like in archlinux
  81. case $1 in
  82. "install") pacman -S $2 ;;
  83. "remove") pacman -Rc $2 ;;
  84. "update") pacman -Sy ;;
  85. "upgrade") pacman -Syu ;;
  86. "search") pacman -Ss $2 ;;
  87. esac
  88. ;;
  89. #this segment could do with a double if check, or something.
  90. # "AUR") #like in archlinux
  91. "YAY") #like in archlinux
  92. case $1 in
  93. "install") yay -S $2 ;;
  94. "remove") yay -R $2 ;;
  95. "update") yay -Sy ;;
  96. "upgrade") yay -Sua ;;
  97. "search") yay -Ss $2 ;;
  98. esac
  99. ;;
  100. "ZYPPER") #like in suse
  101. case $1 in
  102. "install") zypper in $2 ;;
  103. "remove") zypper rm $2 ;;
  104. "update") zypper ref ;;
  105. "upgrade") zypper up ;;
  106. "search") zypper se $2 ;;
  107. esac
  108. ;;
  109. "GUIX") #like in guixsd
  110. case $1 in
  111. "install") guix package -i $2 ;;
  112. "remove") guix package -r $2 ;;
  113. "update") guix pull ;;
  114. "upgrade") guix package -u $2 ;;
  115. "search") guix package -s $2 ;;
  116. esac
  117. ;;
  118. "CPT") #like in carbs
  119. case $1 in
  120. # "install") cpt-build $2 ; cpt-install $2 ;;
  121. "install") cpt bi $2 ;;
  122. "remove") cpt-remove $2 ;;
  123. "update") cpt-update -0 ;; #as of cpt >v5.0
  124. "upgrade") cpt-update -n ;; #cpt-update (no options) updates&upgrades.
  125. "search") cpt-search $2 ;;
  126. esac
  127. ;;
  128. "APK") #like in alpine https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management
  129. case $1 in
  130. "install") apk add $2 ;;
  131. "remove") apk del $2 ;;
  132. "update") apk update ;;
  133. "upgrade") apk upgrade ;;
  134. "search") apk search $2 ;;
  135. esac
  136. ;;
  137. "SCRATCH") #like in venom https://venomlinux.org/wiki#package-manager.introduction
  138. case $1 in
  139. "install") scratch install $2 ;;
  140. # "remove") scratch remove $2 ;;
  141. "remove") scratch purge $2 ;; #and orphaned dependancies
  142. "update") scratch sync ;;
  143. # "upgrade") scratch upgrade ;;
  144. "upgrade") scratch sysup ;; #full
  145. "search") scratch search $2 ;;
  146. esac
  147. ;;
  148. # may need several of these to meet each type set in pmm? doing just apt style for now
  149. "PMM") #like in bedrock (lol! pmm rather supercedes rspm, but ok)
  150. case $1 in
  151. "install") pmm install $2 ;;
  152. "remove") pmm remove $2 ;;
  153. "update") pmm update ;;
  154. "upgrade") pmm upgrade $2 ;;
  155. "search") pmm search $2 ;;
  156. esac
  157. ;;
  158. esac
  159. # ^ something like that. basic jist. now clean up, and repeat for other package managers.
  160. # 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. ;)