Added conffile and make it works

dev
totem4 3 years ago
parent f49a271122
commit 999ab1cc56

@ -0,0 +1 @@
/bin/bash --rcfile $JSSHHOME/bashrc

@ -9,8 +9,8 @@ alias ll='ls -alF'
alias la='ls -A' alias la='ls -A'
alias l='ls -CF' alias l='ls -CF'
alias sl='ls' alias sl='ls'
[ -r /tmp/conf.d/screenrc ] && alias screen='screen -c /tmp/conf.d/screenrc' [ -r $JSSHHOME/screenrc ] && alias screen="screen -c $JSSHHOME/screenrc"
[ -r /tmp/conf.d/vimrc ] && export VIMINIT="let \$MYVIMRC='/tmp/conf.d/vimrc' | source \$MYVIMRC" [ -r $JSSHHOME/vimrc ] && export VIMINIT="let \$MYVIMRC='$JSSHHOME/vimrc' | source \$MYVIMRC"
PROMPT_COMMAND=__prompt_command PROMPT_COMMAND=__prompt_command
__prompt_command() { __prompt_command() {
local curr_exit="$?" local curr_exit="$?"

@ -1,3 +1,4 @@
defshell $JSSHHOME/bash_init
startup_message off startup_message off
deflogin on deflogin on
vbell off vbell off

@ -1,3 +1,11 @@
if filereadable(expand("$VIMRUNTIME/defaults.vim"))
source $VIMRUNTIME/defaults.vim
endif
if !empty($JSSHHOME)
let localdir = $JSSHHOME
else
let localdir = "/tmp"
endif
if has("vms") if has("vms")
set nobackup " do not keep a backup file, use versions instead set nobackup " do not keep a backup file, use versions instead
else else
@ -15,9 +23,9 @@ set laststatus=2
set ignorecase set ignorecase
set smartcase set smartcase
set t_Co=256 set t_Co=256
set undodir=/tmp/conf.d// let &undodir=localdir . "//"
set directory=/tmp/conf.d// let &directory=localdir . "//"
set backupdir=/tmp/conf.d// let &backupdir=localdir . "//"
set mouse="" set mouse=""
set shiftwidth=4 set shiftwidth=4
set tabstop=4 set tabstop=4

@ -0,0 +1 @@
DSTDIR=/tmp/mstagliano_conf.d

@ -2,25 +2,27 @@
set -eu set -eu
CURDIR=$(dirname $(readlink "$0"))
CONFHOME="~/.local/share/jssh/conf.d" CONFHOME="~/.local/share/jssh/conf.d"
CONFALLBACK="$(dirname $(readlink "$0"))/conf.d" CONFALLBACK="$CURDIR/conf.d"
[[ -d $CONFHOME ]] && CONFDIR=$CONFHOME || CONFDIR=$CONFALLBACK [[ -d $CONFHOME ]] && CONFDIR=$CONFHOME || CONFDIR=$CONFALLBACK
[[ -r $CONFDIR/bashrc ]] || { echo "Confdir or bashrc missing or lack of permissions!"; exit 1; } [[ -r $CONFDIR/bashrc ]] || { echo "Confdir or bashrc missing or lack of permissions!"; exit 1; }
DSTDIR=/tmp/conf.d DSTDIR=/tmp/conf.d
[[ -f $CURDIR/sshrc.conf ]] && source $CURDIR/sshrc.conf
TARGET=$1 TARGET=$1
arc=$(tar czf - -C $CONFDIR $(find $CONFDIR -type f -printf "%f ")| base64 -w0) 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; } [[ $(echo $arc | wc -c) -le 65535 ]] || { echo "Files size too large!"; exit 1; }
COMMANDS=" COMMANDS="
mkdir $'"$DSTDIR"'; export JSSHHOME=$'"$DSTDIR"';
echo $'"$arc"' | base64 -di | tar -xzf - -C $'"$DSTDIR"'; mkdir \$JSSHHOME;
trap \"rm -rf /tmp/conf.d; exit\" 0; echo $'"$arc"' | base64 -di | tar -xzf - -C \$JSSHHOME;
bash --rcfile /tmp/conf.d/bashrc -i trap \"rm -rf \$JSSHHOME; exit\" 0;
bash --rcfile \$JSSHHOME/bashrc -i
" "
sshrc() {
ssh -t $TARGET $COMMANDS
}
sshrc $@ ssh -t $@ $COMMANDS

Loading…
Cancel
Save