From 37d5ed2e327fdb80365723e68eaac9514923e0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 1 May 2016 11:08:23 +0200 Subject: [PATCH] small fixes --- .dockerignore | 1 + Dockerfile | 3 +- Makefile | 10 ++++- root/.bashrc | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 root/.bashrc diff --git a/.dockerignore b/.dockerignore index a03d515..03a1dd5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ Dockerfile Makefile cache etc/secrets-template +remote diff --git a/Dockerfile b/Dockerfile index c38ff43..4b83a03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN apk add --no-cache --update \ # sshd RUN /usr/bin/ssh-keygen -A && \ - sed -i -e "s!/root:/bin/ash!/root/:bin/bash!" /etc/passwd + sed -i -e "s!/root:/bin/ash!/root/:/bin/bash!" /etc/passwd ## temporary keys until letsencrypt certificate is generated RUN mkdir -p /etc/ssl/letsencrypt/nginx /etc/ssl/letsencrypt/influxdb && \ @@ -96,3 +96,4 @@ VOLUME ["/var/lib/influxdb/data", \ ADD . / RUN chown 400 /etc/secrets && . /etc/secrets && \ sed -i -e "s/admin_password = replaceme/admin_password = $GRAFANA_PASSWORD/" /etc/grafana.ini + diff --git a/Makefile b/Makefile index 1e7d7fd..41e4acb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ all: build +V ?= 1 +IMAGE = registry.eu-gb.bluemix.net/mic92/monitoring:$(V) + build: - docker build -t monitoring . + docker build -t $(IMAGE) . run: build docker run --rm -ti \ @@ -14,4 +17,7 @@ run: build -v icinga2-lib:/var/lib/icinga2 \ -v icingaweb2-etc:/etc/icingaweb2 \ -v ssmtp-etc:/etc/ssmtp \ - monitoring sh + $(IMAGE) sh + +upload: build + docker push $(IMAGE) diff --git a/root/.bashrc b/root/.bashrc new file mode 100644 index 0000000..7f45154 --- /dev/null +++ b/root/.bashrc @@ -0,0 +1,106 @@ +# +# .bashrc - interactive shell configuration +# + +# check for interactive +[[ $- = *i* ]] || return + +export TTY=$(tty) +export GPG_TTY=$TTY + +# shell opts: see bash(1) +shopt -s autocd cdspell dirspell extglob no_empty_cmd_completion +shopt -s checkwinsize checkhash +shopt -s histverify histappend histreedit cmdhist + +set -o notify # notify of completed background jobs immediately +set -o noclobber # don\'t overwrite files by accident +ulimit -S -c 0 # disable core dumps +stty -ctlecho # turn off control character echoing + +if [[ $TERM = linux ]]; then + setterm -regtabs 2 # set tab width of 4 (only works on TTY) +fi + +# more for less +export LESS=-R # use -X to avoid sending terminal initialization +export LESS_TERMCAP_mb=$'\e[01;31m' +export LESS_TERMCAP_md=$'\e[01;31m' +export LESS_TERMCAP_me=$'\e[0m' +export LESS_TERMCAP_se=$'\e[0m' +export LESS_TERMCAP_so=$'\e[01;44;33m' +export LESS_TERMCAP_ue=$'\e[0m' +export LESS_TERMCAP_us=$'\e[01;32m' + +# history +export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd *" +export HISTCONTROL="ignoreboth:erasedups" +export HISTSIZE=1000 +export HISTFILESIZE=2000 + +source_bash_completion() { + local f + [[ $BASH_COMPLETION ]] && return 0 + for f in /{etc,usr/share/bash-completion}/bash_completion; do + if [[ -r $f ]]; then + . "$f" + return 0; + fi + done +} + +# External config +if [[ -r ~/.dircolors ]] && type -p dircolors >/dev/null; then + eval $(dircolors -b "$HOME/.dircolors") +fi + +PS1='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]' + +source_bash_completion +[[ -r /usr/share/bash-completion/completions/git ]] && . /usr/share/bash-completion/completions/git +unset -f source_bash_completion + +# git prompt +[[ -f /usr/share/git/git-prompt.sh ]] && . /usr/share/git/git-prompt.sh + +urlencode() { + local i= char= url=$* + declare -i len=${#url} + + for (( i = 0; i < len; i++ )); do + char=${url:i:1} + case "$char" in + [a-zA-Z0-9.~_-]) printf "$char" ;; + ' ') printf + ;; + *) printf '%%%X' "'$char" ;; + esac + done +} + +mkcd() { + [[ $1 ]] || return 0 + [[ -d $1 ]] || mkdir -vp "$1" + [[ -d $1 ]] && builtin cd "$1" +} + +function ff() { find . -type f -iname '*'"$*"'*' -ls ; } + +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias gensums='[[ -f PKGBUILD ]] && makepkg -g >> PKGBUILD' +alias info='info --vi-keys' +alias j='jobs' +alias lla='ls -la' +alias ls='ls --group-directories-first --color' +alias md5='md5sum' +alias sd='systemctl' +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +[[ -r "$HOME/.bashrc.local" ]] && . "$HOME/basrc.local"