dotfiles/.bin/portinfo
2023-09-18 12:24:42 +02:00

53 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
[ -z "$1" ] && exit 0
cd /usr/ports/$1
FOUND=0
show() {
echo
echo "+--------------------------------------------------------------------"
printf "| Package: $PWD\n" | sed 's|/usr/ports/||g'
echo "+--------------------------------------------------------------------"
make show="COMMENT FULLPKGNAME HOMEPAGE SITES MAINTAINER DESCR" \
| tr -s " " \
| awk 'NR == 1 { print "| COMMENT: "$0 } \
NR == 2 { print "| DISTNAME: "$0 } \
NR == 3 { print "| HOMEPAGE: "$0 } \
NR == 4 { print "| SITES: "$0 } \
NR == 5 { print "| MAINTAINER: "$0 } \
NR == 5 { print "+--------------------------------------------------------------------\n" } \
NR == 6 { system("/bin/cat " $0); }'
}
showsub() {
count=0
find * \
-type d \
-maxdepth 0 \
| grep -vE distfiles\|pobj\|plist\|CVS\|.git \
| while read line
do
if [ -d $line/pkg ] \
&& [ -f $line/Makefile ]
then
(cd $line && show)
count=$(( count + 1 ))
fi
if [ $count -gt 10 ]
then
break
fi
done
}
if [ -d pkg ] \
&& [ -f Makefile ]
then
show
else
showsub
fi