blob: e42631ce1031b3172b3a874c3c29360ca8dcbbfa (
plain)
- #!/bin/sh
- #
- # /usr/local/sbin/aptdpkgclean
- # Put together and tweaked by Jonas Smedegaard <dr@jones.dk>
- # 2001-2002
- #
- # $Id: aptdpkgclean,v 1.1 2002-03-07 16:22:51 jonas Exp $
- #
- # Auto re-mounting of a readonly /usr
- # Put the following in a file below /etc/apt/apt.conf.d:
- #
- # // Auto re-mounting of a readonly /usr
- # // Based on mail from Anthony Towns <aj@azure.humbug.org.au>
- # // http://lists.debian.org/debian-devel/2001/debian-devel-200111/msg00212.html
- #
- # // This is the intended thing:
- # // DPkg {
- # // Pre-Invoke {"mount -o remount,rw /usr";};
- # // Post-Invoke {"mount -o remount,ro /usr";};
- # // };
- #
- # DPkg {
- # Pre-Install-Pkgs {"/usr/local/sbin/aptdpkgro";};
- # Pre-Invoke {"mount -o remount,rw /usr";};
- # Post-Invoke {"/usr/local/sbin/aptdpkgclean; mount -o remount,ro /usr";};
- # };
- #
- 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"` || continue
- [ -n "$XF" ] || continue
- 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
|