|
1 | 1 | THIS_FILE="${BASH_SOURCE[0]}"
|
2 | 2 | THIS_DIR=`dirname "$THIS_FILE"`
|
3 |
| -# If not running interactively, don't do anything |
4 |
| -case $- in |
5 |
| - *i*) ;; |
6 |
| - *) return;; |
7 |
| -esac |
8 |
| - |
9 |
| -# Don't check mail when opening terminal. |
10 |
| -unset MAILCHECK |
11 |
| - |
12 |
| -# don't put duplicate lines or lines starting with space in the history. |
13 |
| -# See bash(1) for more options |
14 |
| -HISTCONTROL=ignoreboth |
15 |
| - |
16 |
| -# append to the history file, don't overwrite it |
17 |
| -shopt -s histappend |
18 |
| - |
19 |
| -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) |
20 |
| -HISTSIZE=-1 |
21 |
| -HISTFILESIZE=-1 |
22 |
| -# see https://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login |
23 |
| -HISTFILE=~/.bash_history2 |
24 |
| - |
25 |
| -# check the window size after each command and, if necessary, |
26 |
| -# update the values of LINES and COLUMNS. |
27 |
| -shopt -s checkwinsize |
28 |
| - |
29 |
| -# If set, the pattern "**" used in a pathname expansion context will |
30 |
| -# match all files and zero or more directories and subdirectories. |
31 |
| -#shopt -s globstar |
32 |
| - |
33 |
| -# make less more friendly for non-text input files, see lesspipe(1) |
34 |
| -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" |
35 |
| - |
36 |
| -# If this is an xterm set the title to user@host:dir |
37 |
| -case "$TERM" in |
38 |
| -xterm*|rxvt*) |
39 |
| - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" |
40 |
| - ;; |
41 |
| -*) |
42 |
| - ;; |
43 |
| -esac |
44 |
| - |
45 |
| -# colored GCC warnings and errors |
46 |
| -#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' |
47 |
| - |
48 |
| -# if hash nix-env 2>/dev/null; then |
49 |
| -# LOCALE_ARCHIVE="$(nix-env --installed --no-name --out-path --query glibc-locales)/lib/locale/locale-archive" |
50 |
| -# export LOCALE_ARCHIVE |
51 |
| -# fi |
52 |
| -if [ -f "$HOME"/.nix-profile/etc/profile.d/hm-session-vars.sh ]; then |
53 |
| - # shellcheck source=/dev/null |
54 |
| - source "$HOME"/.nix-profile/etc/profile.d/hm-session-vars.sh |
55 |
| -fi |
56 |
| -if hash vim 2>/dev/null; then |
57 |
| - export EDITOR=vim |
58 |
| -fi |
59 |
| -export PATH=$THIS_DIR/bin:$PATH |
60 |
| -export TMP=/tmp |
61 |
| -export TEMP=/tmp |
62 |
| -if [ -d "$HOME"/.dotnet/tools ] && ! [[ $PATH =~ "$HOME"/.dotnet/tools ]]; then |
63 |
| - export PATH=$PATH:$HOME/.dotnet/tools |
64 |
| -fi |
65 |
| -if [ -f "$HOME"/.cargo/env ]; then |
66 |
| - # shellcheck source=/dev/null |
67 |
| - source "$HOME/.cargo/env" |
68 |
| -fi |
69 |
| -if hash sccache 2>/dev/null; then |
70 |
| - RUSTC_WRAPPER=`which sccache` |
71 |
| - export RUSTC_WRAPPER |
72 |
| -fi |
73 |
| -if [ -d "$HOME"/.krew/bin ]; then |
74 |
| - export PATH=$PATH:$HOME/.krew/bin |
75 |
| -fi |
76 |
| -export PROMPT_COMMAND="history -a; $PROMPT_COMMAND" |
77 |
| -export LC_ALL=en_US.UTF-8 |
78 |
| -set -o vi |
79 |
| -bind '"jj":"\e"' |
80 |
| -tabs -4 |
81 |
| -export DOCKER_BUILDKIT=1 |
82 |
| -export INPUTRC=$THIS_DIR/.inputrc |
83 |
| - |
84 |
| -bind 'set completion-ignore-case on' |
85 |
| - |
86 |
| -# if hash starship 2>/dev/null; then |
87 |
| -# eval "$(starship init bash)" |
88 |
| -# else |
89 |
| -# echo "Install Starship to get a nice theme. Go to: https://starship.rs/" |
90 |
| -# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] ' |
91 |
| -# fi |
92 | 3 |
|
93 | 4 | SCRIPTS=`find "$THIS_DIR" -name '*.bash' -type f -printf '%h\0%d\0%p\n' | sort -t '\0' -n | awk -F'\0' '{print $3}'`
|
94 | 5 | for SCRIPT in $SCRIPTS; do
|
95 | 6 | # shellcheck source=/dev/null
|
96 | 7 | source "$SCRIPT"
|
97 | 8 | done
|
98 |
| - |
99 |
| -if ! $WSL; then |
100 |
| - GPG_TTY=$(tty) |
101 |
| - export GPG_TTY |
102 |
| -fi |
103 |
| - |
104 |
| -if ! [ -v XDG_RUNTIME_DIR ]; then |
105 |
| - XDG_RUNTIME_DIR=/run/user/`id -u`/ |
106 |
| - export XDG_RUNTIME_DIR |
107 |
| - if ! [ -d "$XDG_RUNTIME_DIR" ]; then |
108 |
| - mkdir -p "$XDG_RUNTIME_DIR" |
109 |
| - chmod 755 "$XDG_RUNTIME_DIR" |
110 |
| - fi |
111 |
| -fi |
112 |
| - |
113 |
| -# setup ssh socket |
114 |
| -if $WSL; then |
115 |
| - # forward ssh socket to Windows |
116 |
| - export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gnupg/ssh.sock" |
117 |
| -else |
118 |
| - if [ -S "$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh" ] || systemctl --user is-enabled gpg-agent-ssh.socket -q &> /dev/null; then |
119 |
| - # forward ssh socket to gpg |
120 |
| - export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh" |
121 |
| - elif ! [ -v SSH_AUTH_SOCK ]; then |
122 |
| - PID_FILE="$HOME/.ssh/ssh_pid" |
123 |
| - SSH_AUTH_SOCK="$HOME/.ssh/ssh.sock" |
124 |
| - if [ -S "$SSH_AUTH_SOCK" ]; then |
125 |
| - # use existing ssh-agent |
126 |
| - export SSH_AUTH_SOCK |
127 |
| - if [ -f "$PID_FILE" ]; then |
128 |
| - SSH_AGENT_PID="`cat "$PID_FILE"`" |
129 |
| - export SSH_AGENT_PID |
130 |
| - fi |
131 |
| - else |
132 |
| - # start a new ssh-agent |
133 |
| - if ! [ -d "$HOME"/.ssh ]; then |
134 |
| - mkdir -p "$HOME/.ssh" |
135 |
| - chmod 700 "$HOME/.ssh" |
136 |
| - fi |
137 |
| - eval "`ssh-agent -s -a "$SSH_AUTH_SOCK"`" > /dev/null |
138 |
| - echo "$SSH_AGENT_PID" > "$PID_FILE" |
139 |
| - fi |
140 |
| - fi |
141 |
| -fi |
0 commit comments