Syncing up environment
This commit is contained in:
parent
70a7bdce73
commit
b568679df5
@ -7,17 +7,17 @@
|
|||||||
|
|
||||||
### Prompt ###
|
### Prompt ###
|
||||||
organization="$(hostname | rev | cut -f 2 -d '.' | rev)"
|
organization="$(hostname | rev | cut -f 2 -d '.' | rev)"
|
||||||
PS1='\[\033[00;31m\][ '"${organization^^}"'::\h/\[\033[01;32m\]\u \[\033[00;31m\]\\\\\\\\ ${SHELL} {\[\033[m\]$? \[\033[00;36m\]\D{%F-%R} \[\033[00;35m\]\w\[\033[00;31m\]\[\033[00;31m\]} ]\n|\[\033[m\]> '
|
PS1='\[\033[00;31m\][ '"${organization^^}"'::\h/\[\033[01;32m\]\u \[\033[00;31m\]\\\\\\\\ ${SHELL} {\[\033[m\]$? \[\033[00;36m\]\D{%F-%R} \[\033[00;35m\]\w\[\033[00;31m\]\[\033[00;31m\]\[\033[00;33m\]$(git_prompt_var)\[\033[00;31m\]} ]\n|\[\033[m\]> '
|
||||||
PS2='> '
|
PS2='> '
|
||||||
PS3='> '
|
PS3='> '
|
||||||
PS4='+ '
|
PS4='+ '
|
||||||
case ${TERM} in
|
case ${TERM} in
|
||||||
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
|
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
|
||||||
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;AniNIX::%s \134\134 %s in %s\007" "${HOSTNAME%%.*}" "${USER}" "${PWD/#$HOME/\~}"'
|
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;'${organization^^}'::%s \134\134 %s in %s\007" "${HOSTNAME%%.*}" "${USER}" "${PWD/#$HOME/\~}"'
|
||||||
|
|
||||||
;;
|
;;
|
||||||
screen)
|
screen)
|
||||||
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;AniNIX::%s \134\134 %s in %s\007" "${HOSTNAME%%.*}" "${USER}" "${PWD/#$HOME/\~}"'
|
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;'${organization^^}'::%s \134\134 %s in %s\007" "${HOSTNAME%%.*}" "${USER}" "${PWD/#$HOME/\~}"'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -27,7 +27,19 @@ esac
|
|||||||
### AniNIX Customizations ###
|
### AniNIX Customizations ###
|
||||||
alias get-commands='for i in $( echo $PATH | sed "s/:/\n/g"); do ls $i; done | sort | less'
|
alias get-commands='for i in $( echo $PATH | sed "s/:/\n/g"); do ls $i; done | sort | less'
|
||||||
alias whoison='who | grep -v tmux'
|
alias whoison='who | grep -v tmux'
|
||||||
alias startvnc="vncserver -xstartup startxfce4; echo Use \"ssh -L 5901:localhost:5901 $(whoami)@$(hostname)\" to tunnel connections."
|
function vncdesktop() {
|
||||||
|
set -x
|
||||||
|
if [ -z "$@" ]; then
|
||||||
|
vncserver :2 -rfbport 5901
|
||||||
|
else
|
||||||
|
vncserver $@
|
||||||
|
fi
|
||||||
|
export DISPLAY=`vncserver -list | tail -n 1 | awk '{print $1; }' `
|
||||||
|
sleep 3
|
||||||
|
xfce4-session
|
||||||
|
vncserver -kill "$DISPLAY"
|
||||||
|
set +x
|
||||||
|
}
|
||||||
alias vi=vim
|
alias vi=vim
|
||||||
alias view="vim -R"
|
alias view="vim -R"
|
||||||
alias top="top -o %CPU"
|
alias top="top -o %CPU"
|
||||||
@ -38,19 +50,43 @@ fi
|
|||||||
IFS="
|
IFS="
|
||||||
"
|
"
|
||||||
|
|
||||||
### SSH ###
|
### GIT ###
|
||||||
# Aliases for hosts
|
source /usr/share/git-core/contrib/completion/git-prompt.sh
|
||||||
if [ -f ~/.ssh/config ]; then
|
|
||||||
for i in `egrep '^Host' ~/.ssh/config | grep -v \* | cut -f 2 -d ' '`; do
|
function git_prompt_var() {
|
||||||
alias "$i"="ssh $i";
|
### If $PWD is a Git repo, add URL and branch to PS1
|
||||||
done
|
url=`git config remote.origin.url 2>/dev/null`
|
||||||
|
if [ -n "$url" ]; then
|
||||||
|
branch=`__git_ps1 '%s'`
|
||||||
|
url=`basename "$url"`
|
||||||
|
echo " $url($branch)"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
### SSH ###
|
||||||
# Tell shell about ssh-agent -- enable with 'systemctl enable ssh-agent@$USER.service'
|
# Tell shell about ssh-agent -- enable with 'systemctl enable ssh-agent@$USER.service'
|
||||||
export SSH_AGENT_PID="$(ps -fu "$USER" | grep -v grep | grep -m 1 ssh-agent | awk '{ print $2; }')"
|
export SSH_AGENT_PID="$(ps -fu "$USER" | grep -v grep | grep -m 1 ssh-agent | awk '{ print $2; }')"
|
||||||
if [ -n "$SSH_AGENT_PID" ]; then
|
if [ -n "$SSH_AGENT_PID" ]; then
|
||||||
export SSH_AUTH_SOCK="$(ls -ld /tmp/ssh-*/agent.* | grep -m 1 "$USER" | awk '{ print $9; }')"
|
export SSH_AUTH_SOCK="$(ls -ld /tmp/ssh-*/agent.* | grep -m 1 "$USER" | awk '{ print $9; }')"
|
||||||
echo ssh-agent PID is $SSH_AGENT_PID
|
echo ssh-agent PID is $SSH_AGENT_PID
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$SSH_AUTH_SOCK" ] && [ `ssh-add -L | grep -c no\ identities` -eq 1 ]; then
|
||||||
|
ssh-add
|
||||||
|
ssh-add -L
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ### User-directory .gitbare Support (Git) ###
|
||||||
|
# if [ -d ~/.git ]; then
|
||||||
|
# cd
|
||||||
|
# printf "~/.git: "
|
||||||
|
# if [ $SHLVL -eq 1 ] && [ -z "$TMUX" ]; then
|
||||||
|
# git pull
|
||||||
|
# else
|
||||||
|
# git rev-parse --short HEAD
|
||||||
|
# fi
|
||||||
|
# git status
|
||||||
|
# fi
|
||||||
|
#
|
||||||
# Set up screen/tmux safety nest by default for remote sessions
|
# Set up screen/tmux safety nest by default for remote sessions
|
||||||
if [ ! -z "$SSH_CLIENT" ]; then
|
if [ ! -z "$SSH_CLIENT" ]; then
|
||||||
# Prefer tmux
|
# Prefer tmux
|
||||||
|
@ -3,7 +3,7 @@ Description=SSH-Agent for User %I
|
|||||||
After=network.target shadow.service
|
After=network.target shadow.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=ssh-agent -s
|
ExecStart=/usr/bin/ssh-agent -s
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
@ -3,10 +3,12 @@ Description=TMUX/Weechat Session for User %I
|
|||||||
After=network.target shadow.service
|
After=network.target shadow.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/sbin/tmux new-session -d -c IRC weechat
|
Environment=HOME=/home/$I
|
||||||
|
WorkingDirectory=/home/$I
|
||||||
|
ExecStart=/usr/bin/tmux new-session -d -s IRC "weechat"
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
KillMode=process
|
KillMode=process
|
||||||
Restart=on-failed
|
Restart=no
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
User=%I
|
User=%I
|
||||||
Group=%I
|
Group=%I
|
||||||
|
Loading…
Reference in New Issue
Block a user