From 2ff71bff73b1041d8d36ef9cc7e073319767a1be Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sun, 6 Apr 2025 15:45:29 +0300 Subject: [PATCH] Add /etc/profile.d directory support --- pkg.info | 2 +- source-files/profile | 9 +++++++-- source.sh | 10 +++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pkg.info b/pkg.info index c8ab74d..e159499 100644 --- a/pkg.info +++ b/pkg.info @@ -1,7 +1,7 @@ name: bash description: The Bourne-Again Shell version: 5.2.21 -revision: 3 +revision: 4 url: https://www.gnu.org/software/bash/ license: GPL3-or-later architecture: any diff --git a/source-files/profile b/source-files/profile index d9fc89b..eb6fb99 100644 --- a/source-files/profile +++ b/source-files/profile @@ -22,12 +22,17 @@ if [ -f /etc/locale.conf ]; then set +a fi +if [ -d /etc/profile.d ]; then + for f in /etc/profile.d/*.sh; do + [ -r "$f" ] && source "$f" + done +fi + # Unsetting functions unset -f append_path # Run /etc/bashrc if in an interactive terminal -if [[ $- == *i* ]] -then +if [[ $- == *i* ]]; then . /etc/bashrc fi diff --git a/source.sh b/source.sh index 64f4977..e150049 100644 --- a/source.sh +++ b/source.sh @@ -32,10 +32,14 @@ check() { # This function is used to move the compiled files into the output directory package() { make DESTDIR="$BPM_OUTPUT" install + + # Create /bin/sh symlink to bash ln -s bash "$BPM_OUTPUT"/usr/bin/sh - mkdir -p "$BPM_OUTPUT"/etc - cp ../profile "$BPM_OUTPUT"/etc/profile - cp ../bashrc "$BPM_OUTPUT"/etc/bashrc + + # Configuration files + install -Dm644 ../profile "$BPM_OUTPUT"/etc/profile + install -Dm644 ../bashrc "$BPM_OUTPUT"/etc/bashrc + install -d "$BPM_OUTPUT"/etc/profile.d install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/bash/COPYING }