feat: git & gpg setup (#1)
This commit is contained in:
parent
ba571b66db
commit
d7e1d18b37
3 changed files with 24 additions and 1 deletions
3
git_config
Normal file
3
git_config
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
git config --global commit.gpgsign true
|
17
setup
17
setup
|
@ -1,12 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
#
|
#
|
||||||
# Detects the current shell (bash, zsh, ...) and adds, if necessary, a managed
|
# Detects the current shell (bash, zsh, ...) and adds, if necessary, a managed
|
||||||
# block to its configuration to source extra files on shell-start.
|
# block to its configuration to source extra files on shell-start.
|
||||||
#
|
#
|
||||||
|
|
||||||
BLOCK_DELIMITER_PATTERN="mcataford/env-managed-block"
|
BLOCK_DELIMITER_PATTERN="mcataford/env-managed-block"
|
||||||
|
WORKING_PATH=$(realpath $(dirname $0))
|
||||||
SHELL_CONFIG_PATH=""
|
SHELL_CONFIG_PATH=""
|
||||||
|
|
||||||
if [[ -n $(echo $SHELL | grep zsh) ]]; then
|
if [[ -n $(echo $SHELL | grep zsh) ]]; then
|
||||||
|
@ -15,16 +17,21 @@ else
|
||||||
SHELL_CONFIG_PATH="$HOME/.bashrc"
|
SHELL_CONFIG_PATH="$HOME/.bashrc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Setting up shell configuration extras..."
|
||||||
if [[ -z $(cat $SHELL_CONFIG_PATH | grep $BLOCK_DELIMITER_PATTERN) ]]; then
|
if [[ -z $(cat $SHELL_CONFIG_PATH | grep $BLOCK_DELIMITER_PATTERN) ]]; then
|
||||||
echo "# $BLOCK_DELIMITER_PATTERN:start
|
echo "# $BLOCK_DELIMITER_PATTERN:start
|
||||||
for f in ~/.env_goodies/source/*; do source $f; done
|
for f in ~/.env_goodies/source/*; do source $f; done
|
||||||
# $BLOCK_DELIMITER_PATTERN:end" >> $SHELL_CONFIG_PATH
|
# $BLOCK_DELIMITER_PATTERN:end" >> $SHELL_CONFIG_PATH
|
||||||
|
echo "✅ Added managed block to $SHELL_CONFIG_PATH"
|
||||||
|
else
|
||||||
|
echo "No changes to apply!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EDITOR_CONFIG=$HOME/.config/nvim
|
EDITOR_CONFIG=$HOME/.config/nvim
|
||||||
EDITOR_CONFIG_FILE=$EDITOR_CONFIG/init.vim
|
EDITOR_CONFIG_FILE=$EDITOR_CONFIG/init.vim
|
||||||
|
|
||||||
if [[ -f $EDITOR_CONFIG_FILE ]]; then
|
if [[ -f $EDITOR_CONFIG_FILE ]]; then
|
||||||
|
echo "Setting up NVIM configuration extras..."
|
||||||
if [[ -z $(cat $EDITOR_CONFIG_FILE | grep $BLOCK_DELIMITER_PATTERN) ]]; then
|
if [[ -z $(cat $EDITOR_CONFIG_FILE | grep $BLOCK_DELIMITER_PATTERN) ]]; then
|
||||||
echo "\" $BLOCK_DELIMITER_PATTERN:start
|
echo "\" $BLOCK_DELIMITER_PATTERN:start
|
||||||
source $HOME/.env_goodies/extras.vim
|
source $HOME/.env_goodies/extras.vim
|
||||||
|
@ -33,5 +40,13 @@ source $HOME/.env_goodies/extras.vim
|
||||||
|
|
||||||
mv $EDITOR_CONFIG_FILE $EDITOR_CONFIG_FILE.old
|
mv $EDITOR_CONFIG_FILE $EDITOR_CONFIG_FILE.old
|
||||||
mv $EDITOR_CONFIG_FILE.new $EDITOR_CONFIG_FILE
|
mv $EDITOR_CONFIG_FILE.new $EDITOR_CONFIG_FILE
|
||||||
|
echo "✅ Added managed block to $EDITOR_CONFIG_FILE"
|
||||||
|
else
|
||||||
|
echo "No changes to apply!"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Setting up git configuration..."
|
||||||
|
source $WORKING_PATH/git_config
|
||||||
|
echo "✅ Set up git configuration, see $WORKING_PATH/git_config for details!"
|
||||||
|
|
||||||
|
|
5
source/exports
Normal file
5
source/exports
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ensures that passphrases can be entered when signing
|
||||||
|
# git commits.
|
||||||
|
export GPG_TTY=$(tty)
|
Loading…
Reference in a new issue