From 6fa6998aca23833846accd8d148415ef1976b77d Mon Sep 17 00:00:00 2001 From: Liam Galvin Date: Sat, 31 Jul 2021 14:35:27 +0100 Subject: [PATCH] docs: Add installation steps + script --- README.md | 8 +++++++- scripts/install.sh | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 scripts/install.sh diff --git a/README.md b/README.md index 1695697..d2578c8 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,13 @@ Install dependencies: - `xorg-dev` - `libgl1-mesa-dev` -Grab a binary from the [latest release](https://github.com/liamg/darktile/releases/latest). +Grab a binary from the [latest release](https://github.com/liamg/darktile/releases/latest), `chmod +x` it and place it in your `$PATH`. + +If you're too lazy to do the above and you like to live life on the edge, you can pipe this script to sudo: + +```bash +curl -s "https://raw.githubusercontent.com/liamg/darktile/master/scripts/install.sh" | sudo bash +``` ## Configuration diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..eb85438 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +echo "Determining platform..." +platform=$(uname | tr '[:upper:]' '[:lower:]') +echo "Finding latest release..." +asset=$(curl --silent https://api.github.com/repos/liamg/darktile/releases/latest | jq -r ".assets[] | select(.name | contains(\"${platform}\")) | .url") +echo "Downloading latest release for your platform..." +curl -s -L -H "Accept: application/octet-stream" "${asset}" --output /tmp/darktile +echo "Installing darktile..." +chmod +x /tmp/darktile +installdir="${HOME}/bin/" +if [ "$EUID" -eq 0 ]; then + installdir="/usr/local/bin/" +fi +mkdir -p $installdir +mv /tmp/darktile "${installdir}/darktile" +which darktile &> /dev/null || (echo "Please add ${installdir} to your PATH to complete installation!" && exit 1) +echo "Installation complete!" \ No newline at end of file