install lbryum

This commit is contained in:
Jack 2016-02-19 23:26:24 -05:00
parent 0dbf810cfe
commit c63aa3033a
3 changed files with 157 additions and 74 deletions

View file

@ -192,9 +192,29 @@ class LBRYDaemon(xmlrpc.XMLRPC):
return defer.succeed(None)
def _update_lbryum():
git_version = subprocess.check_output(
"git ls-remote https://github.com/lbryio/lbryum.git | grep HEAD | cut -f 1",
shell=True)
if os.path.isfile(os.path.join(self.db_dir, "lbryum_version.txt")):
f = open(os.path.join(self.db_dir, "lbryum_version.txt"), 'r')
current_version = f.read()
f.close()
if git_version == current_version:
print "LBRYum installation version " + current_version[:-1] + " is up to date"
return defer.succeed(None)
print "Update LBRYum version " + current_version[:-1] + " --> " + git_version[:-1]
self.restart_message = "Updates available"
else:
print "Update LBRYum to version " + git_version[:-1]
self.restart_message = "Updates available"
return defer.succeed(None)
d = _check_for_updater()
d.addCallback(lambda _: _update_lbrynet())
d.addCallback(lambda _: _update_lbrycrdd())
d.addCallback(lambda _: _update_lbryum())
d.addCallback(lambda _: os.system("open /Applications/LBRY\ Updater.app &>/dev/null") if self.restart_message
else defer.succeed(None))
d.addCallbacks(lambda _: self._restart() if self.restart_message else defer.succeed(None))

58
lbrynet/lbrynet_daemon/scripts/update_lbry.sh Normal file → Executable file
View file

@ -1,63 +1,5 @@
#!/bin/sh
if ! which brew &>/dev/null; then
echo "Installing brew..."
sudo -u ${SUDO_USER} ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null &>/dev/null
else
echo "Updating brew..."
sudo -u ${SUDO_USER} brew update &>/dev/null
fi
if ! brew list mpfr &>/dev/null; then
echo "Installing mpfr..."
sudo -u ${SUDO_USER} brew install mpfr &>/dev/null
else
echo "mpfr already installed..."
fi
if ! brew list libmpc &>/dev/null; then
echo "Installing libmpc..."
sudo -u ${SUDO_USER} brew install libmpc &>/dev/null
else
echo "libmpc already installed..."
fi
if ! brew list openssl &>/dev/null; then
echo "Installing openssl..."
sudo -u ${SUDO_USER} brew install openssl &>/dev/null
sudo -u ${SUDO_USER} brew link --force openssl &>/dev/null
else
echo "openssl already installed..."
fi
if ! which pip &>/dev/null; then
echo "Installing pip..."
sudo easy_install pip &>/dev/null
else
echo "pip already installed"
fi
if ! python -c 'import gmpy' &>/dev/null; then
echo "Installing gmpy..."
sudo pip install gmpy &>/dev/null
else
echo "gmpy already installed..."
fi
if ! python -c 'import service_identity' &>/dev/null; then
echo "Installing service_identity..."
sudo pip install service_identity &>/dev/null
else
echo "gmpy already installed..."
fi
if ! python -c 'import rumps' &>/dev/null; then
echo "Installing rumps..."
sudo pip install rumps &>/dev/null
else
echo "rumps already installed..."
fi
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)

139
lbrynet/lbrynet_daemon/scripts/update_lbrynet.sh Normal file → Executable file
View file

@ -1,18 +1,72 @@
#!/bin/sh
if ! which brew &>/dev/null; then
echo "Installing brew..."
sudo -u ${SUDO_USER} ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null &>/dev/null
else
echo "Updating brew..."
sudo -u ${SUDO_USER} brew update &>/dev/null
fi
if ! brew list mpfr &>/dev/null; then
echo "Installing mpfr..."
sudo -u ${SUDO_USER} brew install mpfr &>/dev/null
else
echo "mpfr already installed..."
fi
if ! brew list libmpc &>/dev/null; then
echo "Installing libmpc..."
sudo -u ${SUDO_USER} brew install libmpc &>/dev/null
else
echo "libmpc already installed..."
fi
if ! brew list openssl &>/dev/null; then
echo "Installing openssl..."
sudo -u ${SUDO_USER} brew install openssl &>/dev/null
sudo -u ${SUDO_USER} brew link --force openssl &>/dev/null
else
echo "openssl already installed..."
fi
if ! which pip &>/dev/null; then
echo "Installing pip..."
sudo easy_install pip &>/dev/null
else
echo "pip already installed"
fi
if ! python -c 'import gmpy' &>/dev/null; then
echo "Installing gmpy..."
sudo pip install gmpy &>/dev/null
else
echo "gmpy already installed..."
fi
if ! python -c 'import service_identity' &>/dev/null; then
echo "Installing service_identity..."
sudo pip install service_identity &>/dev/null
else
echo "gmpy already installed..."
fi
if ! python -c 'import rumps' &>/dev/null; then
echo "Installing rumps..."
sudo pip install rumps &>/dev/null
else
echo "rumps already installed..."
fi
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)
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}/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
fi
fi
if grep -Fxq "$lbrynet_current_version" "${lbrynet_directory}/lbrynet_version.txt"; then
echo "LBRYnet version $lbrynet_current_version is up to date"
else
tmp=$(mktemp -d)
cd $tmp
@ -24,9 +78,76 @@ cd lbry
echo "Installing update"
sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory"
echo $current_version > "${lbrynet_directory}/lbrynet_version.txt"
echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt"
echo "Cleaning up"
cd ../../
rm -rf $tmp
fi
else
tmp=$(mktemp -d)
cd $tmp
echo "Downloading LBRYnet update"
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
cd lbry
echo "Installing update"
sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory"
echo $lbrynet_current_version > "${lbrynet_directory}/lbrynet_version.txt"
echo "Cleaning up"
cd ../../
rm -rf $tmp
fi
fi
lbryum_current_version=$(git ls-remote https://github.com/lbryio/lbryum.git | grep HEAD | cut -f 1)
if [ -d "$lbrynet_directory" ]; then
if [ -f "${lbrynet_directory}/lbryum_version.txt" ]; then
if grep -Fxq "$lbryum_current_version" "${lbrynet_directory}/lbryum_version.txt"; then
echo "LBRYum version $lbryum_current_version is up to date"
else
tmp=$(mktemp -d)
cd $tmp
echo "Downloading LBRYum update"
git clone --depth 1 https://github.com/lbryio/lbryum.git &>/dev/null
cd lbryum
echo "Installing update"
sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory"
echo $lbryum_current_version > "${lbrynet_directory}/lbryum_version.txt"
echo "Cleaning up"
cd ../../
rm -rf $tmp
fi
else
tmp=$(mktemp -d)
cd $tmp
echo "Downloading LBRYum update"
git clone --depth 1 https://github.com/lbryio/lbryum.git &>/dev/null
cd lbryum
echo "Installing update"
sudo python setup.py install &>/dev/null
mkdir -p "$lbrynet_directory"
echo $lbryum_current_version > "${lbrynet_directory}/lbryum_version.txt"
echo "Cleaning up"
cd ../../
rm -rf $tmp
fi
fi