fix adding file to sshs via config-file

This commit is contained in:
Jakobus Schürz 2023-03-29 11:10:11 +02:00
parent 0654a3d00b
commit 135612ed88
2 changed files with 14 additions and 13 deletions

22
sshs
View file

@ -5,23 +5,23 @@ sshs() {
if [ -n "${TMUX}" ]; then
tmux set-environment sshcon "$@"
fi
local LOGLEVEL="WARN"
# local LOGLEVEL="WARN"
# MKTMPCMD='mktemp $(echo ${XDG_RUNTIME_DIR}/bashrc.XXXXXXXX.conf)'
# VIMMKTMPCMD="mktemp ${XDG_RUNTIME_DIR}/vimrc.XXXXXXXX.conf"
local f
local TMPBASHCONFIG=$(mktemp -p ${XDG_RUNTIME_DIR} -t bashrc.XXXXXXXX --suffix=.conf)
# local FILELIST=( "${MSC_BASE}/functions.sh" "${MSC_BASE}/logging" "${MSC_BASE}/myshell_load_fortmpconfig" $(getbashrcfile) ~/.bash_aliases "${MSC_BASE}/aliases" "${MSC_BASE}/PS1" "${MSC_BASE}/bash_completion.d/*" )
local FILELIST=()
logdebug "FILELIST: ${FILELIST[@]}"
if [ -e "${HOME}/.config/myshellconfig/sshs_addfiles.conf" ] ; then
for f in $(cat "${HOME}/.config/myshellconfig/sshs_addfiles.conf");do
[ -e "$f" ] && {\
logdebug "add $f to FILELIST"; \
FILELIST+=("$f"); }
if [ -e "${MSC_BASE}/sshs_addfiles.conf" ] ; then
for f in $(envsubst < ${MSC_BASE}/sshs_addfiles.conf);do
logdebug "add to FILELIST: ${f}";
FILELIST+=("${f}");
done
else
loginfo "Filelist for sshs not found: ${MSC_BASE}/sshs_addfiles.conf"
fi
logdebug "FILELIST1: ${FILELIST[@]}"
# logdebug "FILELIST1: ${FILELIST[@]}"
local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=auto -o ControlPersist=20s"
#local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=auto -o ControlPersist=20s -o ControlPath=~/.ssh/master-%C"
#local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=yes -o ControlPersist=10s -o ControlPath=~/.ssh/ssh-%C"
@ -59,9 +59,9 @@ done
unset i
EOF
for f in ${FILELIST[*]}; do
for f in ${FILELIST[@]}; do
if [ -e $f ]; then
logdebug "add $f to tmpconfig"
logdebug "add to tmpconfig: $f"
cat "$f" >> "${TMPBASHCONFIG}";
fi
done

View file

@ -1,8 +1,9 @@
${MSC_BASE}/functions.sh
${MSC_BASE}/logging
${MSC_BASE}/myshell_load_fortmpconfig
$(getbashrcfile) ~/.aliases
$(getbashrcfile) ~/.bash_aliases
$(getbashrcfile)
${HOME}/.aliases
${HOME}/.bash_aliases
${MSC_BASE}/aliases
${MSC_BASE}/PS1
${MSC_BASE}/bash_completion.d/*