pkg_tree.sh (448B)
1 #!/bin/sh 2 3 PACKAGE=$1 4 5 print_deps() { 6 _deps=`pkg_info -f ${1} | grep '^@depend' | cut -d ':' -f 3` 7 if [ "${_deps}" != "" ]; then 8 for _dep in $_deps; do 9 if [ $2 -gt 0 ]; then 10 i=0 11 while [ $i -lt $2 ]; do 12 echo -n " " 13 i=$(expr $i + 1) 14 done 15 echo -n "\`-" 16 fi 17 echo $_dep 18 print_deps $_dep $(expr $2 + 1) 19 done 20 fi 21 } 22 23 if [ "${PACKAGE}" = "" ]; then 24 echo "usage: ${0} package_name" 25 exit 26 fi 27 28 print_deps $PACKAGE 0