git: 9d585fc395c3 - main - absolute-symlink.sh: check for absolute symlinks on a FreeBSD system
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 26 Oct 2024 08:32:19 UTC
The branch main has been updated by wosch:
URL: https://cgit.FreeBSD.org/src/commit/?id=9d585fc395c3af6d1ceaec7df7c7ef60466f0528
commit 9d585fc395c3af6d1ceaec7df7c7ef60466f0528
Author: Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2024-10-26 08:31:19 +0000
Commit: Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2024-10-26 08:31:19 +0000
absolute-symlink.sh: check for absolute symlinks on a FreeBSD system
The purpose of this script is to detect absolute symlinks on
a machine, e.g.:
/etc/localtime -> /usr/share/zoneinfo/UTC
Some of these absolute symbolic links can be created intentionally,
but it is usually better to use relative symlinks.
You can run the script after `make installworld', or any other
make targets thats installs files.
You can also check your local ports with:
env ABSOLUTE_SYMLINK_DIRS=/usr/local ./absolute-symlink.sh
---
tools/build/absolute-symlink.sh | 49 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tools/build/absolute-symlink.sh b/tools/build/absolute-symlink.sh
new file mode 100755
index 000000000000..9d5d636e2dfb
--- /dev/null
+++ b/tools/build/absolute-symlink.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Copyright (c) Oct 2024 Wolfram Schneider <wosch@FreeBSD.org>
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# absolute-symlink.sh - check for absolute symlinks on a FreeBSD system
+#
+# The purpose of this script is to detect absolute symlinks on
+# a machine, e.g.:
+#
+# /etc/localtime -> /usr/share/zoneinfo/UTC
+#
+# Some of these absolute symbolic links can be created intentionally,
+# but it is usually better to use relative symlinks.
+#
+# You can run the script after `make installworld', or any other
+# make targets thats installs files.
+#
+# You can also check your local ports with:
+#
+# env ABSOLUTE_SYMLINK_DIRS=/usr/local ./absolute-symlink.sh
+
+
+PATH="/bin:/usr/bin"; export PATH
+LANG="C"; export LANG
+
+# check other directories as well
+: ${ABSOLUTE_SYMLINK_DIRS=""}
+
+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 \
+ $ABSOLUTE_SYMLINK_DIRS \
+ -type l \
+ -ls | grep -Ea -- ' -> /'
+
+#EOF