git: 73ab1c87c208 - releng/12.4 - sh: read more profile files.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Nov 2022 15:51:19 UTC
The branch releng/12.4 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=73ab1c87c208dbb0609be572eb31591353d71e07 commit 73ab1c87c208dbb0609be572eb31591353d71e07 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2022-09-09 13:08:43 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2022-11-02 15:51:05 +0000 sh: read more profile files. Differential Revision: https://reviews.freebsd.org/D36505 MFC after: 1 month (cherry picked from commit 497cdf9673ec53d59634bb78862cd8dea3d5c155) sh: when loading profile, skip obvious scratch files. Differential Revision: https://reviews.freebsd.org/D36856 (cherry picked from commit d3890a547d201d1f5043e51baa406ac9d5d3a60a) sh: when loading profile, read only .sh files. Reviewers: jilles, eugen_grosbein.net, cy Subscribers: imp Differential Revision: https://reviews.freebsd.org/D37034 (cherry picked from commit 8d7221ca2dd5e0b6c633761b314cffed82ddca72) (cherry picked from commit 4ea49af3afe127c424a1b843617225fd437b51d1) Approved by: re (gjb) --- bin/sh/profile | 20 ++++++++++++++++++++ etc/mtree/BSD.root.dist | 2 ++ 2 files changed, 22 insertions(+) diff --git a/bin/sh/profile b/bin/sh/profile index b77c8787c79d..5b8a57d4b7b2 100644 --- a/bin/sh/profile +++ b/bin/sh/profile @@ -12,3 +12,23 @@ # msgs -q # Allow terminal messages # mesg y + +# Load each .sh file in /etc/profile.d/, then /usr/local/etc/profile, +# then each .sh file in /usr/local/etc/profile.d/. +_loaded=${_loaded:-/etc/profile} +export _loaded +for _dir in /etc /usr/local/etc ; do + for _file in "${_dir}"/profile "${_dir}"/profile.d/*.sh ; do + if [ -f "${_file}" ] ; then + case :${_loaded}: in + *:"${_file}":*) + ;; + *) + _loaded="${_loaded:+${_loaded}:}${_file}" + . "${_file}" + ;; + esac + fi + done +done +unset _loaded _dir _file diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index cba3e9e73c79..0c70b11eed4e 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -74,6 +74,8 @@ .. ppp .. + profile.d + .. rc.conf.d .. rc.d