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

32 lines
780 B
Bash
Raw Normal View History

2016-02-15 21:31:29 -05: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-15 23:00:24 -05:00
if [ -f "${lbrynet_directory}/lbrynet_version.txt" ]; then
if grep -Fxq "$current_version" "${lbrynet_directory}/lbrynet_version.txt"; then
2016-02-15 21:31:29 -05: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-15 21:31:29 -05:00
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
2016-02-15 21:31:29 -05:00
cd lbry
echo "Installing update"
2016-02-15 21:31:29 -05:00
sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory"
2016-02-16 09:09:50 -05:00
echo $current_version > "${lbrynet_directory}/lbrynet_version.txt"
2016-02-15 21:31:29 -05:00
echo "Cleaning up"
cd ../../
2016-02-15 23:00:24 -05:00
rm -rf $tmp