Here is a script that will calculate the total size including dependencies.
#!/bin/sh
# depinfo.sh - Copyright 2010 Brian Smith
# Some edits by Curaga
# Licensed under GPLv2 License
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
alias grep="busybox grep"
alias awk="busybox awk"
alias wget="busybox wget"
alias dc="busybox dc"
alias nc="busybox nc"
get_dependencies()
{
app=${1//KERNEL/$kernel}
case "$tempfile" in
*":${app}:"*)
;;
*)
tempfile="${tempfile}${app}:"
size=`echo -e "HEAD /$server_path/$app HTTP/1.0\n" | nc $server 80 | grep "^Content-Length" | awk '{print $2'}`
case $size in
[0-9]*)
sizemb=`dc $size 1024 / 1024 / p`
if [ -f "$localtce"/optional/"$app" ]; then
totalsize_installed=$(($totalsize_installed + $size))
echo -n "${GREEN}"
printf "%-40s" $app
echo -n "${NORMAL}"
printf " size(bytes): %10d, %6.2f MB\n" $size $sizemb
else
totalsize_needed=$(($totalsize_needed + $size))
printf "%-40s size(bytes): %10d, %6.2f MB\n" $app $size $sizemb
fi
deplist=`wget -q -O - "$MIRROR"/"$app.dep" 2>/dev/null`
for depapp in $deplist; do
get_dependencies $depapp
done
;;
*)
printf "%-40s Error, not found \n" $app
;;
esac
;;
esac
}
app=$1
if [ -n "$app" ]; then
app=${app%.tcz}
app="$app.tcz"
localtce=`cat /opt/.tce_dir`
. /etc/init.d/tc-functions
getMirror
server=${MIRROR#http://}
server_path=${server#*/}
server=${server%%/*}
kernel=`uname -r`
totalsize_needed=0
totalsize_installed=0
tempfile=":"
get_dependencies $app
totalsize=$(($totalsize_needed + $totalsize_installed))
totalsizemb=`dc $totalsize 1024 / 1024 / p`
totalsize_neededmb=`dc $totalsize_needed 1024 / 1024 / p`
totalsize_installedmb=`dc $totalsize_installed 1024 / 1024 / p`
printf "\n Total size (bytes) %10d, %6.2f MB\n" $totalsize $totalsizemb
printf " (Not currently installed) %10d, %6.2f MB\n" $totalsize_needed $totalsize_neededmb
printf " (Already installed) %10d, %6.2f MB\n\n" $totalsize_installed $totalsize_installedmb
else
echo "Specify extension in command line:"
echo "Example: $0 firefox.tcz"
fi
When you run it, it produces the following output:
$ ./depinfo.sh firefox.tcz
firefox.tcz size(bytes): 13664256, 13.03 MB
libasound.tcz size(bytes): 372736, 0.36 MB
curl.tcz size(bytes): 380928, 0.36 MB
openssl-0.9.8.tcz size(bytes): 1118208, 1.07 MB
libnotify.tcz size(bytes): 94208, 0.09 MB
dbus-glib.tcz size(bytes): 167936, 0.16 MB
dbus.tcz size(bytes): 520192, 0.50 MB
expat2.tcz size(bytes): 77824, 0.07 MB
glib2.tcz size(bytes): 1040384, 0.99 MB
gtk2.tcz size(bytes): 3182592, 3.04 MB
atk.tcz size(bytes): 53248, 0.05 MB
cairo.tcz size(bytes): 274432, 0.26 MB
pixman.tcz size(bytes): 200704, 0.19 MB
fontconfig.tcz size(bytes): 135168, 0.13 MB
graphics-libs-1.tcz size(bytes): 790528, 0.75 MB
pango.tcz size(bytes): 405504, 0.39 MB
libxml2.tcz size(bytes): 696320, 0.66 MB
Xorg-7.5-lib.tcz size(bytes): 204800, 0.20 MB
Total size (bytes): 23379968, 22.30 MB