Date: Sat, 13 Jul 2024 10:12:31 GMT From: Wolfram Schneider <wosch@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: cf1bc41b29a7 - stable/14 - stale-symlink-buildworld.sh: a script to check for stale symlinks on a FreeBSD system Message-ID: <202407131012.46DACVx7025970@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=cf1bc41b29a7bd90d70445c8cf99474ef7b767b2 commit cf1bc41b29a7bd90d70445c8cf99474ef7b767b2 Author: Wolfram Schneider <wosch@FreeBSD.org> AuthorDate: 2024-07-07 12:59:20 +0000 Commit: Wolfram Schneider <wosch@FreeBSD.org> CommitDate: 2024-07-13 10:11:51 +0000 stale-symlink-buildworld.sh: a script to check for stale symlinks on a FreeBSD system You can run the script before or after `make installworld' You may also check your local ports with: env STALE_SYMLINK_BUILDWORLD_DIRS=/usr/local ./stale-symlink-buildworld.sh PR: 276235 (cherry picked from commit e880dd644f63fbe068c38b73b44aa7e7c5f176f3) --- tools/build/stale-symlink-buildworld.sh | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tools/build/stale-symlink-buildworld.sh b/tools/build/stale-symlink-buildworld.sh new file mode 100755 index 000000000000..a4515db3fccb --- /dev/null +++ b/tools/build/stale-symlink-buildworld.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# Copyright (c) Feb 2024 Wolfram Schneider <wosch@FreeBSD.org> +# SPDX-License-Identifier: BSD-2-Clause +# +# stale-symlink-buildworld.sh - check for stale symlinks on a FreeBSD system +# +# You can run the script before or after `make installworld' +# + +PATH="/bin:/usr/bin"; export PATH + +: ${ncpu=$(nproc)} + +# check other directories as well +: ${STALE_SYMLINK_BUILDWORLD_DIRS="/usr/obj"} + +trap 'rm -f $script' 0 +script=$(mktemp -t stale-symlink) +chmod u+x $script + +# create a temporary shell script to check for stale symbolic links +cat << 'EOF' > $script +file="$1" + +if [ ! -e "$file" ]; then + echo "stale symlink detected: $(ls -ld $file)" >&2 + exit 1 +else + exit 0 +fi +EOF + +find -s -H \ + /bin \ + /boot \ + /etc \ + /lib \ + /libexec \ + /sbin \ + /usr/bin \ + /usr/include \ + /usr/lib \ + /usr/lib32 \ + /usr/libdata \ + /usr/libexec \ + /usr/sbin \ + /usr/src \ + /usr/share \ + $STALE_SYMLINK_BUILDWORLD_DIRS \ + -type l \ + -print0 | xargs -n1 -0 -P${ncpu} $script + +#EOF
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407131012.46DACVx7025970>