xref: /aosp_15_r20/external/tensorflow/tensorflow/tools/dockerfiles/bashrc (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# ==============================================================================
16
17# If not running interactively, don't do anything
18[ -z "$PS1" ] && return
19
20export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > "
21export TERM=xterm-256color
22alias grep="grep --color=auto"
23alias ls="ls --color=auto"
24
25echo -e "\e[1;31m"
26cat<<TF
27________                               _______________
28___  __/__________________________________  ____/__  /________      __
29__  /  _  _ \_  __ \_  ___/  __ \_  ___/_  /_   __  /_  __ \_ | /| / /
30_  /   /  __/  / / /(__  )/ /_/ /  /   _  __/   _  / / /_/ /_ |/ |/ /
31/_/    \___//_/ /_//____/ \____//_/    /_/      /_/  \____/____/|__/
32
33TF
34echo -e "\e[0;33m"
35
36if [[ $EUID -eq 0 ]]; then
37  cat <<WARN
38WARNING: You are running this container as root, which can cause new files in
39mounted volumes to be created as the root user on your host machine.
40
41To avoid this, run the container by specifying your user's userid:
42
43$ docker run -u \$(id -u):\$(id -g) args...
44WARN
45else
46  cat <<EXPL
47You are running this container as user with ID $(id -u) and group $(id -g),
48which should map to the ID and group for your user on the Docker host. Great!
49EXPL
50fi
51
52# Turn off colors
53echo -e "\e[m"
54