diff --git a/README.md b/README.md index 864128e..4f6b1e8 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,10 @@ Download the `.deb` file and run: ```console sudo dpkg -i ldddns_0.0.16_linux_amd64.deb ``` + +Or just run the following command which will download and install the +latest package for you: + +```console +curl -fsSL https://raw.githubusercontent.com/arnested/ldddns/main/install.sh | bash +``` diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..03d673c --- /dev/null +++ b/install.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +if [ -z "$BASH" ] ;then echo Please run this with bash; exit 1; fi + +set -euo pipefail + +ldddns_install() { + set -euo pipefail + + tmpdir="$(mktemp -d)" + + # Make a cleanup function + cleanup() { + rm --recursive --force -- "${tmpdir}" + } + trap cleanup EXIT + + echo -n Finding latest package name... + package=$(curl --proto =https --fail -sSL "https://github.com/arnested/ldddns/releases/latest/download/checksums.txt" | grep -i $(uname -s) | grep $(dpkg --print-architecture) | grep \.deb | awk '{print $2}') + echo " $package" + + echo Downloading $package... + curl --proto =https --fail --location --progress-bar --output "${tmpdir}/${package}" "https://github.com/arnested/ldddns/releases/latest/download/${package}" + + echo Installing $package... + pkexec dpkg -i "${tmpdir}/${package}" +} + +ldddns_install