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() { set_label() {
local LABEL local LABEL=""
SSHS=${SSHS-false}
LABEL=""
# Labels: remote, tmpconfig, screen... # Labels: remote, tmpconfig, screen...
if [ ! -z ${SSH_TTY:+x} ]; then if [ ! -z ${SSH_TTY:+x} ]; then
LABEL="${LABEL} ${On_IRed}${BBlack}remote${Color_Off}" LABEL="${LABEL} ${On_IRed}${BLBlack}remote${Color_Off}"
fi fi
if $SSHS ; then if ${SSHS-false} ; then
LABEL="${LABEL} ${On_IWhite}${BBlack}tmpconfig${Color_Off}" LABEL="${LABEL} ${On_White}${BBlack}tmpconfig${Color_Off}"
fi fi
echo -e ${LABEL} echo -e "${LABEL}"
} }
if [ -x "/usr/bin/getsyssubvol" ]; then if [ -x "/usr/bin/getsyssubvol" ]; then
@ -120,42 +118,23 @@ On_IPurple='\e[0;105m' # Purple
On_ICyan='\e[0;106m' # Cyan On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White On_IWhite='\e[0;107m' # White
LABEL="" #LABEL=""
case "$TERM" in case "$TERM" in
xterm*|rxvt*|screen*) xterm*|rxvt*|screen*)
case "$TERM" in case "$TERM" in
screen*) SCREEN="(SCREEN) ";; screen*) SCREEN="(SCREEN) ";;
*) SCREEN="";; *) SCREEN="";;
esac 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" RETVAL0="\342\234\223"
RETVALN0="\342\234\227 " 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=":)" RETVAL0=":)"
RETVALN0=":(" RETVALN0=":("
;; ;;
esac esac
# Base prompt # 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 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\]# " 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 else

View file

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

View file

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

9
sshs
View file

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