diff --git a/precise/base-0k/hooks/install b/precise/base-0k/hooks/install index d8e00d66..3307ca8a 100755 --- a/precise/base-0k/hooks/install +++ b/precise/base-0k/hooks/install @@ -63,3 +63,40 @@ deb http://deb.kalysto.org no-dist kal-alpha kal-beta kal-main EOF + +## +## More shell configurations (prompt, functions) +## + +mkdir -p /etc/prompt + +cat < /etc/prompt/prompt.1.rc +PROMPT_COMMAND="" +parse_git_branch() { + ref=\$(git symbolic-ref HEAD 2> /dev/null) || return + echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)' +} +export PS1="\[\033[0;37m\][\[\033[1;30m\]\u\[\033[0;37m\]@\[\033[1;30m\]\h\[\033[0;37m\]]-[\[\033[1;34m\]\w\[\033[0;37m\]]\\\$(parse_git_branch)\n\[\033[1;37m\]\\$ \[\033[0;37m\]" +EOF + +cat <> /root/.bashrc + +# Prompt easy management +prompt() { + prompt_name="prompt.\$1.rc" + + for i in /etc/prompt ~/.prompt; do + [ -f "\$i/\$prompt_name" ] && + . "\$i/\$prompt_name" + done +} + + +function glog() { + git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@" +} + + +prompt 1 + +EOF