29 lines
802 B
Bash
Executable File
29 lines
802 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# https://github.com/scarpent/ledgerbil
|
|
|
|
|
|
# NOTE: It does not seem that aliases are properly expanded when using
|
|
# ledgerbil. You'll need to use the value actually used for the accounts in the
|
|
# transaction.
|
|
|
|
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
REPOPATH="$(dirname ${SCRIPTPATH})"
|
|
|
|
source ${REPOPATH}/.env
|
|
|
|
if ! docker image inspect "ledgerbil:latest" >/dev/null 2>&1; then
|
|
echo "Ledgerbil image not found. Building..."
|
|
git submodule update --init
|
|
pushd ledgerbil
|
|
docker build -t ledgerbil:latest .
|
|
popd
|
|
fi
|
|
|
|
docker run --rm -it \
|
|
-v "${LEDGER_DIR}:/data" \
|
|
-v "${REPOPATH}/ledgerbil-settings.py:/code/ledgerbil/settings.py" \
|
|
--entrypoint python \
|
|
ledgerbil:latest \
|
|
/code/main.py -f /data/${PRIMARY_LEDGER_FILE} ${@}
|