From 3eeb80c163e62c57bc6ad5e1128519ac965c6bff Mon Sep 17 00:00:00 2001 From: a-sansara Date: Mon, 25 Jul 2016 04:35:21 +0200 Subject: [PATCH] amend build + add ps1 --- pluie/alpine/Dockerfile | 2 +- pluie/alpine/build | 2 +- pluie/alpine/install.d/10-ps1.sh | 18 ++++++++++++++++++ pluie/alpine/util.sh | 20 ++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 pluie/alpine/install.d/10-ps1.sh diff --git a/pluie/alpine/Dockerfile b/pluie/alpine/Dockerfile index 3d69c05..fd5317c 100644 --- a/pluie/alpine/Dockerfile +++ b/pluie/alpine/Dockerfile @@ -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"] diff --git a/pluie/alpine/build b/pluie/alpine/build index 378af88..9d6370a 100755 --- a/pluie/alpine/build +++ b/pluie/alpine/build @@ -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=" " diff --git a/pluie/alpine/install.d/10-ps1.sh b/pluie/alpine/install.d/10-ps1.sh new file mode 100644 index 0000000..9eb4519 --- /dev/null +++ b/pluie/alpine/install.d/10-ps1.sh @@ -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 <> /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 diff --git a/pluie/alpine/util.sh b/pluie/alpine/util.sh index db365d2..73da26e 100755 --- a/pluie/alpine/util.sh +++ b/pluie/alpine/util.sh @@ -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