Fixes for bashrc

This commit is contained in:
DarkFeather 2017-10-10 10:37:30 -05:00
parent 3f04d3265d
commit e4afa2e8e5
3 changed files with 21 additions and 17 deletions

View File

@ -1,17 +1,13 @@
HTTPROOT = /srv/http/aninix.net
HTTPUSER = http
SYNCLIST = /etc/vimrc /etc/bash.bashrc /etc/skel /etc/tmux.conf /etc/profile
SYNCLIST = /etc/vimrc /etc/bashrc /etc/skel /etc/tmux.conf /etc/profile
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
compile: ./shadowarch
@echo Nothing to compile
install: compile
cp ./vimrc /etc/vimrc
cp bash.bashrc /etc/bash.bashrc
rsync -avz -r skel/ /etc/skel
cp tmux.conf /etc/tmux.conf
cp ./profile /etc/profile
for i in ${SYNCLIST}; do rsync -avz -r `echo $$i | sed 's#^/etc/##'` $$i; done
# This is a nicety.
if [ -f /root/shadowarch* ]; then sed -i 's/`uname -o`/ShadowArch/g' /etc/bash.bashrc; fi
@ -35,7 +31,7 @@ reverse: ${HTTPROOT}/shadowarch ${SYNCLIST}
sed -i 's/ShadowArch/`uname -o`/' ./bash.bashrc
clean:
@echo Nothing to do.
if [ -f /etc/bash.bashrc ]; then printf "Remove /etc/bash.bashrc? [y/n] "; read answer; if [ "$$answer" == "y" ]; then rm /etc/bash.bashrc; fi; fi
diff: ${HTTPROOT}/shadowarch ${SYNCLIST}
diff ./shadowarch ${HTTPROOT}/shadowarch

View File

@ -1,5 +1,5 @@
#
# /etc/bash.bashrc
# /etc/bashrc
#
# If not running interactively, don't do anything
@ -20,6 +20,8 @@ case ${TERM} in
;;
esac
# Considered untrusted.
# https://bugs.archlinux.org/task/55841
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
[ -f /etc/bash.motd ] && cat /etc/bash.motd
@ -43,13 +45,20 @@ for i in `ls -d ~/.irssi-* 2>/dev/null`; do
alias `echo $i | cut -f 2 -d '-' | tr '[:upper:]' '[:lower:]'`="irssi --home=$i";
done
# Set up screen/tmux safety nest by default.
if [ "$TERM" != "screen" ] && [ -z "$DESKTOP_SESSION" ]; then
# SSH
for i in `egrep '^Host' ~/.ssh/config | cut -f 2 -d ' '`; do
alias "$i"="ssh $i";
done
# Set up screen/tmux safety nest by default for remote sessions
if [ ! -z "$SSH_CLIENT" ]; then
if [ -x "$(which tmux 2>/dev/null)" ] && [ -z "$TMUX" ]; then
if [ `tmux list-sessions | grep created | wc -l` -eq 0 ]; then
exec tmux
elif [ `tmux list-sessions | grep created | wc -l` -eq 1 ] && [ `tmux list-sessions | grep attached | wc -l` -eq 0 ]; then
exec tmux a -d -t `tmux list-sessions | grep created | cut -f 1 -d ':'`
else
tmux list-sessions
fi
alias tat="exec tmux a -d -t"
elif [ -x "$(which screen 2>/dev/null)" ] && [ "$TERM" != "screen" ]; then
@ -57,10 +66,9 @@ if [ "$TERM" != "screen" ] && [ -z "$DESKTOP_SESSION" ]; then
exec screen -r
elif [ `screen -list | grep -c 'No Sockets found in '` -eq 1 ] && [ "$TERM" != "screen" ]; then
exec /usr/bin/screen /bin/bash
else
screen -list
fi
alias sdr="screen -d -r"
fi;
fi
# Autocompletions are having trouble lately and spawning irssi -- can't find where yet TODO
complete -r

View File

@ -19,8 +19,8 @@ if test -d /etc/profile.d/; then
fi
# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
. /etc/bash.bashrc
if test "$PS1" && test "$BASH" && test -r /etc/bashrc; then
. /etc/bashrc
fi
# Termcap is outdated, old, and crusty, kill it.