[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: package pre-selections tool



I wrote earlier:

>I will work on a script to calculate disk usage based on a "dpkg
>--get-selections" file.

I'm attaching such a script.

                                   - Jim Van Zandt

#!/usr/bin/awk -f
#
#	size-selections - determine disk space required for a set of packages
#
#  usage: 
#       dpkg --get-selections > foobar
#       size-selections foobar
#
#  disk space required in KB is written to stdout.
#
/install$/ {want[$1] = 1; wanted++;}
END {
  while ((getline < "/var/lib/dpkg/available") > 0) {
    if ($1 ~ /^Package:/) {
      pkg = $2;
    } else if ($1 ~ /^Installed-Size:/) {
      if (pkg in want) {
	sum_installed_size += $2;
	found++;
	delete want[pkg];
      }
    }
  }
  print sum_installed_size;
  if (wanted != found) {
    print "warning: could not find these packages:";
    for (p in want) printf(" %s", p);
    print
  }
}


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: