Guest User

Untitled

a guest
Jul 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # TODO: short desc
  4. # DEPS: portageq, realpath (portage, coreutils)
  5.  
  6. function explore {
  7. local relroot cur
  8. if [ "$#" -ge "1" ]; then
  9. relroot="${1}"
  10. else
  11. echo "[-] Error, wrong number of arguments passed to explore"
  12. exit
  13. fi
  14.  
  15. cur="${relroot}"
  16. if [ "$#" -eq "2" ]; then
  17. cur="${relroot}/${2}"
  18. elif [ "$#" -gt "2" ]; then
  19. echo "[-] Error, wrong number of arguments passed to explore"
  20. exit
  21. fi
  22.  
  23. cur="$(realpath ${cur})"
  24.  
  25. # Get packages files
  26. if [ -e "${cur}/packages" ]; then
  27. echo "[+] ${cur}/packages"
  28. fi
  29.  
  30. if [ -e "${cur}/parent" ]; then
  31. while read -r line || [[ -n "${line}" ]]; do
  32. explore "${cur}" "${line}"
  33. done < "${cur}/parent"
  34. fi
  35. }
  36.  
  37. EROOT="$(portageq envvar EROOT)"
  38. PORTDIR="$(portageq get_repo_path ${EROOT} gentoo)"
  39. CURPROFILEDIR="$(realpath ${EROOT}/etc/portage/make.profile)"
  40.  
  41. echo "[+] EROOT : ${EROOT}"
  42. echo "[+] PORTDIR : ${PORTDIR}"
  43. echo "[+] CURPROFILE: ${CURPROFILEDIR#${PORTDIR}/profiles/}"
  44.  
  45. EAPI="0"
  46.  
  47. if [ -e "${CURPROFILEDIR}/eapi" ]
  48. then
  49. EAPI=$(<"${CURPROFILEDIR}/eapi")
  50. fi
  51. echo "[+] EAPI : ${EAPI}"
  52.  
  53. # Deprecated file : I dont care about it for now
  54.  
  55. explore "${CURPROFILEDIR}"
Add Comment
Please, Sign In to add comment