-
Notifications
You must be signed in to change notification settings - Fork 179
Linux update script
Andrew Cantino edited this page Apr 19, 2021
·
2 revisions
@Konfekt contributed the following update script, saves to ~/bin
and could be run by a cron job.
#!/usr/bin/env sh
# debug output and exit on error or use of undeclared variable or pipe error:
set -o xtrace -o errtrace -o errexit -o nounset -o pipefail
latest_tag="$(curl --location --head https://github.com/cantino/mcfly/releases/latest | grep -i location: | sed 's/^.*\/tag\/\([^\/]*\)\r$/\1/')"
filename="mcfly-${latest_tag}-x86_64-unknown-linux-gnu.tar.gz"
uri_to_download="https://github.com/cantino/mcfly/releases/download/${latest_tag}/${filename}"
{
cd "$(mktemp --directory "${TMPDIR:-/tmp}/mcfly-update.XXXXXXXXXX")"
curl --fail --show-error --remote-name --location "$uri_to_download"
tar xf "$filename"
chmod a+x mcfly
cp mcfly "$HOME/bin"
}
if [ ! -x "$HOME/bin/mcfly" ]; then
echo '"mcfly" was not successfully installed!' >&2
# DISPLAY=:0 notify-send --urgency=critical "Failed updating mcfly!
# Run $0 to check."
exit 2
fi