rspm.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. #world (world branch addition, work in progress)
  28. case $PACKAGEMGR in
  29. "PORTAGE") #like in gentoo
  30. case $1 in
  31. "install") emerge $2 ;;
  32. "remove") emerge -C $2 ;;
  33. "update") emerge --sync ;;
  34. "upgrade") emerge -DuN ;;
  35. "search")
  36. if [ $eix == "true" ]; then #FIXME
  37. eix $2
  38. else
  39. emerge --search $2
  40. fi ;;
  41. "world") cat /var/lib/portage/world ;;
  42. esac
  43. ;;
  44. "PALUDIS") #like in exherbo
  45. case $1 in
  46. "install") cave resolve -x $2 ;;
  47. "remove") cave resolve -Px $2 ;; # ~ er, i've forgotten the paludis commands. ...
  48. "update") cave sync ;;
  49. "upgrade") cave resolve world -x ;;
  50. "search") cave search $2 ;;
  51. #"world") PLACEHOLDER ;;
  52. esac
  53. # etc
  54. ;;
  55. "APTGET") #like in devuan
  56. case $1 in
  57. "install") apt-get install $2 ;;
  58. "remove") apt-get remove $2 ;;
  59. "update") apt-get update ;;
  60. "upgrade") apt-get upgrade ;;
  61. "search") apt-cache search $2 ;;
  62. "world") apt-mark showmanual ;;
  63. esac
  64. ;;
  65. "SLAPTGET") #like in slackware?
  66. case $1 in
  67. "install") slapt-get install $2 ;;
  68. "remove") slapt-get remove $2 ;;
  69. "update") slapt-get update ;;
  70. "upgrade") slapt-get upgrade ;;
  71. "search") slapt-cache search $2 ;; #that right?? FIXME
  72. #"world") PLACEHOLDER ;;
  73. esac
  74. ;;
  75. "XBPS") #like in voidlinux
  76. case $1 in
  77. "install") xbps-install $2 ;;
  78. "remove") xbps-remove $2 ;;
  79. "update") xbps-install -S ;;
  80. "upgrade") xbps-install -Su ;;
  81. "search") xbps-query -Rs $2 ;;
  82. #"world") PLACEHOLDER ;;
  83. esac
  84. ;;
  85. "PACMAN") #like in archlinux
  86. case $1 in
  87. "install") pacman -S $2 ;;
  88. "remove") pacman -Rc $2 ;;
  89. "update") pacman -Sy ;;
  90. "upgrade") pacman -Syu ;;
  91. "search") pacman -Ss $2 ;;
  92. "world") pacman -Qqt ;;
  93. esac
  94. ;;
  95. #this segment could do with a double if check, or something.
  96. # "AUR") #like in archlinux
  97. "YAY") #like in archlinux
  98. case $1 in
  99. "install") yay -S $2 ;;
  100. "remove") yay -R $2 ;;
  101. "update") yay -Sy ;;
  102. "upgrade") yay -Sua ;;
  103. "search") yay -Ss $2 ;;
  104. #"world") PLACEHOLDER ;;
  105. esac
  106. ;;
  107. "ZYPPER") #like in suse
  108. case $1 in
  109. "install") zypper in $2 ;;
  110. "remove") zypper rm $2 ;;
  111. "update") zypper ref ;;
  112. "upgrade") zypper up ;;
  113. "search") zypper se $2 ;;
  114. #"world") PLACEHOLDER ;;
  115. esac
  116. ;;
  117. "GUIX") #like in guixsd
  118. case $1 in
  119. "install") guix package -i $2 ;;
  120. "remove") guix package -r $2 ;;
  121. "update") guix pull ;;
  122. "upgrade") guix package -u $2 ;;
  123. "search") guix package -s $2 ;;
  124. #"world") PLACEHOLDER ;;
  125. esac
  126. ;;
  127. "CPT") #like in carbs
  128. case $1 in
  129. # "install") cpt-build $2 ; cpt-install $2 ;;
  130. "install") cpt bi $2 ;;
  131. "remove") cpt-remove $2 ;;
  132. "update") cpt-update -0 ;; #as of cpt >v5.0
  133. "upgrade") cpt-update -n ;; #cpt-update (no options) updates&upgrades.
  134. "search") cpt-search $2 ;;
  135. #"world") PLACEHOLDER ;;
  136. esac
  137. ;;
  138. "APK") #like in alpine https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management
  139. case $1 in
  140. "install") apk add $2 ;;
  141. "remove") apk del $2 ;;
  142. "update") apk update ;;
  143. "upgrade") apk upgrade ;;
  144. "search") apk search $2 ;;
  145. #"world") cat /etc/apk/world ;;
  146. esac
  147. ;;
  148. "SCRATCH") #like in venom https://venomlinux.org/wiki#package-manager.introduction
  149. case $1 in
  150. "install") scratch install $2 ;;
  151. # "remove") scratch remove $2 ;;
  152. "remove") scratch purge $2 ;; #and orphaned dependancies
  153. "update") scratch sync ;;
  154. # "upgrade") scratch upgrade ;;
  155. "upgrade") scratch sysup ;; #full
  156. "search") scratch search $2 ;;
  157. #"world") PLACEHOLDER ;;
  158. esac
  159. ;;
  160. # may need several of these to meet each type set in pmm? doing just apt style for now
  161. "PMM") #like in bedrock (lol! pmm rather supercedes rspm, but ok)
  162. case $1 in
  163. "install") pmm install $2 ;;
  164. "remove") pmm remove $2 ;;
  165. "update") pmm update ;;
  166. "upgrade") pmm upgrade $2 ;;
  167. "search") pmm search $2 ;;
  168. #"world") PLACEHOLDER ;;
  169. esac
  170. ;;
  171. esac
  172. # ^ something like that. basic jist. now clean up, and repeat for other package managers.
  173. # 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. ;)