blob: 68a01c6f71ea004bfbe9de356261d0beeac7da8e [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# We used to place bashrc niceties into the user's .bashrc. Use
# profile.d instead.
sudo_clobber /etc/profile.d/chromiumos-niceties.sh << EOF
# Niceties for interactive logins. (cr) denotes this is a chroot, the
# __git_branch_ps1 prints current git branch in ./ . The $r behavior is to
# make sure we don't reset the previous $? value which later formats in
# $PS1 might rely on.
PS1='\$(r=\$?; __git_branch_ps1 "(%s) "; exit \$r)'"\${PS1}"
PS1="(cr) \${PS1}"
EOF
# Also, get rid of the leftover stuff in the user's .bashrc.
# These are the two originally added lines:
STR1='export PS1='"'"'$(r=$?; __git_branch_ps1 "(%s) "; exit $r)'"'"'"${PS1}"'
STR2='export PS1="(cr) ${PS1}"'
sed -e "/${STR1}/d" -e "/${STR2}/d" -i ~/.bashrc
exit 0