initial import

This commit is contained in:
Danny Robson 2019-02-22 13:13:19 +11:00
commit 2898289fe0
7 changed files with 103 additions and 0 deletions

9
05-ssh-detect/profile Normal file
View File

@ -0,0 +1,9 @@
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
SESSION_TYPE=remote/ssh
else
case $(ps -o comm= -p $PPID) in
sshd|*/sshd) SESSION_TYPE=remote/ssh;;
esac
fi
# vim: set syntax=bash:

10
30-ssh-agent/profile Normal file
View File

@ -0,0 +1,10 @@
if [ -f ~/.agent.env ] ; then
. ~/.agent.env > /dev/null
if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then
#echo "Stale agent file found. Spawning new agent… "
eval `ssh-agent | tee ~/.agent.env` >/dev/null
fi
else
#echo "Starting ssh-agent"
eval `ssh-agent | tee ~/.agent.env` >/dev/null
fi

5
90-history/profile Normal file
View File

@ -0,0 +1,5 @@
export HISTSIZE=-1
export HISTFILESIZE=-1
export HISTCONTROL=ignorespace
export HISTIGNORE="$HISTIGNORE:rm *"

46
91-tick/profile Normal file
View File

@ -0,0 +1,46 @@
function fg_color
{
if [ -n "$1" ]; then
echo -n "\\[\\033[01;${1}m\\]"
else
echo -n "\\[\\033[00m\\]"
fi
}
RED=$(fg_color 31)
GREEN=$(fg_color 32)
YELLOW=$(fg_color 33)
BLUE=$(fg_color 34)
RESET=$(fg_color)
case "${SESSION_TYPE}" in
remote\/*) PROMPT_COLOUR=${YELLOW};;
*) PROMPT_COLOUR=${GREEN};;
esac
function prompt_command {
res=$?
PS1=""
if [ -n "$VIRTUAL_ENV" ]; then
PS1="($(basename $VIRTUAL_ENV)) "
fi
PS1="${PS1}$(fg_color 32)${USER:-$(whoami 2>/dev/null)}"
PS1="${PS1}@"
PS1="${PS1}${PROMPT_COLOUR}$(uname -n 2>/dev/null) \$ "
PS1="${PS1}$(fg_color 34)"
if [ $res == "0" ]; then
PS1="$PS1✓ "
else
PS1="$PS1✗ "
fi
PS1="$PS1\w \$\[\033[00m\] "
PS1="${PS1}$(fg_color)"
}
export PROMPT_COMMAND=prompt_command

8
bash_profile.sh Executable file
View File

@ -0,0 +1,8 @@
SELF="$(realpath "${BASH_SOURCE[0]}")"
DIR="$(cd "$(dirname "${SELF}")"; pwd -P)"
source "${DIR}/bashrc.sh"
for d in $(ls "${DIR}"/*/profile); do
source "${d}"
done

18
bashrc.sh Executable file
View File

@ -0,0 +1,18 @@
# /etc/skel/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Put your fun stuff here.

7
install.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
SELF="$(realpath "${BASH_SOURCE[0]}")"
DIR="$(cd "$(dirname "${SELF}")"; pwd -P)"
ln -s "${DIR}/bash_profile.sh" ~/.bash_profile
ln -s "${DIR}/bashrc.sh" ~/.bashrc