lbry-sdk/lbrynet/lbrynet_daemon/scripts/update_lbrynet.sh

32 lines
780 B
Bash
Raw Normal View History

2016-02-16 03:31:29 +01:00
#!/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
2016-02-16 05:00:24 +01:00
if [ -f "${lbrynet_directory}/lbrynet_version.txt" ]; then
if grep -Fxq "$current_version" "${lbrynet_directory}/lbrynet_version.txt"; then
2016-02-16 03:31:29 +01:00
echo "LBRYnet version $current_version is up to date"
exit
fi
fi
fi
tmp=$(mktemp -d)
cd $tmp
echo "Downloading LBRYnet update"
2016-02-16 03:31:29 +01:00
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
2016-02-16 03:31:29 +01:00
cd lbry
echo "Installing update"
2016-02-16 03:31:29 +01:00
sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory"
2016-02-16 15:09:50 +01:00
echo $current_version > "${lbrynet_directory}/lbrynet_version.txt"
2016-02-16 03:31:29 +01:00
echo "Cleaning up"
cd ../../
2016-02-16 05:00:24 +01:00
rm -rf $tmp