env-setup - bash implementation

This commit is contained in:
Nick Stokoe
2020-11-29 12:52:14 +00:00
parent 56fa50ec69
commit 154a71d54d
2 changed files with 42 additions and 1 deletions

6
.gitignore vendored
View File

@@ -3,4 +3,8 @@ vault-password
# emacs temp/backup files # emacs temp/backup files
*~ *~
*# *#
# External resources
/.ansible-src
/.password-store

37
env-setup Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
# This sets up the environment to use a local Ansible source checkout,
# allowing a specific version to be used, or even a customised version.
#
# This is assumed to be symlinked from `.ansible-src/` to the
# directory to the one containing this repository. Check it out like
# this at a location of your choice:
#
# cd $WHEREVER
# git clone $ANSIBLE_GIT_REPO ansible-src
#
# Then symlink it into this directory:
#
# cd $HERE
# ln -sfnr $WHEREVER $HERE/.ansible-src
#
# It also sets the environment so that the untility `pass` will use a
# local password-store directory, not ~/.password-store. Likewise,
# this is assumed to be in a symlinked directory called
# `.password-store/`. Ansible has support for `pass` and can use it to
# retrieve sensitive information which needs to be committed to an
# encrypted password store.
#
# See https://www.passwordstore.org/
#
# To use the environment, run this script, which will spawn a subshell
# with the correct environment:
#
SCRIPT_DIR="${BASH_SOURCE[0]%/*}"
ANSIBLE_SRC=$(readlink -f "$SCRIPT_DIR/.ansible-src")
export PATH="$ANSIBLE_SRC/bin:$PATH"
export PASSWORD_STORE_DIR=$(readlink -f "$SCRIPT_DIR/.password-store")
exec '/bin/bash' '--rcfile' "$ANSIBLE_SRC/hacking/env-setup"