Add lbry app update script

This commit is contained in:
Jack 2016-02-15 23:00:24 -05:00
parent a0a0e2d324
commit 1a1c101b9a
3 changed files with 48 additions and 7 deletions

View file

@ -0,0 +1,4 @@
#!/bin/sh
echo "Restarting lbrynet-daemon"
sudo lbrynet-daemon

View file

@ -0,0 +1,40 @@
#!/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"
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

View file

@ -5,8 +5,8 @@ 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
if [ -f "${lbrynet_directory}/lbrynet_version.txt" ]; then
if grep -Fxq "$current_version" "${lbrynet_directory}/lbrynet_version.txt"; then
echo "LBRYnet version $current_version is up to date"
exit
fi
@ -26,12 +26,9 @@ 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 $version > "${lbrynet_directory}/lbrynet_version.txt"
echo "Cleaning up"
cd ../../
rm -rf $tmp
echo "Restarting lbrynet-daemon"
sudo lbrynet-daemon
rm -rf $tmp