Skip to contentSkip to conversation

bash: add default bash settings

PATCH Superseded David Van Arnem 3 participants 5 messages Oct 7, 2015 – Oct 12, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bash: add default bash settings

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.

---
 package/bash/bash.mk         |  7 +++++++
 package/bash/bash_profile.sh | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 package/bash/bash_profile.sh
package/bash/bash.mk +7 -0
index 97d7182..dae3bf2 100644
@@ -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))
package/bash/bash_profile.sh new file +16 -0
new file mode 100644
index 0000000..b41c240
@@ -0,0 +1,16 @@
+# default bash script, should be sourced by /etc/profile
+
+if [ "$PS1" ]; then
+    export PS1="[\u@\h \W]$PS1"
+    alias ll='/bin/ls --color=tty -laFh'
+    alias ls='/bin/ls --color=tty -F'
+   	export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:';
+
+    export USER=`id -un`
+    export LOGNAME=$USER
+    export HOSTNAME=`/bin/hostname`
+    export HISTSIZE=1000
+    export HISTFILESIZE=1000
+    export INPUTRC=/etc/inputrc
+    export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile
+fi;
Signature · 1 line
2.4.3
#1 lore raw

PATCH 1/1 bash: add default bash settings

Hi David, all

Quoted 51 lines · David Van Arnem

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.

---
 package/bash/bash.mk         |  7 +++++++
 package/bash/bash_profile.sh | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 package/bash/bash_profile.sh
package/bash/bash.mk +7 -0
index 97d7182..dae3bf2 100644
@@ -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))
package/bash/bash_profile.sh new file +7 -0
new file mode 100644
index 0000000..b41c240
@@ -0,0 +1,16 @@
+# default bash script, should be sourced by /etc/profile
+
+if [ "$PS1" ]; then
+    export PS1="[\u@\h \W]$PS1"
+    alias ll='/bin/ls --color=tty -laFh'
+    alias ls='/bin/ls --color=tty -F'
+       export

LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:';

package/bash/bash_profile.sh line 16

Quoted 9 lines
package/bash/bash_profile.sh new file +9 -0
+
+    export USER=`id -un`
+    export LOGNAME=$USER
+    export HOSTNAME=`/bin/hostname`
+    export HISTSIZE=1000
+    export HISTFILESIZE=1000
+    export INPUTRC=/etc/inputrc
+    export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile
+fi;

Thanks for your patch !

Here are a few things to rework:
We previously removed all theses because they are not sane as a default, we try to keep a minimal default configuration that suits everyone. For specific needs (like exporting ls_colors, aliases, hostname and so on), we really encourage users to create a post build scripts and do whatever they need to do in there.

So for your uses and what I got from your previous mail, I would only keep the export PS1 from the whole thing.

Quoted 8 lines

--
2.4.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151008/92b52a22/attachment.html>

#2 lore raw

PATCH 1/1 bash: add default bash settings

In reply to David Van Arnem

Dear David Van Arnem,

Quoted 7 lines · David Van Arnem

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.

Quoted 7 lines

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.

Thanks for your patch. Following the comments from Maxime Hadjinlian on your patch, I've marked it as "Changes Requested" in our patch tracking system. Please resubmit a new version of your patch that takes into account the comments made by Maxime. Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 bash: add default bash settings

Quoted 16 lines · Thomas Petazzoni

Dear David Van Arnem,

Quoted 13 lines · David Van Arnem

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.

Quoted 9 lines
Quoted 1 line

Thanks for your patch. Following the comments from Maxime Hadjinlian on your patch, I've marked it as "Changes Requested" in our patch tracking system. Please resubmit a new version of your patch that takes into account the comments made by Maxime. Thanks a lot!

Thomas

Hi Thomas,

Can you instruct me on how to get Maxime's comments? I do not see them in my emails from this list.

Signature · 10 lines
Thanks,
David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2416 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151012/215feaf3/attachment.p7s>
#4 lore raw

PATCH 1/1 bash: add default bash settings

Quoted 24 lines · David Van Arnem
Quoted 23 lines · Thomas Petazzoni

Dear David Van Arnem,

Quoted 7 lines · David Van Arnem

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.

Quoted 7 lines

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.

Thanks for your patch. Following the comments from Maxime Hadjinlian on your patch, I've marked it as "Changes Requested" in our patch tracking system. Please resubmit a new version of your patch that takes into account the comments made by Maxime. Thanks a lot!

Quoted 6 lines
Quoted 2 lines

Thomas

Hi Thomas,

Can you instruct me on how to get Maxime's comments? I do not see them in my emails from this list.

Scratch that, I found them. I will resubmit. Thanks!

Quoted 8 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 10 lines
Thanks,
David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2416 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151012/4f3fd186/attachment.p7s>