Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # TODO: short desc
- # DEPS: portageq, realpath (portage, coreutils)
- function explore {
- local relroot cur
- if [ "$#" -ge "1" ]; then
- relroot="${1}"
- else
- echo "[-] Error, wrong number of arguments passed to explore"
- exit
- fi
- cur="${relroot}"
- if [ "$#" -eq "2" ]; then
- cur="${relroot}/${2}"
- elif [ "$#" -gt "2" ]; then
- echo "[-] Error, wrong number of arguments passed to explore"
- exit
- fi
- cur="$(realpath ${cur})"
- # Get packages files
- if [ -e "${cur}/packages" ]; then
- echo "[+] ${cur}/packages"
- fi
- if [ -e "${cur}/parent" ]; then
- while read -r line || [[ -n "${line}" ]]; do
- explore "${cur}" "${line}"
- done < "${cur}/parent"
- fi
- }
- EROOT="$(portageq envvar EROOT)"
- PORTDIR="$(portageq get_repo_path ${EROOT} gentoo)"
- CURPROFILEDIR="$(realpath ${EROOT}/etc/portage/make.profile)"
- echo "[+] EROOT : ${EROOT}"
- echo "[+] PORTDIR : ${PORTDIR}"
- echo "[+] CURPROFILE: ${CURPROFILEDIR#${PORTDIR}/profiles/}"
- EAPI="0"
- if [ -e "${CURPROFILEDIR}/eapi" ]
- then
- EAPI=$(<"${CURPROFILEDIR}/eapi")
- fi
- echo "[+] EAPI : ${EAPI}"
- # Deprecated file : I dont care about it for now
- explore "${CURPROFILEDIR}"
Add Comment
Please, Sign In to add comment