set remote dir as a temp dir in order to handle multiple sessions

dev
totem4 3 years ago
parent 999ab1cc56
commit 353bd55d6c

@ -1 +1 @@
DSTDIR=/tmp/mstagliano_conf.d DSTPREFIX=mstagliano

@ -5,21 +5,20 @@ set -eu
CURDIR=$(dirname $(readlink "$0")) CURDIR=$(dirname $(readlink "$0"))
CONFHOME="~/.local/share/jssh/conf.d" CONFHOME="~/.local/share/jssh/conf.d"
CONFALLBACK="$CURDIR/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
[[ -f $CURDIR/sshrc.conf ]] && source $CURDIR/sshrc.conf DSTPREFIX=jssh
TARGET=$1 [[ -f $CURDIR/sshrc.conf ]] && source $CURDIR/sshrc.conf
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="
export JSSHHOME=$'"$DSTDIR"'; export JSSHHOME=\$(mktemp -d /tmp/$'"${DSTPREFIX}"'.XXXXXXXXXX);
mkdir \$JSSHHOME;
echo $'"$arc"' | base64 -di | tar -xzf - -C \$JSSHHOME; echo $'"$arc"' | base64 -di | tar -xzf - -C \$JSSHHOME;
trap \"rm -rf \$JSSHHOME; exit\" 0; trap \"rm -rf \$JSSHHOME; exit\" 0;
bash --rcfile \$JSSHHOME/bashrc -i bash --rcfile \$JSSHHOME/bashrc -i

Loading…
Cancel
Save