about summary refs log tree commit diff
path: root/pkgs/development/tools/glamoroustoolkit/GlamorousToolkit-GetImage
blob: 20c2c315a350ebe3f85fdc82a1a3c6505ee1c331 (plain) (blame)
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
#! /usr/bin/env nix-shell
#! nix-shell -i bash --packages curl
#
# Download the latest GlamorousToolkit image to the current directory, which must be empty
#
set -e

if [ ! -z "$(ls)" ]
then
	echo "Warning: the directory is not empty, continuing may overwrite some files"
	read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
fi

GTVERSION=$(curl -s https://api.github.com/repos/feenkcom/gtoolkit/releases/latest 2>/dev/null | grep tag_name | cut -d '"' -f 4)
if [ -z "$GTVERSION" ]
then
	echo "Failed to get Gt Version string, exiting..."
	exit 1
fi

curl -L \
  -o gt-image.zip \
  https://github.com/feenkcom/gtoolkit/releases/download/${GTVERSION}/GlamorousToolkit-Linux-x86_64-${GTVERSION}.zip
unzip gt-image.zip
rm -rf bin lib