1#!/bin/sh 2# Copyright (c) Oct 2024 Wolfram Schneider <wosch@FreeBSD.org> 3# SPDX-License-Identifier: BSD-2-Clause 4# 5# absolute-symlink.sh - check for absolute symlinks on a FreeBSD system 6# 7# The purpose of this script is to detect absolute symlinks on 8# a machine, e.g.: 9# 10# /etc/localtime -> /usr/share/zoneinfo/UTC 11# 12# Some of these absolute symbolic links can be created intentionally, 13# but it is usually better to use relative symlinks. 14# 15# You can run the script after `make installworld', or any other 16# make targets thats installs files. 17# 18# You can also check your local ports with: 19# 20# env ABSOLUTE_SYMLINK_DIRS=/usr/local ./absolute-symlink.sh 21 22 23PATH="/bin:/usr/bin"; export PATH 24LANG="C"; export LANG 25 26# check other directories as well 27: ${ABSOLUTE_SYMLINK_DIRS=""} 28 29find -s -H \ 30 /bin \ 31 /boot \ 32 /etc \ 33 /lib \ 34 /libexec \ 35 /sbin \ 36 /usr/bin \ 37 /usr/include \ 38 /usr/lib \ 39 /usr/lib32 \ 40 /usr/libdata \ 41 /usr/libexec \ 42 /usr/sbin \ 43 /usr/src \ 44 /usr/share \ 45 $ABSOLUTE_SYMLINK_DIRS \ 46 -type l \ 47 -ls | grep -Ea -- ' -> /' 48 49#EOF 50