Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] bash: add default bash settings
@ 2015-10-12 18:30 David Van Arnem
  2015-12-20 14:27 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: David Van Arnem @ 2015-10-12 18:30 UTC (permalink / raw)
  To: buildroot

Settings that were bash-specific were previously removed from
system/skeleton/etc/profile.  This measn that users using bash no longer
get the "normal" bash prompt with [user at host dir]#/$, and only get #/$.
This commit adds back the bash-specific settings, but adds them to the
bash package so they are only used when bash is installed on the target
system.

bash_profile.sh contains the variables, aliases, and color profile that
were previously in system/skeleton/etc/profile.  The changes to bash.mk
use a post-install hook to install bash_profile.sh to the target
filesystem, where it will later be sourced by /etc/profile when a bash
shell is started.
---
Changes v1 -> v2
    - only export PS1 variable for bash_profile.sh

Signed-off-by: David Van Arnem <dvanarnem@cmlab.biz>
---
 package/bash/bash.mk         | 7 +++++++
 package/bash/bash_profile.sh | 5 +++++
 2 files changed, 12 insertions(+)
 create mode 100644 package/bash/bash_profile.sh

diff --git a/package/bash/bash.mk b/package/bash/bash.mk
index 97d7182..dae3bf2 100644
--- a/package/bash/bash.mk
+++ b/package/bash/bash.mk
@@ -49,4 +49,11 @@ define BASH_INSTALL_TARGET_CMDS
 	rm -f $(TARGET_DIR)/bin/bashbug
 endef
 
+# install default bash settings
+define BASH_INSTALL_DEFAULT_PROFILE
+	$(INSTALL) -D -m 644 package/bash/bash_profile.sh \
+		$(TARGET_DIR)/etc/profile.d/bash_profile.sh
+endef
+
+BASH_POST_INSTALL_TARGET_HOOKS += BASH_INSTALL_DEFAULT_PROFILE
 $(eval $(autotools-package))
diff --git a/package/bash/bash_profile.sh b/package/bash/bash_profile.sh
new file mode 100644
index 0000000..3fb087a
--- /dev/null
+++ b/package/bash/bash_profile.sh
@@ -0,0 +1,5 @@
+# default bash script, should be sourced by /etc/profile
+
+if [ "$PS1" ]; then
+    export PS1="[\u@\h \W]$PS1"
+fi;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-20 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12 18:30 [Buildroot] [PATCH v2] bash: add default bash settings David Van Arnem
2015-12-20 14:27 ` Thomas Petazzoni
2015-12-20 15:43   ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox