Added ntfy-cli.sh
Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
parent
16988653f4
commit
f11b3b732d
2 changed files with 44 additions and 0 deletions
|
@ -23,6 +23,7 @@ Markdown docs and shell scripts for automating installation of things and docume
|
|||
* [`fuck.md`](fuck.md) for installing https://github.com/nvbn/thefuck
|
||||
* [`gpaste.md`](gpaste.md) for installing the GPaste clipboard manager
|
||||
* [`i3-move-monitor.md`](i3-move-monitor.md) for moving virtual monitor positions when using i3
|
||||
* [`ntfy-cli.sh`](ntfy-cli.sh) for installing the [Ntfy push notification server and CLI](https://ntfy.sh)
|
||||
* [`picom.sh`](picom.sh) for compiling and installing the Picom compositor
|
||||
* [`rclone.sh`](rclone.sh)
|
||||
* [`restic.sh`](restic.sh) for installing the Restic backup tool
|
||||
|
|
43
ntfy-cli.sh
Executable file
43
ntfy-cli.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
# - Assumes your nfty installation goes in /usr/local/bin
|
||||
# - Assumes you're using Bash
|
||||
# - Assumes you want the Linux x86_64 build
|
||||
|
||||
function getStatusCode() {
|
||||
set +e
|
||||
bash -c "$1" > /dev/null 2>&1
|
||||
echo $?
|
||||
set -e
|
||||
}
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Usage: ./ntfy-cli.sh [VERSION]"
|
||||
echo "Please specify a version."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEMP_DIR=$(mktemp --directory)
|
||||
|
||||
set -ex
|
||||
|
||||
VERSION=$1
|
||||
|
||||
VERSION_STRING="ntfy_${VERSION}_linux_x86_64"
|
||||
FILENAME="$VERSION_STRING.tar.gz"
|
||||
DL_URL="https://github.com/binwiederhier/ntfy/releases/download/v$VERSION/$FILENAME"
|
||||
|
||||
FILENAME="$TEMP_DIR/$FILENAME"
|
||||
|
||||
wget --output-document=$FILENAME $DL_URL
|
||||
tar -C $TEMP_DIR -xzf $FILENAME
|
||||
|
||||
# In the instance we're not installing fresh...
|
||||
if [ -e "/usr/local/bin/ntfy" ]; then
|
||||
sudo rm /usr/local/bin/ntfy
|
||||
fi
|
||||
|
||||
sudo mv $TEMP_DIR/$VERSION_STRING/ntfy /usr/local/bin
|
||||
|
||||
# Tidy up
|
||||
rm -r $TEMP_DIR
|
Loading…
Add table
Add a link
Reference in a new issue