_script="$(realpath ${BASH_SOURCE[0]})" _scriptname="$(basename $_script)" _scriptdir="$(dirname $_script)" _modulename="$(basename $_scriptdir)" DOT_MODULE_NAME="ssh" function preinstall() { if ! [[ -x "$(command -v ssh)" ]]; then PACKAGES+=("openssh") fi if ! [[ -x "$(command -v git-crypt)" ]]; then PACKAGES+=("git-crypt") fi } function _install() { git-crypt unlock if [[ "$?" -ne "0" ]]; then log error "error decrypting ssh files, bailing before we break anthing" return fi # backup old file if it exists and we haven't backed it up before if [[ -d "$HOME/.ssh" ]] && ! [[ -d "$HOME/.ssh.bak" ]] && ! [[ -f "$_scriptdir/.firstrun" ]]; then log verbose "making backup" cp -r "$HOME/.ssh" "$HOME/.ssh.bak" touch "$_scriptdir/.firstrun" fi log info "linking ~/.ssh" rm -rf "$HOME/.ssh" ln -sf "$_scriptdir/ssh" "$HOME/.ssh" }