First working version

dev
totem4 3 years ago
parent 66ad09e907
commit cc4b685d07

@ -1,136 +1,23 @@
# ~/.bashrc: executed by bash(1) for non-login shells. [ -d /etc/update-motd.d ] && run-parts /etc/update-motd.d
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) [ -r /etc/motd ] && cat /etc/motd
# for examples [ -r /etc/profile ] && source /etc/profile
[ -r /etc/bash.bashrc ] && source /etc/bash.bashrc
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
export PATH=~/.local/bin:/snap/bin:/usr/sandbox/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:$PATH
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend shopt -s histappend
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) alias ll='ls -alF'
HISTSIZE=1000 alias la='ls -A'
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
else
PS1='┌──[\u@\h]─[\w]\n└──╼ \$ '
fi
# Set 'man' colors
if [ "$color_prompt" = yes ]; then
man() {
env \
LESS_TERMCAP_mb=$'\e[01;31m' \
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
man "$@"
}
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
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
# some more ls aliases
alias ll='ls -lh'
alias la='ls -lha'
alias l='ls -CF' alias l='ls -CF'
alias em='emacs -nw' alias sl='ls'
alias dd='dd status=progress' [ -r /tmp/conf.d/vimrc ] && alias vim='vim -Nu /tmp/conf.d/vimrc'
alias _='sudo' [ -r /tmp/conf.d/screenrc ] && alias screen='screen -c /tmp/conf.d/screenrc'
alias _i='sudo -i' PROMPT_COMMAND=__prompt_command
__prompt_command() {
# Alias definitions. local curr_exit="$?"
# You may want to put all your additions into a separate file like PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# ~/.bash_aliases, instead of adding them here directly. if [ "$curr_exit" != 0 ]; then
# See /usr/share/doc/bash-doc/examples in the bash-doc package. PS1="[$curr_exit]$PS1"
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
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
fi }
EDITOR=vim
set -o vi set -o vi
EDITOR='vim'

@ -0,0 +1,32 @@
startup_message off
deflogin on
vbell off
defscrollback 102400
bind ^k
bind ^\
bind \\ quit
bind K kill
bind I login on
bind O login off
bind } history
bind h focus left
bind j focus down
bind k focus up
bind l focus right
termcapinfo vt100 dl=5\E[M
hardstatus off
termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
hardstatus string "%h%? users: %u%?"
hardstatus alwayslastline #"%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
hardstatus string "%{= Kd}%{kd}%-Lw%{= Yk}%50>%n%f* %t%{-}%+Lw%< %-=%{kd}%{y}[%{-}%d/%m/%y - %c%{y}]"
caption always string "%?%F%{.G.}%?%3n %t%? [%h]%?"
termcapinfo xterm*|linux*|rxvt*|Eterm* OP
termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
termcapinfo xterm*|xterms|xs|rxvt ti@:te@
defnonblock 5
altscreen on
bind c screen 1
bind ^c screen 1
bind 0 select 10
shelltitle '$|bash'
screen 1

@ -1 +0,0 @@
diocane

@ -0,0 +1,23 @@
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file (restore to previous version)
if has('persistent_undo')
set undofile " keep an undo file (undo changes after closing)
endif
endif
set autoindent
if has('syntax') && has('eval')
packadd! matchit
endif
set number
set laststatus=2
set ignorecase
set smartcase
set t_Co=256
set undodir=/tmp/conf.d//
set directory=/tmp/conf.d//
set backupdir=/tmp/conf.d//
set mouse=""
set shiftwidth=4
set tabstop=4

@ -2,11 +2,22 @@
set -eu set -eu
mk_src() { CONFDIR=/home/totem4/Apps/my_script/sshrc/conf.d
cd /home/totem4/Apps/my_script/sshrc/conf.d [[ -r $CONFDIR/bashrc ]] || { echo "Confdir or bashrc missing or lack of permissions!"; exit 1; }
tar -czO * | base64 -w0 DSTDIR=/tmp/conf.d
} TARGET=$1
arc=$(tar czf - -C $CONFDIR $(find $CONFDIR -type f -printf "%f ")| base64 -w0)
[[ $(echo $arc | wc -c) -le 65535 ]] || { echo "Files size too large!"; exit 1; }
scpt=$(mk_src) COMMANDS="
mkdir /tmp/conf.d;
echo $'"$arc"' | base64 -di | tar -xzf - -C $'"$DSTDIR"';
trap \"rm -rf /tmp/conf.d; exit\" 0;
bash --rcfile /tmp/conf.d/bashrc -i
"
sshrc() {
ssh -t $TARGET $COMMANDS
}
ssh -t $1 "mkdir -p /tmp/totem4rc; cd /tmp/totem4rc; echo ${scpt} | base64 -di | tar -xzf - ; cd ; bash --rcfile /tmp/totem4rc/bashrc -i; rm -r /tmp/totem4rc" sshrc $@

Loading…
Cancel
Save