Merge pull request 'general/radical improvements' (#11) from dev into master
Reviewed-on: totem4/sshrc#11master
commit
4fa4e90f95
@ -0,0 +1 @@
|
|||||||
|
/bin/bash --rcfile $JSSHHOME/bashrc.jssh
|
@ -1 +0,0 @@
|
|||||||
/bin/bash --rcfile $JSSHHOME/bashrc
|
|
@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
CONFHOME="~/.local/share/jssh"
|
||||||
|
CONFALLBACK=$(dirname $(readlink -f -- "$0"))
|
||||||
|
|
||||||
|
[[ -d $CONFHOME ]] && CONFDIR=$CONFHOME || CONFDIR=$CONFALLBACK
|
||||||
|
|
||||||
|
[[ -r $CONFDIR/bashrc.jssh ]] || { echo "Confdir or bashrc missing or lack of permissions!"; exit 1; }
|
||||||
|
|
||||||
|
DSTPREFIX=jssh
|
||||||
|
|
||||||
|
[[ -r "$CONFDIR/sshrc.conf.jssh" ]] && source $CONFDIR/sshrc.conf.jssh
|
||||||
|
|
||||||
|
arc=$(tar czf - -C $CONFDIR $(find $CONFDIR -name ".*" -prune -o -type f -regex ".*\.jssh" -printf "%f ")| base64 -w0)
|
||||||
|
[[ $(echo $arc | wc -c) -le 65535 ]] || { echo "Files size too large!"; exit 1; }
|
||||||
|
|
||||||
|
COMMANDS="
|
||||||
|
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.jssh -i
|
||||||
|
"
|
||||||
|
|
||||||
|
ssh -t $@ $COMMANDS
|
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
CURDIR=$(dirname $(readlink "$0"))
|
|
||||||
CONFLOCAL="~/.local/share/jssh"
|
|
||||||
CONFHOME="$CONFLOCAL/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; }
|
|
||||||
|
|
||||||
DSTPREFIX=jssh
|
|
||||||
|
|
||||||
if [[ -r "$CONFLOCAL/sshrc.conf" ]]; then
|
|
||||||
source "$CONFLOCAL/sshrc.conf"
|
|
||||||
elif [[ -r "$CURDIR/sshrc.conf" ]]; then
|
|
||||||
source "$CURDIR/sshrc.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
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="
|
|
||||||
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
|
|
||||||
"
|
|
||||||
|
|
||||||
ssh -t $@ $COMMANDS
|
|
Loading…
Reference in New Issue