aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkshrc9
-rw-r--r--readme.md90
-rw-r--r--shell/aliases3
-rw-r--r--shell/conf1
-rw-r--r--shell/utils5
5 files changed, 104 insertions, 4 deletions
diff --git a/mkshrc b/mkshrc
index da1f2be..2d2048c 100644
--- a/mkshrc
+++ b/mkshrc
@@ -89,9 +89,15 @@ setsudoaliases() {
alias mount="$_sudo mount"
alias umount="$_sudo umount"
fi
+ case $_sudo in
+ *doas*) alias sudo='doas'; ;;
+ esac
}
-
+# E.g. after `.mkshrc` is called, perhaps in `~/.mkshrc.local`
+# export GOPATH=$HOME/code/gopath
+# export GOROOT=$HOME/go/1.13.5
+# set_go
set_go() {
export GOPATH="${GOPATH:-$HOME/go}"
export PATH="$GOPATH/bin:$PATH"
@@ -504,7 +510,6 @@ fi
set_pager
set_editor
-# requires misc
# set_go
setaliases
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..6945d7d
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,90 @@
+# Mitch's scripts, utilities, and configuration
+
+I copy this down to my personal machines.
+
+Things of interest:
+
+ * shell configuration ( See more information below )
+ * tmux configuration ( see more info below )
+ * tmux helper script ( For load average, uptime and memory in the status bar )
+ * basic configuration ( For if you don't want the custom status bar )
+ * [`keyCheck.sh`](keyCheck.sh) Automatically generate a 4096bit RSA SSH key or display the one you have
+ * Snapshot scripts. Snapshots your entire OS see below for more details.
+ * A basic vim configuration ( also see [`vim-cfg.git`](https://git.riedstra.us/mitch/vim-cfg.git/about) )
+ * A handful of build scripts with my options for some open source projects such as Vim
+
+## Snapshot Scripts
+
+These alter the fstab in the snapshot so you can boot to it just by changing kernel boot parameters
+
+### [`snap/btrfs.sh`](`snap/btrfs.sh`)
+Automatically snapshot a btrfs root filesystem assuming you're using a
+subvolume and the base FS is mounted in `/ROOT`
+
+[`snap/lvm.sh`](`snap/lvm.sh`)
+
+Same as above, except it doesn't keep RO snapshots around, and doesn't remove
+old ones. Requires LVM but the underlying FS doesn't matter ( `ext4`, `xfs`,
+etc )
+
+## Shell Configuration
+
+`mkshrc`, generated using `build.sh` inside of the `shell/` directory.
+
+Specifically targets mksh which has been my default shell for quite a long time
+now. Though I do test it against `bash` and `ash` as well.
+
+Some useful features are:
+
+ * Aliases
+ * `ll`, `lt`, `g` for `grep`, `j` for `jobs`, `p` for `pwd`, etc.
+ * [Full list here](https://git.riedstra.us/mitch/dotfiles.git/tree/shell/aliases#n1)
+ * `ls -F` by default
+ * Aliases for `apt`, `yum`, `pacman`, etc to use `sudo` by default.
+ * Utilize `doas` as `sudo` if installed, for instance on OpenBSD.
+ * Utils
+ * `set_go` can be called in `~/.mkshrc.local` or similar to add the
+ `GOROOT` and `GOPATH` `bin`'s to your `PATH`. [Example and
+ code.](https://git.riedstra.us/mitch/dotfiles.git/tree/shell/utils#n1)
+ * Aggressively set the editor based off of a list in order of ascending preference. ( `set_editor` )
+ * `set_pager` same thing, except for your pager.
+ * `debugstarttls` Useful to debug starttls.
+ * `randmacgen` generate a random mac address.
+ * `ipv6_local_hosts <interface>` Returns the IPs of local nodes by using the IPv6 all nodes multicast ping.
+ * `set_nocaps` Eliminates capslock, makes it another control key. Makes the
+ numberpad act like it does on Windows. `alt+space` switches between US
+ and DE layouts.
+ * `setperms <directory_octal>:<file_octal> <paths>...` Sets file and
+ directory modes separately and recursively across the paths
+ * `set_title <title>` Sets the title of the terminal to the first argument
+ * `timestamp`: `date +%m.%d.%y_%H.%M.%S`
+ * `checkSSHAgent` Checks to see if there's a running SSH agent, if not it
+ starts one and writes a configuration file.
+ * `passenv` runs `pass` and sources the output into the shell
+ * `_tmux_servers`, `_tmux_servers_split_commands`, `_tmux_dev`,
+ `_tmux_session` Utilities for building tmux development environments.
+ * Colors
+ * Automatically assume that anything `xterm*` or `screen*` is a 256 color terminal
+ * Colored `ls` by default.
+ * Colored man pages
+ * Update<br />
+ This provides utilities that allow for easy updating of configuration files.
+ The most useful ones are as follows
+ * `updatevimrc` Installs [my full vim configuration](https://git.riedstra.us/mitch/vim-cfg.git/about)
+ * `updatevimrc_basic` Installs the `.vimrc` file which is a basic but useful vim configuration.
+ * `updatetmuxconf` Pulls in the tmux configuration from this repository.
+ * `updateshell` Pulls the latest version of `mkshrc` from this repository.
+ * `pullkeys_github <github_username>` Creates the `~/.ssh/authorized_keys` file with the SSH keys for a given github username
+ * Conf<br /><br />
+ All of the pieces above don't actually do anything automatically, they just
+ add shell functions that can be called. This file ties it all together.
+ <br />
+ It:
+ * sets the URLs for the update functions,
+ * the configuration file location
+ * sources the pre and post configuration files
+ * sets the color aliases and environment variables if necessary
+ * adjusts PATH to include `~/bin`
+ * It also handles the different supported shells, history, etc
+ * Sets up a basic PS1 for most shells
+
diff --git a/shell/aliases b/shell/aliases
index 1ec900b..f5aa9e0 100644
--- a/shell/aliases
+++ b/shell/aliases
@@ -76,5 +76,8 @@ setsudoaliases() {
alias mount="$_sudo mount"
alias umount="$_sudo umount"
fi
+ case $_sudo in
+ *doas*) alias sudo='doas'; ;;
+ esac
}
diff --git a/shell/conf b/shell/conf
index c4e288d..7369c0c 100644
--- a/shell/conf
+++ b/shell/conf
@@ -26,7 +26,6 @@ fi
set_pager
set_editor
-# requires misc
# set_go
setaliases
diff --git a/shell/utils b/shell/utils
index b84bb48..6c3e85e 100644
--- a/shell/utils
+++ b/shell/utils
@@ -1,4 +1,7 @@
-
+# E.g. after `.mkshrc` is called, perhaps in `~/.mkshrc.local`
+# export GOPATH=$HOME/code/gopath
+# export GOROOT=$HOME/go/1.13.5
+# set_go
set_go() {
export GOPATH="${GOPATH:-$HOME/go}"
export PATH="$GOPATH/bin:$PATH"