From a0a0e2d32471dd0efc4ab0ffd15cf1f3b8d40962 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 15 Feb 2016 21:31:29 -0500 Subject: [PATCH] add daemon update script --- .../lbrynet_daemon/scripts/update_daemon.sh | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lbrynet/lbrynet_daemon/scripts/update_daemon.sh diff --git a/lbrynet/lbrynet_daemon/scripts/update_daemon.sh b/lbrynet/lbrynet_daemon/scripts/update_daemon.sh new file mode 100644 index 000000000..c2135c609 --- /dev/null +++ b/lbrynet/lbrynet_daemon/scripts/update_daemon.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +lbrynet_directory="/Users/${SUDO_USER}/Library/Application Support/lbrynet" + +current_version=$(git ls-remote https://github.com/lbryio/lbry.git | grep HEAD | cut -f 1) + +if [ -d "$lbrynet_directory" ]; then + if [ -f "${lbrynet_directory}/version.txt" ]; then + if grep -Fxq "$current_version" "${lbrynet_directory}/version.txt"; then + echo "LBRYnet version $current_version is up to date" + exit + fi + fi +fi + +tmp=$(mktemp -d) +cd $tmp + +echo "Downloading update" + +git clone https://github.com/lbryio/lbry.git &>/dev/null +cd lbry + +version=$(git rev-parse HEAD) + +echo "Updating lbrynet" +sudo python setup.py install &>/dev/null +mkdir -p "$lbrynet_directory" +echo $version > "${lbrynet_directory}/version.txt" + +echo "Cleaning up" + +cd ../../ +rm -rf $tmp + +echo "Restarting lbrynet-daemon" +sudo lbrynet-daemon \ No newline at end of file