#!/usr/bin/ruby -w def usage puts("Usage: unowned path") exit end path = (ARGV.shift || usage) dlist = [] Dir["/var/lib/dpkg/info/*.list"].each{ |l| File.open(l).each{ |line| dlist << line.chomp } } print dlist.size, " files in dpkg lists\n" # check: skip /home, /usr/src f = open("|find #{path} -type f") fs = f.readlines.collect{ |l| l.chomp } f.close puts "unowned files:" diff = fs - dlist print diff.sort.collect{ |l| l+$/ }