sdk: move chromiumos-niceties.sh to chromite
This makes it easier to manage & install updates.
BUG=None
TEST=CQ passes
Change-Id: I15cce1cd32c539dc1def45c241d97fc55ec172aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2787569
Reviewed-by: Sergey Frolov <sfrolov@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/chroot_version_hooks.d/185_sdk_profile.d b/chroot_version_hooks.d/185_sdk_profile.d
new file mode 100644
index 0000000..35bd414
--- /dev/null
+++ b/chroot_version_hooks.d/185_sdk_profile.d
@@ -0,0 +1,8 @@
+# Copyright 2021 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.
+
+sudo rm -f "/etc/profile.d/chromiumos-niceties.sh"
+sudo ln -sfT \
+ "/mnt/host/source/chromite/sdk/etc/profile.d/50-chromiumos-niceties.sh" \
+ "/etc/profile.d/50-chromiumos-niceties.sh"
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 3af93b3..95e6328 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -304,14 +304,9 @@
target="${FLAGS_chroot}/etc/profile.d"
mkdir -p "${target}"
- cat << EOF > "${target}/chromiumos-niceties.sh"
-# 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
+ ln -sfT \
+ "/mnt/host/source/chromite/sdk/etc/profile.d/50-chromiumos-niceties.sh" \
+ "${target}/50-chromiumos-niceties.sh"
# Select a small set of locales for the user if they haven't done so
# already. This makes glibc upgrades cheap by only generating a small