add readme, split up files, install script
This commit is contained in:
parent
46f1861e3d
commit
b72fff90ab
@ -17,3 +17,8 @@ alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | printf '=> Public key copied to
|
|||||||
|
|
||||||
# When there's need for nyaning around
|
# When there's need for nyaning around
|
||||||
alias nyan="telnet nyancat.dakko.us"
|
alias nyan="telnet nyancat.dakko.us"
|
||||||
|
|
||||||
|
|
||||||
|
# Add an "alert" alias for long running commands. Use like so:
|
||||||
|
# sleep 10; alert
|
||||||
|
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
||||||
|
126
.bash_prompt
Normal file
126
.bash_prompt
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# bash_prompt, from @mathiasbynens
|
||||||
|
# slightly modified
|
||||||
|
# https://github.com/mathiasbynens/dotfiles/blob/master/.bash_prompt
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
|
||||||
|
export TERM='gnome-256color';
|
||||||
|
elif infocmp xterm-256color >/dev/null 2>&1; then
|
||||||
|
export TERM='xterm-256color';
|
||||||
|
fi;
|
||||||
|
|
||||||
|
prompt_git() {
|
||||||
|
local s='';
|
||||||
|
local branchName='';
|
||||||
|
|
||||||
|
# Check if the current directory is in a Git repository.
|
||||||
|
if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then
|
||||||
|
|
||||||
|
# check if the current directory is in .git before running git checks
|
||||||
|
if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then
|
||||||
|
|
||||||
|
# Ensure the index is up to date.
|
||||||
|
git update-index --really-refresh -q &>/dev/null;
|
||||||
|
|
||||||
|
# Check for uncommitted changes in the index.
|
||||||
|
if ! $(git diff --quiet --ignore-submodules --cached); then
|
||||||
|
s+='+';
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Check for unstaged changes.
|
||||||
|
if ! $(git diff-files --quiet --ignore-submodules --); then
|
||||||
|
s+='!';
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Check for untracked files.
|
||||||
|
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
||||||
|
s+='?';
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Check for stashed files.
|
||||||
|
if $(git rev-parse --verify refs/stash &>/dev/null); then
|
||||||
|
s+='$';
|
||||||
|
fi;
|
||||||
|
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Get the short symbolic ref.
|
||||||
|
# If HEAD isn’t a symbolic ref, get the short SHA for the latest commit
|
||||||
|
# Otherwise, just give up.
|
||||||
|
branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \
|
||||||
|
git rev-parse --short HEAD 2> /dev/null || \
|
||||||
|
echo '(unknown)')";
|
||||||
|
|
||||||
|
[ -n "${s}" ] && s=" ${s}";
|
||||||
|
|
||||||
|
echo -e "${1}${branchName}${orange}${s}";
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
|
||||||
|
if tput setaf 1 &> /dev/null; then
|
||||||
|
tput sgr0; # reset colors
|
||||||
|
bold=$(tput bold);
|
||||||
|
dim=$(tput setaf 240);
|
||||||
|
reset=$(tput sgr0);
|
||||||
|
# Tomorrow colors, taken from https://github.com/Slava/vim-colors-tomorrow/blob/master/colors/tomorrow.vim
|
||||||
|
black=$(tput setaf 236);
|
||||||
|
gray=$(tput setaf 242);
|
||||||
|
blue=$(tput setaf 109);
|
||||||
|
green=$(tput setaf 143);
|
||||||
|
cyan=$(tput setaf 110);
|
||||||
|
orange=$(tput setaf 173);
|
||||||
|
purple=$(tput setaf 125);
|
||||||
|
red=$(tput setaf 167);
|
||||||
|
magenta=$(tput setaf 139);
|
||||||
|
violet=$(tput setaf 139);
|
||||||
|
white=$(tput setaf 15);
|
||||||
|
yellow=$(tput setaf 136);
|
||||||
|
else
|
||||||
|
bold='';
|
||||||
|
reset="\e[0m";
|
||||||
|
black="\e[1;30m";
|
||||||
|
blue="\e[1;34m";
|
||||||
|
cyan="\e[1;36m";
|
||||||
|
green="\e[1;32m";
|
||||||
|
orange="\e[1;33m";
|
||||||
|
purple="\e[1;35m";
|
||||||
|
red="\e[1;31m";
|
||||||
|
violet="\e[1;35m";
|
||||||
|
white="\e[1;37m";
|
||||||
|
yellow="\e[1;33m";
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Highlight the user name when logged in as root.
|
||||||
|
if [[ "${USER}" == "root" ]]; then
|
||||||
|
userStyle="${red}";
|
||||||
|
else
|
||||||
|
userStyle="${orange}";
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Highlight the hostname when connected via SSH.
|
||||||
|
if [[ "${SSH_TTY}" ]]; then
|
||||||
|
hostStyle="${bold}${cyan}";
|
||||||
|
else
|
||||||
|
hostStyle="${cyan}";
|
||||||
|
fi;
|
||||||
|
|
||||||
|
# Set the terminal title to the current working directory.
|
||||||
|
PS1="\[\033]0;\w\007\]";
|
||||||
|
PS1+="\n";
|
||||||
|
#PS1+="\[${orange}\]\w"; # working directory
|
||||||
|
PS1+="\[${bold}\]\n"; # newline
|
||||||
|
PS1+="\[${userStyle}\]\u"; # username
|
||||||
|
PS1+="\[${dim}\] at ";
|
||||||
|
PS1+="\[${hostStyle}\]\h"; # host
|
||||||
|
PS1+="\[${dim}\] in ";
|
||||||
|
PS1+="\[${blue}\]\w"; # working directory full path
|
||||||
|
PS1+="\$(prompt_git \" \[${gray}\]\")"; # Git repository details
|
||||||
|
PS1+="\n";
|
||||||
|
PS1+="\[${dim}\]→ \[${reset}\]"; # `→` (and reset color)
|
||||||
|
export PS1;
|
||||||
|
|
||||||
|
PS2="\[${dim}\]→ \[${reset}\]";
|
||||||
|
export PS2;
|
149
.bashrc
149
.bashrc
@ -4,13 +4,26 @@ case $- in
|
|||||||
*) return;;
|
*) return;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# SHELL OPTIONS
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
# don't put duplicate lines or lines starting with space in the history.
|
# don't put duplicate lines or lines starting with space in the history.
|
||||||
# See bash(1) for more options
|
# See bash(1) for more options
|
||||||
HISTCONTROL=ignoreboth
|
HISTCONTROL=ignoreboth
|
||||||
|
|
||||||
# append to the history file, don't overwrite it
|
# Append to the Bash history file, rather than overwriting it
|
||||||
shopt -s histappend
|
shopt -s histappend
|
||||||
|
|
||||||
|
# fuck that you have new mail shit
|
||||||
|
unset MAILCHECK
|
||||||
|
|
||||||
|
# Case-insensitive globbing (used in pathname expansion)
|
||||||
|
shopt -s nocaseglob
|
||||||
|
|
||||||
|
# Autocorrect typos in path names when using `cd`
|
||||||
|
shopt -s cdspell
|
||||||
|
|
||||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||||
HISTSIZE=1000
|
HISTSIZE=1000
|
||||||
HISTFILESIZE=2000
|
HISTFILESIZE=2000
|
||||||
@ -23,127 +36,6 @@ shopt -s checkwinsize
|
|||||||
# match all files and zero or more directories and subdirectories.
|
# match all files and zero or more directories and subdirectories.
|
||||||
#shopt -s globstar
|
#shopt -s globstar
|
||||||
|
|
||||||
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
|
|
||||||
export TERM='gnome-256color';
|
|
||||||
elif infocmp xterm-256color >/dev/null 2>&1; then
|
|
||||||
export TERM='xterm-256color';
|
|
||||||
fi;
|
|
||||||
|
|
||||||
prompt_git() {
|
|
||||||
local s='';
|
|
||||||
local branchName='';
|
|
||||||
|
|
||||||
# Check if the current directory is in a Git repository.
|
|
||||||
if [ $(git rev-parse --is-inside-work-tree &>/dev/null; echo "${?}") == '0' ]; then
|
|
||||||
|
|
||||||
# check if the current directory is in .git before running git checks
|
|
||||||
if [ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" == 'false' ]; then
|
|
||||||
|
|
||||||
# Ensure the index is up to date.
|
|
||||||
git update-index --really-refresh -q &>/dev/null;
|
|
||||||
|
|
||||||
# Check for uncommitted changes in the index.
|
|
||||||
if ! $(git diff --quiet --ignore-submodules --cached); then
|
|
||||||
s+='+';
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Check for unstaged changes.
|
|
||||||
if ! $(git diff-files --quiet --ignore-submodules --); then
|
|
||||||
s+='!';
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Check for untracked files.
|
|
||||||
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
|
||||||
s+='?';
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Check for stashed files.
|
|
||||||
if $(git rev-parse --verify refs/stash &>/dev/null); then
|
|
||||||
s+='$';
|
|
||||||
fi;
|
|
||||||
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Get the short symbolic ref.
|
|
||||||
# If HEAD isn’t a symbolic ref, get the short SHA for the latest commit
|
|
||||||
# Otherwise, just give up.
|
|
||||||
branchName="$(git symbolic-ref --quiet --short HEAD 2> /dev/null || \
|
|
||||||
git rev-parse --short HEAD 2> /dev/null || \
|
|
||||||
echo '(unknown)')";
|
|
||||||
|
|
||||||
[ -n "${s}" ] && s=" ${s}";
|
|
||||||
|
|
||||||
echo -e "${1}${branchName}${orange}${s}";
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
fi;
|
|
||||||
}
|
|
||||||
|
|
||||||
if tput setaf 1 &> /dev/null; then
|
|
||||||
tput sgr0; # reset colors
|
|
||||||
bold=$(tput bold);
|
|
||||||
dim=$(tput setaf 240);
|
|
||||||
reset=$(tput sgr0);
|
|
||||||
# Tomorrow colors, taken from https://github.com/Slava/vim-colors-tomorrow/blob/master/colors/tomorrow.vim
|
|
||||||
black=$(tput setaf 236);
|
|
||||||
gray=$(tput setaf 242);
|
|
||||||
blue=$(tput setaf 109);
|
|
||||||
green=$(tput setaf 143);
|
|
||||||
cyan=$(tput setaf 110);
|
|
||||||
orange=$(tput setaf 173);
|
|
||||||
purple=$(tput setaf 125);
|
|
||||||
red=$(tput setaf 167);
|
|
||||||
magenta=$(tput setaf 139);
|
|
||||||
violet=$(tput setaf 139);
|
|
||||||
white=$(tput setaf 15);
|
|
||||||
yellow=$(tput setaf 136);
|
|
||||||
else
|
|
||||||
bold='';
|
|
||||||
reset="\e[0m";
|
|
||||||
black="\e[1;30m";
|
|
||||||
blue="\e[1;34m";
|
|
||||||
cyan="\e[1;36m";
|
|
||||||
green="\e[1;32m";
|
|
||||||
orange="\e[1;33m";
|
|
||||||
purple="\e[1;35m";
|
|
||||||
red="\e[1;31m";
|
|
||||||
violet="\e[1;35m";
|
|
||||||
white="\e[1;37m";
|
|
||||||
yellow="\e[1;33m";
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Highlight the user name when logged in as root.
|
|
||||||
if [[ "${USER}" == "root" ]]; then
|
|
||||||
userStyle="${red}";
|
|
||||||
else
|
|
||||||
userStyle="${orange}";
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Highlight the hostname when connected via SSH.
|
|
||||||
if [[ "${SSH_TTY}" ]]; then
|
|
||||||
hostStyle="${bold}${cyan}";
|
|
||||||
else
|
|
||||||
hostStyle="${cyan}";
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# Set the terminal title to the current working directory.
|
|
||||||
PS1="\[\033]0;\w\007\]";
|
|
||||||
PS1+="\n";
|
|
||||||
#PS1+="\[${orange}\]\w"; # working directory
|
|
||||||
PS1+="\[${bold}\]\n"; # newline
|
|
||||||
PS1+="\[${userStyle}\]\u"; # username
|
|
||||||
PS1+="\[${dim}\] at ";
|
|
||||||
PS1+="\[${hostStyle}\]\h"; # host
|
|
||||||
PS1+="\[${dim}\] in ";
|
|
||||||
PS1+="\[${blue}\]\w"; # working directory full path
|
|
||||||
PS1+="\$(prompt_git \" \[${gray}\]\")"; # Git repository details
|
|
||||||
PS1+="\n";
|
|
||||||
PS1+="\[${dim}\]→ \[${reset}\]"; # `→` (and reset color)
|
|
||||||
export PS1;
|
|
||||||
|
|
||||||
PS2="\[${dim}\]→ \[${reset}\]";
|
|
||||||
export PS2;
|
|
||||||
|
|
||||||
# LSCOLORS
|
# LSCOLORS
|
||||||
export CLICOLOR=1
|
export CLICOLOR=1
|
||||||
export LSCOLORS=gxfxcxdxbxegedabagacad
|
export LSCOLORS=gxfxcxdxbxegedabagacad
|
||||||
@ -161,19 +53,6 @@ if [ -x /usr/bin/dircolors ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Add an "alert" alias for long running commands. Use like so:
|
|
||||||
# sleep 10; alert
|
|
||||||
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
|
||||||
|
|
||||||
# Alias definitions.
|
|
||||||
# You may want to put all your additions into a separate file like
|
|
||||||
# ~/.bash_aliases, instead of adding them here directly.
|
|
||||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
|
||||||
|
|
||||||
if [ -f ~/.bash_aliases ]; then
|
|
||||||
. ~/.bash_aliases
|
|
||||||
fi
|
|
||||||
|
|
||||||
# enable programmable completion features (you don't need to enable
|
# enable programmable completion features (you don't need to enable
|
||||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||||
# sources /etc/bash.bashrc).
|
# sources /etc/bash.bashrc).
|
||||||
|
15
.profile
Normal file
15
.profile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# if running bash
|
||||||
|
if [ -n "$BASH_VERSION" ]; then
|
||||||
|
|
||||||
|
# source all the things
|
||||||
|
for file in ~/.{bash_aliases,bashrc,bash_prompt}; do
|
||||||
|
[ -r "$file" ] && [ -f "$file" ] && source "$file"
|
||||||
|
done;
|
||||||
|
unset file;
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set PATH so it includes user's private bin if it exists
|
||||||
|
if [ -d "$HOME/bin" ] ; then
|
||||||
|
PATH="$HOME/bin:$PATH"
|
||||||
|
fi
|
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# dotfiles-server
|
||||||
|
|
||||||
|
> dotfiles for every new server instance, making myself comfortable in the cloud
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://www.git.berlin/kremalicious/dotfiles-server.git
|
||||||
|
cd dotfiles-server/bin
|
||||||
|
|
||||||
|
# install dotfiles
|
||||||
|
./install-dotfiles.sh
|
||||||
|
```
|
14
bin/install-dotfiles.sh
Executable file
14
bin/install-dotfiles.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# list of files/folders to symlink in homedir
|
||||||
|
FILES=".bash_aliases .bashrc .profile bin .vimrc"
|
||||||
|
|
||||||
|
# remove old version and symlink files
|
||||||
|
for FILE in $FILES; do
|
||||||
|
rm ~/$FILE
|
||||||
|
ln -s $FILE ~/$FILE
|
||||||
|
echo "$(tput setaf 64)✓$(tput sgr0) Symlink created to $(tput setaf 37)$FILE$(tput sgr0)"
|
||||||
|
done
|
||||||
|
|
||||||
|
# source what we just created
|
||||||
|
source ~/.profile
|
Loading…
Reference in New Issue
Block a user