change binary install to yq-powered yaml config

This commit is contained in:
Daylin Morgan 2021-12-09 15:16:54 -06:00
parent cae0ccbf0a
commit 5f112226c3
2 changed files with 81 additions and 22 deletions

43
info/tools.yml Normal file
View file

@ -0,0 +1,43 @@
tool: &default
asset: x86_64-unknown-linux-gnu
# environment
sheldon:
user: rossmacarthur
starship:
user: starship
asset: starship-x86_64-unknown-linux-gnu.tar.gz
# general
lsd:
<<: *default
user: Peltoche
ripgrep:
user: BurntSushi
fd:
<<: *default
user: sharkdp
# system monitoring
bottom:
asset: x86_64-unknown-linux-gnu.tar.gz
user: ClementTsang
file: btm
# git
lazygit:
user: jesseduffield
# editing
neovim:
user: neovim
gdu:
user: dundee
download-only: true
post-download: |
tar -xzf gdu_linux_amd64.tgz
mv gdu_linux_amd64 $EGET_BIN/gdu
rm gdu_linux_amd64.tgz

View file

@ -2,6 +2,17 @@
BIN_DIR=$HOME/bin BIN_DIR=$HOME/bin
mkdir -p $BIN_DIR mkdir -p $BIN_DIR
EGET_BIN=$BIN_DIR
post_download_install() {
tool=$1
temp_file=$(mktemp -p . ${tool}.XXX.sh)
key=$tool yq e 'explode(.) | .[env(key)].post-download' $YAMLDOC > $temp_file
. $temp_file
rm $temp_file
}
if ! $(is-executable eget); then if ! $(is-executable eget); then
echo "I don't see eget on your path..." echo "I don't see eget on your path..."
@ -18,31 +29,36 @@ fi
echo "downloading binaries from github to $EGET_BIN" echo "downloading binaries from github to $EGET_BIN"
if ! $(is-executable yq); then
eget mikefarah/yq --asset yq_linux_amd64
fi
YAMLDOC="info/tools.yml"
alias eget="eget --system linux/amd64" alias eget="eget --system linux/amd64"
# environment readarray tools < <(yq e 'keys | .[]' $YAMLDOC)
eget rossmacarthur/sheldon
eget starship/starship --asset starship-x86_64-unknown-linux-gnu.tar.gz
# general tools for tool in "${tools[@]:1}"
eget Peltoche/lsd --asset x86_64-unknown-linux-gnu.tar.gz do
eget BurntSushi/ripgrep echo $tool
eget sharkdp/fd --asset x86_64-unknown-linux-gnu.tar.gz
eget sharkdp/bat --asset x86_64-unknown-linux-gnu.tar.gz
eget ClementTsang/bottom --asset x86_64-unknown-linux-gnu.tar.gz -f btm
# git user=$(key=$tool yq e 'explode(.) | .[env(key)].user' $YAMLDOC)
eget jesseduffield/lazygit asset=$(key=$tool yq e 'explode(.) | .[env(key)].asset // ""' $YAMLDOC)
file=$(key=$tool yq e 'explode(.) | .[env(key)].file // ""' $YAMLDOC)
to=$(key=$tool yq e 'explode(.) | .[env(key)].to // ""' $YAMLDOC)
download_only=$(key=$tool yq e 'explode(.) | .[env(key)].download-only // ""' $YAMLDOC)
# writing eget $user/$tool \
eget neovim/neovim ${asset:+--asset $asset} \
${file:+--file $file} \
${to:+--to $to}\
${download_only:+--download-only} \
-q
# eget dundee/gdu eget doesn't support .tgz? if [[ $download_only ]]; then
echo '----'
echo 'running post-download script'
post_download_install $tool
fi
# install gdu manually done
gdu_release=https://github.com/dundee/gdu/releases/download/v5.8.1/gdu_linux_amd64.tgz
echo "fetching gdu manually"
wget $gdu_release
tar -xzvf gdu_linux_amd64.tgz
mv gdu_linux_amd64 $EGET_BIN/gdu
rm gdu*