update tools installer for eget v1.0.0

This commit is contained in:
Daylin Morgan 2022-01-04 13:45:12 -06:00
parent ed32295d7e
commit 8b71deee75
2 changed files with 63 additions and 29 deletions

View file

@ -43,6 +43,13 @@ glab:
#node #node
fnm: fnm:
user: Schniz user: Schniz
download-only: true
post-download: |
unzip -qq fnm-linux.zip
mv fnm $EGET_BIN/fnm
rm -r fnm-linux.zip
chmod u+x $EGET_BIN/fnm
# editing # editing
neovim: neovim:
@ -51,11 +58,12 @@ neovim:
# file management # file management
gdu: gdu:
user: dundee user: dundee
download-only: true to: gdu
post-download: | # download-only: true
tar -xzf gdu_linux_amd64.tgz # post-download: |
mv gdu_linux_amd64 $EGET_BIN/gdu # tar -xzf gdu_linux_amd64.tgz
rm gdu_linux_amd64.tgz # mv gdu_linux_amd64 $EGET_BIN/gdu
# rm gdu_linux_amd64.tgz
lf: lf:
user: gokcehan user: gokcehan

View file

@ -3,6 +3,8 @@
BIN_DIR=$HOME/bin BIN_DIR=$HOME/bin
mkdir -p $BIN_DIR mkdir -p $BIN_DIR
EGET_BIN=$BIN_DIR EGET_BIN=$BIN_DIR
YAMLDOC="info/tools.yml"
alias eget="eget --system linux/amd64"
post_download_install() { post_download_install() {
@ -14,32 +16,10 @@ post_download_install() {
} }
if ! $(is-executable eget); then eget_tool() {
echo "I don't see eget on your path..."
read -p "Do you want to download it to ${BIN_DIR}? " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
else
curl https://zyedidia.github.io/eget.sh | sh
mv eget $BIN_DIR/eget
fi
fi
echo "downloading binaries from github to $EGET_BIN" tool=$1
if ! $(is-executable yq); then
eget mikefarah/yq --asset yq_linux_amd64
fi
YAMLDOC="info/tools.yml"
alias eget="eget --system linux/amd64"
readarray tools < <(yq e 'keys | .[]' $YAMLDOC)
for tool in "${tools[@]:1}"
do
echo -n $tool echo -n $tool
user=$(key=$tool yq e 'explode(.) | .[env(key)].user' $YAMLDOC) user=$(key=$tool yq e 'explode(.) | .[env(key)].user' $YAMLDOC)
@ -62,4 +42,50 @@ do
fi fi
echo echo
}
if ! $(is-executable eget); then
echo "I don't see eget on your path..."
read -p "Do you want to download it to ${BIN_DIR}? " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
else
curl https://zyedidia.github.io/eget.sh | sh
mv eget $BIN_DIR/eget
fi
fi
echo "downloading binaries from github to $EGET_BIN"
if ! $(is-executable yq); then
eget mikefarah/yq --asset yq_linux_amd64
fi
if ! [ -z "$1" ]; then
tool=$1
echo "installing $tool"
info=$(key=$tool yq e 'explode(.) | .[env(key)]' $YAMLDOC)
if [[ "$info" == "null" ]]; then
echo "$tool not found in $YAMLDOC"
echo "exiting"
exit 1
else
eget_tool $tool
fi
exit
fi
echo "no tool specified installing everything"
readarray tools < <(yq e 'keys | .[]' $YAMLDOC)
for tool in "${tools[@]:1}"
do
eget_tool $tool
done done