Add script I'm using to add entries to OptionalObsoleteFiles.inc
This commit is contained in:
parent
88585cd46c
commit
fe4c66a4f8
49
tools/add-optional-obsolete-files-entries.sh
Executable file
49
tools/add-optional-obsolete-files-entries.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Simple script for enumerating installed files for a list of directories
|
||||
#
|
||||
# usage: add-optional-obsolete-files-entries.sh directory ..
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
: ${TMPDIR=/tmp}
|
||||
|
||||
DESTDIR=$(mktemp -d $TMPDIR/tmp.XXXXXX) || exit
|
||||
trap "rm -Rf $DESTDIR" EXIT INT TERM
|
||||
|
||||
# Don't pollute the output with
|
||||
: ${SRCCONF=/dev/null}
|
||||
: ${__MAKE_CONF=/dev/null}
|
||||
|
||||
if [ $# -gt 0 ]
|
||||
then
|
||||
directories=$*
|
||||
else
|
||||
directories=.
|
||||
fi
|
||||
|
||||
export __MAKE_CONF DESTDIR SRCCONF
|
||||
|
||||
SRCTOP=$(cd $(make -V'${.MAKE.MAKEFILES:M*/share/mk/sys.mk:H:H:H}'); pwd)
|
||||
|
||||
# Don't install the manpage symlinks
|
||||
(cd $SRCTOP; make hier INSTALL_SYMLINK=true MK_MAN=no >/dev/null)
|
||||
|
||||
for directory in $directories
|
||||
do
|
||||
(cd $directory && make install >/dev/null) || exit
|
||||
done
|
||||
# Prune empty directories
|
||||
# XXX: is [ -n ... ] call necessary?
|
||||
while empty_dirs=$(find $DESTDIR -type d -and -empty) && [ -n "$empty_dirs" ]
|
||||
do
|
||||
rmdir $empty_dirs
|
||||
done
|
||||
|
||||
# Enumerate all of the installed files/directories
|
||||
(cd $DESTDIR;
|
||||
find -s . -type f -mindepth 1 | sed -e 's,^,OLD_FILES+=,';
|
||||
find -s . -type d -mindepth 1 -and \! -empty | \
|
||||
egrep -v '^\./(s*bin|libexec|usr|usr/include|usr/lib|usr/libexec|usr/s*bin|usr/share|usr/share/man|usr/share/man/man[0-9])$' | \
|
||||
sed -e 's,^,OLD_DIRS+=,'
|
||||
) | sed -e 's,+=\./,+=,'
|
Loading…
Reference in New Issue
Block a user