get rid of unused updater function
updater function was hacky and not the most reliable, to be replaced by app version checking
This commit is contained in:
parent
ba991b47ea
commit
2486ae6d3f
4 changed files with 3 additions and 315 deletions
|
@ -159,7 +159,6 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
self.data_rate = MIN_BLOB_DATA_PAYMENT_RATE
|
self.data_rate = MIN_BLOB_DATA_PAYMENT_RATE
|
||||||
self.max_key_fee = DEFAULT_MAX_KEY_FEE
|
self.max_key_fee = DEFAULT_MAX_KEY_FEE
|
||||||
self.max_search_results = DEFAULT_MAX_SEARCH_RESULTS
|
self.max_search_results = DEFAULT_MAX_SEARCH_RESULTS
|
||||||
self.restart_message = ""
|
|
||||||
self.startup_message = ""
|
self.startup_message = ""
|
||||||
self.announced_startup = False
|
self.announced_startup = False
|
||||||
self.search_timeout = 3.0
|
self.search_timeout = 3.0
|
||||||
|
@ -176,10 +175,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
|
|
||||||
def _disp_startup():
|
def _disp_startup():
|
||||||
if self.restart_message:
|
log.info("[" + str(datetime.now()) + "] Started lbrynet-daemon")
|
||||||
log.info(self.restart_message)
|
|
||||||
else:
|
|
||||||
log.info("[" + str(datetime.now()) + "] Started lbrynet-daemon")
|
|
||||||
|
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
|
|
||||||
|
@ -199,8 +195,6 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
d.addCallback(lambda _: self._setup_lbry_file_opener())
|
d.addCallback(lambda _: self._setup_lbry_file_opener())
|
||||||
d.addCallback(lambda _: self._setup_query_handlers())
|
d.addCallback(lambda _: self._setup_query_handlers())
|
||||||
d.addCallback(lambda _: self._setup_server())
|
d.addCallback(lambda _: self._setup_server())
|
||||||
# d.addCallback(lambda _: self._update() if self.check_for_updates == "True" and sys.platform == "darwin"
|
|
||||||
# else defer.succeed(None))
|
|
||||||
d.addCallback(lambda _: self._setup_fetcher())
|
d.addCallback(lambda _: self._setup_fetcher())
|
||||||
d.addCallback(lambda _: _disp_startup())
|
d.addCallback(lambda _: _disp_startup())
|
||||||
d.callback(None)
|
d.callback(None)
|
||||||
|
@ -208,102 +202,12 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
|
|
||||||
def _initial_setup(self):
|
def _initial_setup(self):
|
||||||
return NotImplemented
|
return defer.fail(NotImplementedError())
|
||||||
|
|
||||||
def _setup_daemon_settings(self):
|
def _setup_daemon_settings(self):
|
||||||
self.session_settings = self.default_settings
|
self.session_settings = self.default_settings
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
|
|
||||||
def _update(self):
|
|
||||||
def _check_for_updater():
|
|
||||||
if os.path.isdir("/Applications/LBRY Updater.app"):
|
|
||||||
print "Found LBRY updater"
|
|
||||||
return defer.succeed(None)
|
|
||||||
|
|
||||||
print "LBRY updater not found, downloading and installing..."
|
|
||||||
url = urlopen("https://rawgit.com/jackrobison/lbrynet-app/master/LBRY%20Updater.app.zip")
|
|
||||||
zipped_app = ZipFile(StringIO(url.read()))
|
|
||||||
zipped_app.extractall("/Applications")
|
|
||||||
return defer.succeed(None)
|
|
||||||
|
|
||||||
def _update_lbrynet():
|
|
||||||
git_version = subprocess.check_output(
|
|
||||||
"git ls-remote https://github.com/lbryio/lbry.git | grep HEAD | cut -f 1",
|
|
||||||
shell=True)
|
|
||||||
if os.path.isfile(os.path.join(self.db_dir, "lbrynet_version.txt")):
|
|
||||||
f = open(os.path.join(self.db_dir, "lbrynet_version.txt"), 'r')
|
|
||||||
current_version = f.read()
|
|
||||||
f.close()
|
|
||||||
if git_version == current_version:
|
|
||||||
print "LBRYnet installation version " + current_version[:-1] + " is up to date"
|
|
||||||
return defer.succeed(None)
|
|
||||||
print "Update LBRYnet version " + current_version[:-1] + " --> " + git_version[:-1]
|
|
||||||
self.restart_message = "Updates available"
|
|
||||||
else:
|
|
||||||
print "Update LBRYnet to version " + git_version[:-1]
|
|
||||||
self.restart_message = "Updates available"
|
|
||||||
|
|
||||||
return defer.succeed(None)
|
|
||||||
|
|
||||||
def _update_lbrycrdd():
|
|
||||||
git_version = subprocess.check_output(
|
|
||||||
"git ls-remote https://github.com/jackrobison/lbrynet-app.git | grep HEAD | cut -f 1",
|
|
||||||
shell=True)
|
|
||||||
if os.path.isfile(os.path.join(self.wallet_dir, "lbry_app_version.txt")):
|
|
||||||
f = open(os.path.join(self.wallet_dir, "lbry_app_version.txt"), 'r')
|
|
||||||
current_version = f.read()
|
|
||||||
f.close()
|
|
||||||
if git_version == current_version:
|
|
||||||
print "LBRY installation version " + current_version[:-1] + " is up to date"
|
|
||||||
return defer.succeed(None)
|
|
||||||
print "Update LBRY version " + current_version[:-1] + " --> " + git_version[:-1]
|
|
||||||
self.restart_message = "Updates available"
|
|
||||||
else:
|
|
||||||
print "Update LBRY to version " + git_version[:-1]
|
|
||||||
self.restart_message = "Updates available"
|
|
||||||
|
|
||||||
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() if self.wallet_type == 'lbrycrd' else _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))
|
|
||||||
|
|
||||||
return defer.succeed(None)
|
|
||||||
|
|
||||||
def _restart(self):
|
|
||||||
def _disp_shutdown():
|
|
||||||
print 'Restarting lbrynet daemon'
|
|
||||||
return defer.succeed(None)
|
|
||||||
|
|
||||||
# LBRY Updater.app will restart the daemon
|
|
||||||
d = self._shutdown()
|
|
||||||
d.addCallback(lambda _: _disp_shutdown())
|
|
||||||
d.addCallback(lambda _: reactor.callLater(1.0, reactor.stop))
|
|
||||||
|
|
||||||
return d
|
|
||||||
|
|
||||||
def _start_server(self):
|
def _start_server(self):
|
||||||
|
|
||||||
if self.peer_port is not None:
|
if self.peer_port is not None:
|
||||||
|
@ -1106,6 +1010,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
@return: time behind blockchain
|
@return: time behind blockchain
|
||||||
"""
|
"""
|
||||||
d = self.session.wallet.get_most_recent_blocktime()
|
d = self.session.wallet.get_most_recent_blocktime()
|
||||||
|
d.addCallback(get_time_behind_blockchain)
|
||||||
d.addCallbacks(lambda result: self._render_response(result, OK_CODE),
|
d.addCallbacks(lambda result: self._render_response(result, OK_CODE),
|
||||||
lambda result: self._render_response(result, BAD_REQUEST))
|
lambda result: self._render_response(result, BAD_REQUEST))
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo "Restarting lbrynet-daemon"
|
|
||||||
lbrynet-daemon
|
|
|
@ -1,50 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
||||||
if ! brew list berkeley-db4 &>/dev/null; then
|
|
||||||
echo "Installing berkeley-db4"
|
|
||||||
sudo -u ${SUDO_USER} brew install https://rawgit.com/jackrobison/homebrew/master/Library/Formula/berkeley-db4.rb &>/dev/null
|
|
||||||
sudo -u ${SUDO_USER} brew link --force berkeley-db4 &>/dev/null
|
|
||||||
else
|
|
||||||
echo "berkeley-db4 already installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmp=$(mktemp -d)
|
|
||||||
cd $tmp
|
|
||||||
|
|
||||||
echo "Downloading LBRY update"
|
|
||||||
git clone --depth 1 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"
|
|
||||||
|
|
||||||
mkdir -p "$lbrycrd_directory"
|
|
||||||
echo $current_version > "${lbrycrd_directory}/lbry_app_version.txt"
|
|
||||||
|
|
||||||
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
|
|
|
@ -1,163 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
||||||
if ! python -c "import six; exit(0) if six.__version__ == '1.9.0' else exit(1)" &>/dev/null; then
|
|
||||||
echo "Installing six 1.9.0 for python..."
|
|
||||||
curl -O https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz &>/dev/null
|
|
||||||
tar xf six-1.9.0.tar.gz &>/dev/null
|
|
||||||
cd six-1.9.0
|
|
||||||
sudo python setup.py install &>/dev/null
|
|
||||||
cd ..
|
|
||||||
rm -rf six-1.9.0
|
|
||||||
rm six-1.9.0.tar.gz
|
|
||||||
fi
|
|
||||||
|
|
||||||
lbrynet_directory="/Users/${SUDO_USER}/Library/Application Support/lbrynet"
|
|
||||||
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..."
|
|
||||||
|
|
||||||
git clone --depth 1 https://github.com/lbryio/lbryum.git &>/dev/null
|
|
||||||
cd lbryum
|
|
||||||
|
|
||||||
echo "Installing..."
|
|
||||||
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
|
|
||||||
|
|
||||||
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 "$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
|
|
||||||
|
|
||||||
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
|
|
||||||
else
|
|
||||||
tmp=$(mktemp -d)
|
|
||||||
cd $tmp
|
|
||||||
|
|
||||||
echo "Downloading LBRYnet..."
|
|
||||||
|
|
||||||
git clone --depth 1 https://github.com/lbryio/lbry.git &>/dev/null
|
|
||||||
cd lbry
|
|
||||||
|
|
||||||
echo "Installing..."
|
|
||||||
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
|
|
Loading…
Add table
Reference in a new issue