automated clean up of /usr/lib because of /lib

Doug Barton DougB at FreeBSD.org
Sun Aug 31 15:04:18 PDT 2003


There was a discussion of this recently, and the conclusion was more or
less that doing this in an automated fashion is frought with danger,
since you don't know for sure what else besides system components the
user has put in the various directories.

I've been using the following combination of a bash function (that could
just as easily be its own script) and a script I call
after_installworld.

doinstall ()
{
    cd /usr && [ -d include-old ] && /bin/rm -r include-old;
    [ ! -e include-old ] && mv -i include include-old;
    /bin/rm -r /usr/share/man;
    cd /usr/src && touch installdate && make installworld
}


#!/bin/sh

PATH=/usr/bin:/bin
export PATH

for dir in /bin /lib /libexec /rescue /sbin \
	/usr/bin /usr/games /usr/lib /usr/libdata /usr/libexec /usr/sbin ; do
	for file in `find $dir \( -type f -o -type l \) -a \
		! -newer /usr/src/installdate`; do
		case "${file}" in
		/usr/lib/compat/*|*/0ld/*|/usr/libdata/perl/*) ;;
		*)	echo ''
			ls -lao ${file}
			read -p "  *** Move ${file} to ${file%/*}/0ld? [n] " M
			case ${M} in
			[yY]*)	mkdir -p ${file%/*}/0ld
				chflags 0 ${file} &&
				mv -i ${file} ${file%/*}/0ld/
				;;
			esac
			;;
		esac
	done
done

exit 0


This combination keeps things squeaky clean for me.

HTH,

Doug

-- 

    This .signature sanitized for your protection




More information about the freebsd-current mailing list