-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_once_dot_eget.toml.sh.tmpl
53 lines (42 loc) · 2.73 KB
/
run_once_dot_eget.toml.sh.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -uo pipefail
# We grab the SHA256 for the dependent source, see https://www.chezmoi.io/user-guide/use-scripts-to-perform-actions/#install-packages-with-scripts
# whenever dot_eget.toml.tmpl changes, it will provide a new SHA256 forcing this script to run
# dot_eget.toml.tmpl hash: {{ include "dot_eget.toml.tmpl" | sha256sum }}
# -------------------------------------------------------------------------------------------------
# ** ALL COMMANDS IN THIS SCRIPT MUST BE IDEMPOTENT **
# -------------------------------------------------------------------------------------------------
# This file will be executed after dot_eget.toml.tmpl is changed/updated.
# * Use relative paths to find binaries (e.g. ~/bin/xyz) and don't assume anything is in PATH
# * If you add/remove packages be sure to reflect it in `~/bin/nlh-doctor`.
# -------------------------------------------------------------------------------------------------
# If you want to force-run this script after you've updated configs:
# chezmoi state delete-bucket --bucket=scriptState
# chezmoi apply
# -------------------------------------------------------------------------------------------------
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
NLH_EGET_LOG=~/.nlh-intall-eget-packages.sh.log
touch $NLH_EGET_LOG
echo "--- `date` ---" >> $NLH_EGET_LOG
printf "Installing GitHub-fetchable packages (tail -f ~/.nlh-intall-eget-packages.sh.log)..."
# https://github.com/zyedidia/eget installs prebuilt binaries from GitHub
# - uses ~/.eget.toml configuration by default (use `chez edit .eget.toml`)
# - alias `github-fetch-rel` is defined in dot_config/fish/conf.d/netspective-labs-home.fish
curl -fsSL https://zyedidia.github.io/eget.sh | sh >> $NLH_EGET_LOG 2>&1
mv eget ~/bin
# download all packages defined in ~/.eget.toml
~/bin/eget --download-all --quiet >> $NLH_EGET_LOG 2>&1
# https://github.com/timbod7/adl (Algebraic Data Language) is framework for building cross language data models
# we do this outside of ~/.eget.toml because it has some special processing (we have to get binaries and libs and put them into separate locations)
~/bin/eget timbod7/adl >> $NLH_EGET_LOG 2>&1
~/bin/eget timbod7/adl --file "lib" --to=$HOME/.local/share/adl >> $NLH_EGET_LOG 2>&1
# git-query was installed by eget but we allow use through 'git query' instead of just 'gitql':
rm -f ~/bin/git-query
ln -s ~/bin/gitql ~/bin/git-query
# setup fish CLI command completions for `gopass`
~/bin/gopass completion fish > ~/.config/fish/completions/gopass.fish
echo "done."
# find "error" keyword in log file but filter out error.ts, ZodError.ts, etc.
printf "Inspect ${YELLOW}$NLH_EGET_LOG${NC}: ${RED}`grep -i error $NLH_EGET_LOG | grep -iv "error.*\\.ts" | wc -l`${NC} potential error messages\n"