summaryrefslogtreecommitdiff
path: root/aptdpkgclean.sh
diff options
context:
space:
mode:
Diffstat (limited to 'aptdpkgclean.sh')
-rwxr-xr-xaptdpkgclean.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/aptdpkgclean.sh b/aptdpkgclean.sh
new file mode 100755
index 0000000..7de9b77
--- /dev/null
+++ b/aptdpkgclean.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+pathmatch="^/usr"
+
+cat /var/lib/my_ro_hack.todel | while read file; do
+ [ -f "$file" ] || continue
+ N1=`find "$file" -printf "%i\n"`
+
+ b=`basename $file`; d=`dirname $file`
+ XF="${b#.}"; XF="$d/${XF%.dpkg-ro-used.*}"
+ N2=`find "$XF" -printf "%i\n"`
+
+ if [ "$N1" != "$N2" ] && ! fuser -s "$file"; then
+ rm -f "$file"
+ else
+ echo "$file"
+ fi
+done >/var/lib/my_ro_hack.todel.new
+mv /var/lib/my_ro_hack.todel.new /var/lib/my_ro_hack.todel