forked from EvergreenCrypto/docker-finance
repo/client: move shell env prep to install.bash
This commit is contained in:
108
README.md
108
README.md
@@ -243,94 +243,57 @@ Supported blockchains (independent of wallet type):
|
||||
|
||||
### Installation
|
||||
|
||||
[//]: # (TODO: move step 3 to installation script, add `dfi` aliases, update README)
|
||||
[//]: # (TODO: add `dfi` aliases, update README)
|
||||
|
||||
`docker-finance` is not your typical Docker image in which you simply pull and containerize, but rather it's an *image-based* accounting system that operates transparently between your client (host) and container; keeping your finances containerized, with all the benefits of containerization.
|
||||
|
||||
`docker-finance` *should* work out-of-the-box on any modern Linux system. For example, if your client (host) is Ubuntu, the default installation of `coreutils`, `shells` and `utils` that came with your system will satisfy requirements. However, you'll still need to manually install Docker (see below).
|
||||
|
||||
1. **Install dependencies**:
|
||||
|
||||
1. [Docker Engine](https://docs.docker.com/engine/install/#supported-platforms) with [post-install configuration](https://docs.docker.com/engine/install/linux-postinstall/)
|
||||
- Latest version (or at least `27.1.1`)
|
||||
2. [GNU Bash](https://www.gnu.org/software/bash/)
|
||||
- Latest version (or at least `5.0.17`)
|
||||
- Installed by *default* on most Linux distributions
|
||||
|
||||
2. **Install recommended**:
|
||||
1. [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git/)
|
||||
3. [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git/)
|
||||
- Latest version (or at least `2.25.1`)
|
||||
- Only needed for step 3 but should be kept in order to:
|
||||
- Remain up-to-date with future `docker-finance` versions
|
||||
- Safely track your workflow related data (journals, metadata, etc.)
|
||||
2. Consider using a terminal multiplexer like [tmux](https://github.com/tmux/tmux/wiki) or [screen](https://www.gnu.org/software/screen/) for optimal workflow efficiency
|
||||
|
||||
3. **Copy/paste the following into your `bash` shell** (client preparation):
|
||||
2. **Install recommended** (optional):
|
||||
|
||||
Although *not* required, consider the following for workflow efficiency:
|
||||
|
||||
- A terminal multiplexer like [tmux](https://github.com/tmux/tmux/wiki) or [screen](https://www.gnu.org/software/screen/)
|
||||
|
||||
3. **Prepare your repository**:
|
||||
|
||||
Pick a *persistent* path that you're likely to keep; your environment will be aliased/sourced to the path you choose.
|
||||
|
||||
```bash
|
||||
bashrc=~/.bashrc
|
||||
aliases=~/.bash_aliases
|
||||
function docker-finance::install()
|
||||
{
|
||||
# Environment expectations
|
||||
_alias="alias docker-finance="
|
||||
_client="$(pwd)/docker-finance/client"
|
||||
# Remove previous alias
|
||||
if grep "^${_alias}" "$aliases" &>/dev/null; then
|
||||
sed -i "/^${_alias}/d" "$aliases"
|
||||
unalias docker-finance
|
||||
fi
|
||||
# Set new alias
|
||||
echo "${_alias}'${_client}/docker.bash'" >>"$aliases"
|
||||
# Set bash completion
|
||||
_completion="${_client}/src/docker/completion.bash"
|
||||
if [ ! -f "$_completion" ]; then
|
||||
echo "WARNING: bash completion not found" >&2
|
||||
else
|
||||
if ! grep "^source '${_completion}'" "$aliases" &>/dev/null; then
|
||||
echo "source '${_completion}'" >>"$aliases"
|
||||
fi
|
||||
fi
|
||||
# Make it so
|
||||
source "$aliases" && echo "SUCCESS: installation complete"
|
||||
}
|
||||
if ! test -f "$bashrc" || ! hash bash &>/dev/null; then
|
||||
echo "FATAL: unsupported bash installation" >&2
|
||||
else
|
||||
if [[ ! -z "$SHELL" && "$SHELL" =~ bash ]]; then
|
||||
if [ ! -f "$aliases" ]; then
|
||||
if ! grep -E "(\. ~/.bash_aliases|^source ~/.bash_aliases|^source ${aliases})" "$bashrc" &>/dev/null; then
|
||||
aliases="$bashrc"
|
||||
fi
|
||||
fi
|
||||
if hash git &>/dev/null; then
|
||||
if [ -d docker-finance ]; then
|
||||
if pushd docker-finance &>/dev/null; then
|
||||
if ! git pull --tags; then
|
||||
echo "FATAL: docker-finance repo not pulled" >&2
|
||||
else
|
||||
popd &>/dev/null
|
||||
docker-finance::install
|
||||
fi
|
||||
popd &>/dev/null
|
||||
else
|
||||
echo "FATAL: docker-finance repo not found" >&2
|
||||
fi
|
||||
else
|
||||
if ! git clone https://gitea.com/EvergreenCrypto/docker-finance; then
|
||||
echo "FATAL: docker-finance repo not cloned" >&2
|
||||
else
|
||||
docker-finance::install
|
||||
fi
|
||||
if hash git &>/dev/null; then
|
||||
if [ -d docker-finance ]; then
|
||||
if pushd docker-finance &>/dev/null; then
|
||||
if ! git pull --tags; then
|
||||
echo "FATAL: docker-finance repo not pulled" >&2
|
||||
fi
|
||||
popd 1>/dev/null
|
||||
else
|
||||
echo "FATAL: git not found" >&2
|
||||
echo "FATAL: docker-finance repo not found" >&2
|
||||
fi
|
||||
else
|
||||
echo "FATAL: unsupported bash environment" >&2
|
||||
if ! git clone https://gitea.com/EvergreenCrypto/docker-finance; then
|
||||
echo "FATAL: docker-finance repo not cloned" >&2
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "FATAL: git not found" >&2
|
||||
fi
|
||||
```
|
||||
|
||||
4. **Verify your repository** (recommended):
|
||||
4. **Verify your repository** (optional):
|
||||
```bash
|
||||
if pushd docker-finance/ 1>/dev/null; then
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com --recv-key 518A22F85BEFD32BCC99C48603F90C4F35E0213E \
|
||||
@@ -341,24 +304,35 @@ Supported blockchains (independent of wallet type):
|
||||
fi
|
||||
```
|
||||
|
||||
5. **Generate client/container environment** (see [Environment Generation](#environment-generation) for details):
|
||||
5. **Prepare your shell environment**:
|
||||
|
||||
This will install convenience aliases and command completion to your shell environment (see [install.bash](client/install.bash) for details).
|
||||
|
||||
```bash
|
||||
./docker-finance/client/install.bash && source ~/.bashrc
|
||||
```
|
||||
|
||||
6. **Generate client/container environment**:
|
||||
|
||||
This will generate your Docker-related client/container environment (see [Environment Generation](#environment-generation) for details).
|
||||
|
||||
```bash
|
||||
docker-finance archlinux/${USER}:default gen
|
||||
```
|
||||
|
||||
6. **Build the image**:
|
||||
7. **Build default `docker-finance` image**:
|
||||
```bash
|
||||
docker-finance archlinux/${USER}:default build type=default
|
||||
```
|
||||
> See `docker-finance archlinux/${USER}:default build help` for build options (such as smaller, faster builds)
|
||||
|
||||
7. **Bring up the container**:
|
||||
8. **Bring up container of default `docker-finance` image**:
|
||||
```bash
|
||||
docker-finance archlinux/${USER}:default up
|
||||
```
|
||||
> You can use tab completion for all commands available to this built image
|
||||
|
||||
8. **You're inside!** See [How do I use it?](#how-do-i-use-it) for next steps.
|
||||
9. **You're inside!** See [How do I use it?](#how-do-i-use-it) for next steps.
|
||||
|
||||
### Environment Generation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user