amend build + add ps1

This commit is contained in:
a-sansara 2016-07-25 04:35:21 +02:00
parent 7303291221
commit 3eeb80c163
4 changed files with 40 additions and 2 deletions

View File

@ -6,6 +6,6 @@ ADD files.tar /scripts
RUN apk --update add bash && bash /scripts/install.sh
ENV TERM=xterm HTTP_SERVER_NAME=docker-site.dev FIX_OWNERSHIP=1
ENV TERM=xterm SHENV_CTX=LOCAL SHENV_NAME=Alpine SHENV_COLOR=97
ENTRYPOINT ["/scripts/main.sh"]

View File

@ -6,7 +6,7 @@
Coff="\033[m"
DOCKDIR=$(dirname "$(readlink -f ${BASH_SOURCE[0]})")
DOCKBUILD=$(basename $DOCKDIR)
DOCKREPO=$(basename $(dirname $(readlink -f ${DOCKBUILD})))
DOCKREPO=$(basename $(dirname $DOCKDIR))
DOCKTAG=${1:-"latest"}
TMPPWD=$(pwd)
indent=" "

View File

@ -0,0 +1,18 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
echo "ps1"
if [ ! -f /root/.bash_ps1 ]; then
echo "existe pas"
else
echo "existe"
fi
if [ ! -f /root/.bash_ps1 ]; then
cat <<EOF >> /root/.bashrc
if [ -f ~/.bash_ps1 ]; then
. ~/.bash_ps1
fi
EOF
sed -n '1,22 p' /scripts/util.sh > /root/.bash_ps1
echo "bash_prompt" >> /root/.bash_ps1
fi

View File

@ -1,6 +1,26 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
function bash_prompt() {
local Cenv="243"
if [ "$SHENV_CTX" = "INT" ]; then
local Cenv="202"
elif [ "$SHENV_CTX" = "PROD" ]; then
local Cenv="160"
fi
local Cdate="\033[1;33m"
local Cctx="\033[1;48;5;243m"
local Cname="\033[1;48;5;${SHENV_COLOR}m"
local Cpath="\033[1;38;5;36m"
local Cwhite="\033[1;38;5;15m"
local Chost="\033[1;38;5;15m"
local Csymbol="\033[1;38;5;15m"
local Cuser="\033[1;38;5;203m"
local Coff="\033[m"
export PS1="\[${Cdate}\]\t \[${Cwhite}${Cctx}\] DOCKER ${SHENV_CTX} \[${Cname}\] ${SHENV_NAME} \[${Coff} ${Cuser}\]\u\[${Chost}\]@\h \[${Cpath}\]\w \[${Csymbol}\]\$ \[${Coff}\]"
}
function preInit(){
for i in ls $1/*.sh
do