summaryrefslogtreecommitdiff
path: root/aptdpkgclean.sh
blob: 7de9b7713a615d32e27d96c484dfb7a4c75b5d6b (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"`
  9. if [ "$N1" != "$N2" ] && ! fuser -s "$file"; then
  10. rm -f "$file"
  11. else
  12. echo "$file"
  13. fi
  14. done >/var/lib/my_ro_hack.todel.new
  15. mv /var/lib/my_ro_hack.todel.new /var/lib/my_ro_hack.todel