matteo stagliano 3 years ago
commit 2ddd148a92

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

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

@ -1,3 +1,4 @@
defshell $JSSHHOME/bash_init
startup_message off
deflogin on
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")
set nobackup " do not keep a backup file, use versions instead
else
@ -15,9 +23,9 @@ 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//
let &undodir=localdir . "//"
let &directory=localdir . "//"
let &backupdir=localdir . "//"
set mouse=""
set shiftwidth=4
set tabstop=4

@ -0,0 +1 @@
DSTPREFIX=mstagliano

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

Loading…
Cancel
Save