From 6404ce4bb8f9a2bd38f63f3db4f9c3cb1fbcc672 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Thu, 30 Dec 2021 10:40:47 -0500 Subject: [PATCH] Added more environment variables and dmg script --- .gitignore | 1 + scripts/.local/scripts/dmg | 15 +++++++++++++++ zsh/.config/zsh/.zshrc | 21 ++++++++++++++++----- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100755 scripts/.local/scripts/dmg diff --git a/.gitignore b/.gitignore index 15d9124..5d57c87 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ zsh/.config/zsh/history **/.zsh_sessions **/completions/* **/.netrwhist +**/.zshrc-local diff --git a/scripts/.local/scripts/dmg b/scripts/.local/scripts/dmg new file mode 100755 index 0000000..de62ea9 --- /dev/null +++ b/scripts/.local/scripts/dmg @@ -0,0 +1,15 @@ +#!/bin/sh + +# Creates an encrypted disk image from a folder + +from="$1" +to="$2" + +if [ -z "$1" ] || [ -z "$2" ]; then + echo "Usage: dmg " + echo "" + exit 1 +fi + +name="$(isosec).dmg" +hdiutil create -encryption AES-256 -srcfolder "$from" "$to/$name" diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index e7ed3f3..65fff86 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -1,10 +1,20 @@ #!/usr/bin/env zsh +#------------------------------ utilites ------------------------------ +_source_if() { [[ -r "$1" ]] && source "$1" } + #------------------------------ exports ------------------------------ export ZDOTDIR="$HOME/.config/zsh" export SHELL="$(which zsh)" +export GITUSER="m-housh" +export BUCKET="/Volumes/Bucket" +export ARCHIVE="/Volumes/Archive" +export REPOS="$BUCKET/Repos" +export GHREPOS="$REPOS/github.com/$GITUSER" +export LOCAL_REPOS="$$REPOS/local" export DOCUMENTS="$HOME/Documents" export DOWNLOADS="$HOME/Downloads" +export PDFS="$HOME/Library/Mobile Documents/com~apple~Preview/Documents" export DOTFILES="$HOME/.dotfiles" export DESKTOP="$HOME/Desktop" export SCRIPTS="$HOME/.local/scripts" @@ -12,7 +22,6 @@ export TERM=xterm-256color export EDITOR=vi export VISUAL=vi export EDITOR_PREFIX=vi -export GITUSER="m-housh" export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 autoload -U up-line-or-beginning-search @@ -24,7 +33,7 @@ zle -N down-line-or-beginning-search autoload -Uz colors && colors # Load Useful Functions -source "$ZDOTDIR/zsh-functions" +_source_if "$ZDOTDIR/zsh-functions" #------------------------------ path ------------------------------ @@ -65,7 +74,7 @@ fpath_prepend() { # last arg will be first in path path_prepend \ "/usr/local/sbin" \ - "usr/local/bin" \ + "/usr/local/bin" \ "/opt/homebrew/bin" \ "/opt/homebrew/sbin" \ "$HOME/.local/bin" \ @@ -76,7 +85,6 @@ fpath_prepend \ "$(brew --prefix)/share/zsh-completions" \ "$ZDOTDIR/completions" - #------------------------------ history ------------------------------ setopt appendhistory # append to history setopt sharehistory # share history across multiple sessions @@ -94,7 +102,7 @@ export HISTFILE=$ZDOTDIR/history #------------------------------ cdpath ------------------------------ setopt autocd -export CDPATH=".:$DOTFILES:$HOME" +export CDPATH=".:$GHREPOS:$DOTFILES:$LOCAL_REPOS:$HOME" #------------------------------ options ------------------------------ # (see `man zshoptions`) @@ -134,4 +142,7 @@ autoload -Uz promptinit; promptinit prompt pure +#------------------------------ local configs ------------------------------ +_source_if "$ZDOTDIR/.zshrc-local" + cat < "$ZDOTDIR/banner"