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

View file

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