summaryrefslogtreecommitdiff
path: root/aptdpkgclean.sh
blob: 0291fdde78ecc7d3e769687f3389dfe992333d85 (plain)
  1. #!/bin/sh
  2. pathmatch="^/usr"
  3. cat /var/lib/my_ro_hack.todel | while read file; do
  4. [ -f "$file" ] || continue
  5. N1=`find "$file" -printf "%i\n"`
  6. b=`basename $file`; d=`dirname $file`
  7. XF="${b#.}"; XF="$d/${XF%.dpkg-ro-used.*}"
  8. N2=`find "$XF" -printf "%i\n"` || continue
  9. [ -n "$XF" ] || continue
  10. if [ "$N1" != "$N2" ] && ! fuser -s "$file"; then
  11. rm -f "$file"
  12. else
  13. echo "$file"
  14. fi
  15. done >/var/lib/my_ro_hack.todel.new
  16. mv /var/lib/my_ro_hack.todel.new /var/lib/my_ro_hack.todel