commit 76f96c53690c838785d1d6ddaf7eee14e8c5915f
parent 6ab70f680d9546e5ad128c4c372dcc20b0dd2bed
Author: Jake Bauer <jbauer@paritybit.ca>
Date: Sun, 27 Dec 2020 23:40:20 -0500
Switch to busybox ash shell
Diffstat:
A | .config/shrc | | | 52 | ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
M | .profile | | | 26 | +++++++++++++++++--------- |
2 files changed, 69 insertions(+), 9 deletions(-)
diff --git a/.config/shrc b/.config/shrc
@@ -0,0 +1,52 @@
+# shrc - .bashrc equivalent for dash/ash
+
+# If not running interactively, don't do anything
+case $- in
+ *i*) ;;
+ *) return;;
+esac
+
+# Set history length
+HISTSIZE=100000
+
+# Shell prompt
+PS1='[`date +%H:%M:%S`] `hostname` `pwd | sed "s,^$HOME,~,"` $ '
+
+# Enable color support of ls and also add handy aliases
+if [ -x /usr/bin/dircolors ]; then
+ test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+ alias ls='/bin/ls -vl --color=auto --group-directories-first'
+ alias grep='/bin/grep --color=auto'
+fi
+
+# Alias definitions:
+alias vi='nvim'
+alias rm='/bin/rm -Iv'
+alias mv='/bin/mv -iv'
+alias cp='/bin/cp -iv'
+alias tmux='tmux -f "$XDG_CONFIG_HOME"/tmux/tmux.conf'
+alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
+alias copy='xclip -sel c'
+alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
+alias lpr='lpr -o fit-to-page -o two-sided-long-edge'
+alias config='git --git-dir="$HOME"/docs/proj/dotfiles --work-tree="$HOME"'
+alias units='units --history "$XDG_CACHE_HOME"/units_history'
+alias poweroff='yay -Syu && doas poweroff'
+alias reboot='yay -Syu && doas reboot'
+alias spawn='st > /dev/null 2>&1 &'
+
+# Disable CTRL-S and CTRL-Q
+stty -ixon
+
+# Start tmux automatically (or attach to existing session) if:
+# 1. This is an interactive shell
+# 2. TERM variable does not indicate we are in a screen or tmux session already
+# 3. The environment variable TMUX is not set
+# 4. We are not on /dev/tty1 to allow X to start
+# if [ -n "$PS1" ] &&
+# [ ! "$TERM" = "screen" ] &&
+# [ ! "$TERM" = "tmux" ] &&
+# [ -z "$TMUX" ] &&
+# [ $(tty) != "/dev/tty1" ]; then
+# exec tmux
+# fi
diff --git a/.profile b/.profile
@@ -7,14 +7,6 @@
# The default umask is set in /etc/profile; for setting the umask
# For ssh logins, install and configure the libpam-umask package. Umask 022
-# If running bash
-if [ -n "$BASH_VERSION" ]; then
- # Include .bashrc if it exists
- if [ -f "$HOME/.bashrc" ]; then
- . "$HOME/.bashrc"
- fi
-fi
-
# Set PATH to include my local binaries/scripts
if [ -d "$HOME/.local/bin/" ]; then
PATH="$PATH:$HOME/.local/bin"
@@ -24,6 +16,9 @@ fi
PATH="$PATH:/usr/lib/go/bin/"
export GOPATH="$HOME/docs/proj/go"
+# Colored GCC warnings and errors
+export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
+
# For proper theming in qt5 applications
export QT_QPA_PLATFORMTHEME="gtk2"
@@ -52,6 +47,8 @@ export LYNX_LSS="$HOME/.config/lynx/lynx.lss"
export GNUPGHOME="/run/media/jbauer/keys/gpg"
# Removes ~/.inputrc
export INPUTRC="$XDG_CONFIG_HOME/inputrc"
+# Removes ~/.hledger.journal
+export LEDGER_FILE="$XDG_DATA_HOME"/hledger.journal
# Standard (?) environment variables
export EDITOR="nvim"
@@ -59,7 +56,6 @@ export VISUAL="$EDITOR"
export BROWSER="qutebrowser"
export READER="zathura"
export PAGER="less"
-export SHELL="bash"
# Colors in less/man
export LESS="--RAW-CONTROL-CHARS"
@@ -72,6 +68,18 @@ export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"; a="${a%_}"
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"; a="${a%_}"
export GROFF_NO_SGR=1
+# If running bash
+if [ -n "$BASH_VERSION" ]; then
+ if [ -f "$HOME/.bashrc" ]; then
+ . "$HOME/.bashrc"
+ fi
+# If running dash/ash
+else
+ if [ -f "$XDG_CONFIG_HOME/shrc" ]; then
+ export ENV="$XDG_CONFIG_HOME/shrc"
+ fi
+fi
+
#For starting X on first login of a shell
if [ ! $DISPLAY ] && [ $XDG_VTNR -eq 1 ]; then
exec startx