git: 540add272df6 - stable/13 - sh: read more profile files.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Nov 2022 09:31:45 UTC
The branch stable/13 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=540add272df643f53e1bd7786c6eee75fda5317b
commit 540add272df643f53e1bd7786c6eee75fda5317b
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 09:30:41 +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)
---
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 8bea31212217..5ee5da8ee149 100644
--- a/etc/mtree/BSD.root.dist
+++ b/etc/mtree/BSD.root.dist
@@ -84,6 +84,8 @@
..
ppp
..
+ profile.d
+ ..
rc.conf.d
..
rc.d