Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: (minor) Fix bashrc with color prompts and TIME in bash_history #36

Open
wdoekes opened this issue Nov 15, 2024 · 0 comments
Open
Labels
has-fix Has a fix needs-config Needs a configuration change or ZTP post-prov setting

Comments

@wdoekes
Copy link
Member

wdoekes commented Nov 15, 2024

Description

Which build are we running (if any)

Upstream issues/PRs

Possible fix

diff --git a/build_debian.sh b/build_debian.sh
index 188396baa..51eb5b83f 100755
--- a/build_debian.sh
+++ b/build_debian.sh
@@ -325,6 +325,11 @@ sudo LANG=C chroot $FILESYSTEM_ROOT useradd -G sudo,docker $USERNAME -c "$DEFAUL
 ## Create password for the default user
 echo "$USERNAME:$PASSWORD" | sudo LANG=C chroot $FILESYSTEM_ROOT chpasswd
 
+# XXXWJD/FIXME: add frr user at 300?
+# XXXWJD: drop bashrc so we take the default
+sudo rm $FILESYSTEM_ROOT/home/$USERNAME/.bashrc
+sudo rm $FILESYSTEM_ROOT/root/.bashrc
+
 ## Create redis group
 sudo LANG=C chroot $FILESYSTEM_ROOT groupadd -f redis
 sudo LANG=C chroot $FILESYSTEM_ROOT usermod -aG redis $USERNAME
diff --git a/files/image_config/bash/bash.bashrc b/files/image_config/bash/bash.bashrc
index 96f54776f..b3d90a27d 100644
--- a/files/image_config/bash/bash.bashrc
+++ b/files/image_config/bash/bash.bashrc
@@ -6,6 +6,18 @@
 # If not running interactively, don't do anything
 [ -z "$PS1" ] && return
 
+# don't put duplicate lines or lines starting with space in the history.
+# See bash(1) for more options
+HISTCONTROL=ignoreboth
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=1000
+HISTFILESIZE=2000
+HISTTIMEFORMAT='%F %T '
+
 # check the window size after each command and, if necessary,
 # update the values of LINES and COLUMNS.
 shopt -s checkwinsize
@@ -17,6 +29,8 @@ fi
 
 # set a fancy prompt (non-color, overwrite the one in /etc/profile)
 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
+# XXXWJD: we like some color so separate the outut between the commands
+PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:$?:\[\033[01;34m\]\w\[\033[00m\]\$ '
 
 # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
 # If this is an xterm set the title to user@host:dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-fix Has a fix needs-config Needs a configuration change or ZTP post-prov setting
Projects
None yet
Development

No branches or pull requests

1 participant