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

44 lines
1.1 KiB
Bash
Raw Normal View History

2016-02-16 05:00:24 +01:00
#!/bin/sh
lbrycrd_directory="/Users/${SUDO_USER}/Library/Application Support/lbrycrd"
current_version=$(git ls-remote https://github.com/jackrobison/lbrynet-app.git | grep HEAD | cut -f 1)
if [ -d "$lbrycrd_directory" ]; then
if [ -f "${lbrycrd_directory}/lbry_app_version.txt" ]; then
if grep -Fxq "$current_version" "${lbrycrd_directory}/lbry_app_version.txt"; then
echo "LBRY version $current_version is up to date"
exit
fi
fi
fi
echo "Updating LBRY"
tmp=$(mktemp -d)
cd $tmp
echo "Downloading update"
git clone https://github.com/jackrobison/lbrynet-app.git &>/dev/null
cd lbrynet-app
unzip LBRY.app.zip &>/dev/null
unzip LBRYURIHandler.app.zip &>/dev/null
unzip LBRY\ Updater.app.zip &>/dev/null
echo "Installing update"
2016-02-16 15:09:50 +01:00
mkdir -p "$lbrycrd_directory"
echo $current_version > "${lbrycrd_directory}/lbry_app_version.txt"
2016-02-16 05:00:24 +01:00
rm -rf /Applications/LBRY.app &>/dev/null
rm -rf /Applications/LBRYURIHandler.app &>/dev/null
rm -rf /Applications/LBRY\ Updater.app &>/dev/null
mv -f LBRY.app /Applications
mv -f LBRYURIHandler.app /Applications
mv -f LBRY\ Updater.app /Applications
echo "Cleaning up"
cd ../../
rm -rf $tmp