info.mk (1097B)
1 <$mkpklib/defaults.mk 2 3 show-info:QV: 4 record=$(grep "$(printf "^%s\t" "$PKGBASE")" "$PKGDB" 2>/dev/null \ 5 || echo '') 6 if [ -z "$record" ]; then 7 printf "Package %s is not installed\n" "$PKGBASE" >&2 8 exit 1 9 fi 10 ver=$(echo "$record" | cut -f2) 11 if [ -z "$ver" ]; then 12 printf "Corrupted record for %s in %s\n" \ 13 "$PKGBASE" "$PKGDB" >&2 14 exit 1 15 else 16 date=$(echo "$record" | cut -f3) 17 pkg=$PKGDIR/$PKGBASE-$ver.tar.xz 18 total=$(cd /; sum=0; 19 for file in $(xz -dc "$pkg" | tar -tf -); do 20 st=$(stat "$file" | \ 21 sed '/^\s*Size:/s/\s*Size: \([0-9]\+\).*/\1/;t;d') 22 sum=$((sum + st)) 23 done 24 echo "$sum") 25 tarballsize=$(stat "$pkg" | \ 26 sed '/^\s*Size:/s/\s*Size: \([0-9]\+\).*/\1/;t;d') 27 apropos=$({ whatis -f "^$PKGBASE\$" 2>/dev/null || \ 28 echo 'N/A'; } | sed 1q) 29 printf "Package:\t\t%s\n" "$PKGBASE" 30 printf "Apropos:\t\t%s\n" "$apropos" 31 printf "Version:\t\t%s\n" "$ver" 32 printf "Installation Date:\t%s\n" "$date" 33 printf "Tarball:\t\t%s\n" "$pkg" 34 printf "Installed Size:\t\t%s\n" "$total bytes" 35 printf "Tarball Size:\t\t%s\n" "$tarballsize bytes" 36 fi