commit 92fba87e050ac3742998cfc32c475cd7616f74a9 Author: Zio Date: Tue Jan 25 08:22:12 2022 +0000 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3c2ab9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +/* +!.gitignore + +!/etc/ +/etc/* +!/etc/issue + +!/etc/skel/ +/etc/skel/* +!/etc/skel/.bashrc + +!/root/ +/root/* +!/root/.bashrc diff --git a/etc/issue b/etc/issue new file mode 120000 index 0000000..a08a48f --- /dev/null +++ b/etc/issue @@ -0,0 +1 @@ +../usr/lib/issue \ No newline at end of file diff --git a/etc/skel/.bashrc b/etc/skel/.bashrc new file mode 100644 index 0000000..7e2e50c --- /dev/null +++ b/etc/skel/.bashrc @@ -0,0 +1,112 @@ +# DO NOT EDIT THIS FILE! +# +# Everytime this is sourced, a new version is pulled from /etc/skel/.bashrc, +# rendering any changes you make here overwritten the next time you launch Bash. +# +# Put any extra aliases, functions, or other mess into ~/.bash_aliases. + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# Various options +HISTCONTROL=ignoreboth +shopt -s histappend +HISTSIZE=1000 +HISTFILESIZE=2000 +shopt -s checkwinsize + +# Helpers +function color() { + code=$1 + style=$2 + + [[ -z $style ]] && style="0" + + if [[ -z $code ]]; then + echo "\033[00m" + else + echo "\033[0${style};${code}m" + fi +} + +function get_caret_color() { + caret_color_code="36" + [[ $USER == "root" ]] && caret_color_code="31" + + echo "$caret_color_code" +} + +function print_header() { + echo -e "$(color 31 1) ______ + |__ (_) ___ + / /| |/ _ \\ + / /_| | (_) | + /____|_|\\___/$(color)" + + echo " " + + if [[ $USER == "root" ]]; then + echo -e "$(color 33 1) 🔥 Here be dragons.$(color)" + else + echo -e " 👋 Hello $(color 33 1)$USER$(color), I am $(color 33 1)$(hostname -f)$(color)." + fi + + echo " " +} + +function reset_shell() { + clear + update_bashrc + print_header +} + +function update_bashrc() { + cp -f /etc/skel/.bashrc ~/.bashrc +} + +# A dash of color? +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# Make less friendly for non-text input files +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# Color support for ls +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# Sexy prompt +if [ "$color_prompt" = yes ]; then + PS1="\[$(color 32 1)\]\h$(color 37):$(color 32 1)\W$(color 37) $(color $(get_caret_color))➜ $(color) " +else + PS1="\h:\W >" +fi + +# Source aliases (instead of editing your ~/.bashrc!) +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# Source bash completions +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +# Hello, world! +reset_shell diff --git a/root/.bashrc b/root/.bashrc new file mode 100644 index 0000000..7e2e50c --- /dev/null +++ b/root/.bashrc @@ -0,0 +1,112 @@ +# DO NOT EDIT THIS FILE! +# +# Everytime this is sourced, a new version is pulled from /etc/skel/.bashrc, +# rendering any changes you make here overwritten the next time you launch Bash. +# +# Put any extra aliases, functions, or other mess into ~/.bash_aliases. + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# Various options +HISTCONTROL=ignoreboth +shopt -s histappend +HISTSIZE=1000 +HISTFILESIZE=2000 +shopt -s checkwinsize + +# Helpers +function color() { + code=$1 + style=$2 + + [[ -z $style ]] && style="0" + + if [[ -z $code ]]; then + echo "\033[00m" + else + echo "\033[0${style};${code}m" + fi +} + +function get_caret_color() { + caret_color_code="36" + [[ $USER == "root" ]] && caret_color_code="31" + + echo "$caret_color_code" +} + +function print_header() { + echo -e "$(color 31 1) ______ + |__ (_) ___ + / /| |/ _ \\ + / /_| | (_) | + /____|_|\\___/$(color)" + + echo " " + + if [[ $USER == "root" ]]; then + echo -e "$(color 33 1) 🔥 Here be dragons.$(color)" + else + echo -e " 👋 Hello $(color 33 1)$USER$(color), I am $(color 33 1)$(hostname -f)$(color)." + fi + + echo " " +} + +function reset_shell() { + clear + update_bashrc + print_header +} + +function update_bashrc() { + cp -f /etc/skel/.bashrc ~/.bashrc +} + +# A dash of color? +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# Make less friendly for non-text input files +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# Color support for ls +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# Sexy prompt +if [ "$color_prompt" = yes ]; then + PS1="\[$(color 32 1)\]\h$(color 37):$(color 32 1)\W$(color 37) $(color $(get_caret_color))➜ $(color) " +else + PS1="\h:\W >" +fi + +# Source aliases (instead of editing your ~/.bashrc!) +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# Source bash completions +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +# Hello, world! +reset_shell