div. anpassungen

This commit is contained in:
Jakobus Schürz 2024-09-26 18:07:06 +02:00
parent e80fd819c4
commit c9fe360478
4 changed files with 14 additions and 30 deletions

33
PS1
View file

@ -13,18 +13,16 @@ parse_git_branch() {
}
set_label() {
local LABEL
SSHS=${SSHS-false}
LABEL=""
local LABEL=""
# Labels: remote, tmpconfig, screen...
if [ ! -z ${SSH_TTY:+x} ]; then
LABEL="${LABEL} ${On_IRed}${BBlack}remote${Color_Off}"
LABEL="${LABEL} ${On_IRed}${BLBlack}remote${Color_Off}"
fi
if $SSHS ; then
LABEL="${LABEL} ${On_IWhite}${BBlack}tmpconfig${Color_Off}"
if ${SSHS-false} ; then
LABEL="${LABEL} ${On_White}${BBlack}tmpconfig${Color_Off}"
fi
echo -e ${LABEL}
echo -e "${LABEL}"
}
if [ -x "/usr/bin/getsyssubvol" ]; then
@ -120,42 +118,23 @@ On_IPurple='\e[0;105m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White
LABEL=""
#LABEL=""
case "$TERM" in
xterm*|rxvt*|screen*)
case "$TERM" in
screen*) SCREEN="(SCREEN) ";;
*) SCREEN="";;
esac
# # Base prompt
# if [ "`id -u`" -eq 0 ]; then
# PS1="\[$BRed\]${SCREEN}${SYSSUBVOL}\u@\h \[$BRed\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]\$(set_label)\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BRed\]# "
# else
# PS1="\[$BIBlue\]${SCREEN}${SYSSUBVOL}\u@\h \[$BIBlue\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]\$(set_label)\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BIBlue\]\$ "
# fi
RETVAL0="\342\234\223"
RETVALN0="\342\234\227 "
;;
*)
# # Base prompt
# if [ "`id -u`" -eq 0 ]; then
# PS1="\[$BRed\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]\$(set_label)\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]"
# else
# PS1="\[$BBlue\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]\$(set_label)\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]"
# fi
RETVAL0=":)"
RETVALN0=":("
;;
esac
# Base prompt
#if [ "`id -u`" -eq 0 ]; then
# PS1="\[$BRed\]${SCREEN}${SYSSUBVOL}\u@\h \[$BRed\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]\$(set_label)\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BRed\]# "
#else
# PS1="\[$BIBlue\]${SCREEN}${SYSSUBVOL}\u@\h \[$BIBlue\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]\$(set_label)\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BIBlue\]\$ "
#fi
if [ "`id -u`" -eq 0 ]; then
PS1="\[$BRed\]${SCREEN}${SYSSUBVOL}\u@\h \[$BRed\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]\$(set_label)\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BRed\]# "
else

View file

@ -226,6 +226,7 @@ Press CTRL+C to cancel screen startup
EOF
sleep 1
#screen -UxR
loginfo "start tmux"
tmux attach-session
logdebug "started tmux"
fi

View file

@ -117,6 +117,7 @@ function _tmux_hook() {
# [ -z "${TMUX+x}" ] || eval "$(tmux show-environment -s)"
if [ -n "${TMUX:-}" ]; then
logerror "bla"
eval "$(tmux show-environment -s)"
fi
}

9
sshs
View file

@ -76,6 +76,7 @@ EOF
local sshcmd=$(cat << _remote_commands
#!/bin/bash
bashrctmp=\$(mktemp -p \${XDG_RUNTIME_DIR-~} -t bashrc.XXXXXXXX --suffix=.conf | tr -d '[:space:]')
vimrctmp=\$(mktemp -p \${XDG_RUNTIME_DIR-~} -t vimrc.XXXXXXXX --suffix=.conf | tr -d '[:space:]')
echo "\$bashrctmp \$vimrctmp"
@ -83,9 +84,11 @@ echo "\$bashrctmp \$vimrctmp"
echo "bashrctmp=\${bashrctmp}" > \${bashrctmp}
echo "vimrctmp=\${vimrctmp}" >> \${bashrctmp}
tmux set-environment bashrctmp ${bashrctmp}
cat <<- 'eof' >> \$bashrctmp
$(cat ${TMPBASHCONFIG})
export SCRIPT_LOG="\$(cat /proc/\$$/cmdline | xargs -0 echo|awk '{print \$3}' |sed 's/.conf$/.log/')"
tmux set-environment bashrctmp ${bashrctmp} &>\${SCRIPT_LOG}
title "\$USER@\$HOSTNAME: \$PWD"
loginfo "This bash runs with temporary config from \$BASHRC"
eof
@ -97,8 +100,8 @@ _remote_commands
)
local REMOTETMPCONFIGS=($(ssh -T ${SSH_OPTS} $@ "$sshcmd") )
logdebug remote tmp bashrc ${REMOTETMPCONFIGS[0]}
logdebug remote tmp vimrc ${REMOTETMPCONFIGS[1]}
logdebug "remote tmp bashrc ${REMOTETMPCONFIGS[0]}"
logdebug "remote tmp vimrc ${REMOTETMPCONFIGS[1]}"
ssh -t ${SSH_OPTS} $@ "SSHS=true exec bash --rcfile ${REMOTETMPCONFIGS[0]} -i "
rm "${TMPBASHCONFIG}"
else