mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Require manual download and install for Windows / MacOS
This commit is contained in:
parent
1394339df6
commit
5d8a7d80eb
5 changed files with 63 additions and 57 deletions
|
@ -177,7 +177,7 @@ def main():
|
||||||
if args.datadir:
|
if args.datadir:
|
||||||
plexpy.DATA_DIR = args.datadir
|
plexpy.DATA_DIR = args.datadir
|
||||||
elif plexpy.FROZEN:
|
elif plexpy.FROZEN:
|
||||||
plexpy.DATA_DIR = appdirs.user_data_dir("Tautulli", "Tautulli")
|
plexpy.DATA_DIR = appdirs.user_data_dir("Tautulli", False)
|
||||||
else:
|
else:
|
||||||
plexpy.DATA_DIR = plexpy.PROG_DIR
|
plexpy.DATA_DIR = plexpy.PROG_DIR
|
||||||
|
|
||||||
|
@ -268,8 +268,11 @@ def main():
|
||||||
plexpy.shutdown(restart=True, checkout=True)
|
plexpy.shutdown(restart=True, checkout=True)
|
||||||
elif plexpy.SIGNAL == 'reset':
|
elif plexpy.SIGNAL == 'reset':
|
||||||
plexpy.shutdown(restart=True, reset=True)
|
plexpy.shutdown(restart=True, reset=True)
|
||||||
else:
|
elif plexpy.SIGNAL == 'update':
|
||||||
plexpy.shutdown(restart=True, update=True)
|
plexpy.shutdown(restart=True, update=True)
|
||||||
|
else:
|
||||||
|
logger.error('Unknown signal. Shutting down...')
|
||||||
|
plexpy.shutdown()
|
||||||
|
|
||||||
plexpy.SIGNAL = None
|
plexpy.SIGNAL = None
|
||||||
|
|
||||||
|
|
|
@ -330,8 +330,10 @@ ${next.modalIncludes()}
|
||||||
msg = 'A <a href="' + result.compare_url + '" target="_blank">newer version</a> of Tautulli is available!<br />' +
|
msg = 'A <a href="' + result.compare_url + '" target="_blank">newer version</a> of Tautulli is available!<br />' +
|
||||||
'You are '+ result.commits_behind + ' commit' + (result.commits_behind > 1 ? 's' : '') + ' behind.<br />';
|
'You are '+ result.commits_behind + ' commit' + (result.commits_behind > 1 ? 's' : '') + ' behind.<br />';
|
||||||
}
|
}
|
||||||
if (result.docker) {
|
if (result.install_type === 'docker') {
|
||||||
msg += 'Update your Docker container or <a href="#" id="updateDismiss">Dismiss</a>';
|
msg += 'Update your Docker container or <a href="#" id="updateDismiss">Dismiss</a>';
|
||||||
|
} else if (result.install_type === 'windows' || result.install_type === 'macos') {
|
||||||
|
msg += '<a href="' + result.release_url + '" target="_blank">Download</a> and install the latest version or <a href="#" id="updateDismiss">Dismiss</a>'
|
||||||
} else {
|
} else {
|
||||||
msg += '<a href="update">Update</a> or <a href="#" id="updateDismiss">Dismiss</a>';
|
msg += '<a href="update">Update</a> or <a href="#" id="updateDismiss">Dismiss</a>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,10 +277,10 @@ def initialize(config_file):
|
||||||
|
|
||||||
# Get the currently installed version. Returns None, 'win32' or the git
|
# Get the currently installed version. Returns None, 'win32' or the git
|
||||||
# hash.
|
# hash.
|
||||||
CURRENT_VERSION, CONFIG.GIT_REMOTE, CONFIG.GIT_BRANCH = versioncheck.getVersion()
|
CURRENT_VERSION, CONFIG.GIT_REMOTE, CONFIG.GIT_BRANCH = versioncheck.get_version()
|
||||||
|
|
||||||
# Write current version to a file, so we know which version did work.
|
# Write current version to a file, so we know which version did work.
|
||||||
# This allowes one to restore to that version. The idea is that if we
|
# This allows one to restore to that version. The idea is that if we
|
||||||
# arrive here, most parts of Tautulli seem to work.
|
# arrive here, most parts of Tautulli seem to work.
|
||||||
if CURRENT_VERSION:
|
if CURRENT_VERSION:
|
||||||
try:
|
try:
|
||||||
|
@ -2210,9 +2210,6 @@ def shutdown(restart=False, update=False, checkout=False, reset=False):
|
||||||
|
|
||||||
CONFIG.write()
|
CONFIG.write()
|
||||||
|
|
||||||
if not restart and not update and not checkout:
|
|
||||||
logger.info("Tautulli is shutting down...")
|
|
||||||
|
|
||||||
if update:
|
if update:
|
||||||
logger.info("Tautulli is updating...")
|
logger.info("Tautulli is updating...")
|
||||||
try:
|
try:
|
||||||
|
@ -2255,25 +2252,23 @@ def shutdown(restart=False, update=False, checkout=False, reset=False):
|
||||||
|
|
||||||
# Separate out logger so we can shutdown logger after
|
# Separate out logger so we can shutdown logger after
|
||||||
if NOFORK:
|
if NOFORK:
|
||||||
logger.info('Running as service, not forking. Exiting...')
|
logger.info("Running as service, not forking. Exiting...")
|
||||||
elif os.name == 'nt':
|
|
||||||
logger.info('Restarting Tautulli with %s', args)
|
|
||||||
else:
|
else:
|
||||||
logger.info('Restarting Tautulli with %s', args)
|
logger.info("Restarting Tautulli with %s", args)
|
||||||
|
|
||||||
logger.shutdown()
|
|
||||||
|
|
||||||
# os.execv fails with spaced names on Windows
|
# os.execv fails with spaced names on Windows
|
||||||
# https://bugs.python.org/issue19066
|
# https://bugs.python.org/issue19066
|
||||||
if NOFORK:
|
if NOFORK:
|
||||||
pass
|
pass
|
||||||
elif os.name == 'nt':
|
elif common.PLATFORM == 'Windows':
|
||||||
subprocess.Popen(args, cwd=os.getcwd())
|
subprocess.Popen(args, cwd=os.getcwd())
|
||||||
else:
|
else:
|
||||||
os.execv(exe, args)
|
os.execv(exe, args)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.shutdown()
|
logger.info("Tautulli is shutting down...")
|
||||||
|
|
||||||
|
logger.shutdown()
|
||||||
|
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
@ -2331,7 +2326,7 @@ def check_folder_writable(folder, fallback, name):
|
||||||
os.makedirs(folder)
|
os.makedirs(folder)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
logger.error("Could not create %s dir '%s': %s" % (name, folder, e))
|
logger.error("Could not create %s dir '%s': %s" % (name, folder, e))
|
||||||
if folder != fallback:
|
if fallback and folder != fallback:
|
||||||
logger.warn("Falling back to %s dir '%s'" % (name, fallback))
|
logger.warn("Falling back to %s dir '%s'" % (name, fallback))
|
||||||
return check_folder_writable(None, fallback, name)
|
return check_folder_writable(None, fallback, name)
|
||||||
else:
|
else:
|
||||||
|
@ -2339,7 +2334,7 @@ def check_folder_writable(folder, fallback, name):
|
||||||
|
|
||||||
if not os.access(folder, os.W_OK):
|
if not os.access(folder, os.W_OK):
|
||||||
logger.error("Cannot write to %s dir '%s'" % (name, folder))
|
logger.error("Cannot write to %s dir '%s'" % (name, folder))
|
||||||
if folder != fallback:
|
if fallback and folder != fallback:
|
||||||
logger.warn("Falling back to %s dir '%s'" % (name, fallback))
|
logger.warn("Falling back to %s dir '%s'" % (name, fallback))
|
||||||
return check_folder_writable(None, fallback, name)
|
return check_folder_writable(None, fallback, name)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -72,33 +72,37 @@ def runGit(args):
|
||||||
elif output:
|
elif output:
|
||||||
break
|
break
|
||||||
|
|
||||||
return (output, err)
|
return output, err
|
||||||
|
|
||||||
|
|
||||||
def getVersion():
|
def get_version():
|
||||||
|
|
||||||
if common.BRANCH.startswith('win32build'):
|
if plexpy.FROZEN and common.PLATFORM == 'Windows':
|
||||||
plexpy.INSTALL_TYPE = 'win'
|
plexpy.INSTALL_TYPE = 'windows'
|
||||||
|
current_version, current_branch = get_version_from_file()
|
||||||
|
return current_version, 'origin', current_branch
|
||||||
|
|
||||||
# Don't have a way to update exe yet, but don't want to set VERSION to None
|
elif plexpy.FROZEN and common.PLATFORM == 'Darwin':
|
||||||
return 'Windows Install', 'origin', 'master'
|
plexpy.INSTALL_TYPE = 'macos'
|
||||||
|
current_version, current_branch = get_version_from_file()
|
||||||
|
return current_version, 'origin', current_branch
|
||||||
|
|
||||||
elif os.path.isdir(os.path.join(plexpy.PROG_DIR, '.git')):
|
elif os.path.isdir(os.path.join(plexpy.PROG_DIR, '.git')):
|
||||||
|
|
||||||
plexpy.INSTALL_TYPE = 'git'
|
plexpy.INSTALL_TYPE = 'git'
|
||||||
output, err = runGit('rev-parse HEAD')
|
output, err = runGit('rev-parse HEAD')
|
||||||
|
|
||||||
if not output:
|
if not output:
|
||||||
logger.error('Could not find latest installed version.')
|
logger.error('Could not find latest installed version.')
|
||||||
cur_commit_hash = None
|
cur_commit_hash = None
|
||||||
|
else:
|
||||||
cur_commit_hash = str(output)
|
cur_commit_hash = str(output)
|
||||||
|
|
||||||
if not re.match('^[a-z0-9]+$', cur_commit_hash):
|
if not re.match('^[a-z0-9]+$', cur_commit_hash):
|
||||||
logger.error('Output does not look like a hash, not using it.')
|
logger.error('Output does not look like a hash, not using it.')
|
||||||
cur_commit_hash = None
|
cur_commit_hash = None
|
||||||
|
|
||||||
if plexpy.CONFIG.DO_NOT_OVERRIDE_GIT_BRANCH and plexpy.CONFIG.GIT_BRANCH:
|
if plexpy.CONFIG.DO_NOT_OVERRIDE_GIT_BRANCH and plexpy.CONFIG.GIT_BRANCH:
|
||||||
|
remote_name = None
|
||||||
branch_name = plexpy.CONFIG.GIT_BRANCH
|
branch_name = plexpy.CONFIG.GIT_BRANCH
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -126,37 +130,39 @@ def getVersion():
|
||||||
return cur_commit_hash, remote_name, branch_name
|
return cur_commit_hash, remote_name, branch_name
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
plexpy.INSTALL_TYPE = 'docker' if plexpy.DOCKER else 'source'
|
plexpy.INSTALL_TYPE = 'docker' if plexpy.DOCKER else 'source'
|
||||||
|
current_version, current_branch = get_version_from_file()
|
||||||
version_file = os.path.join(plexpy.PROG_DIR, 'version.txt')
|
|
||||||
branch_file = os.path.join(plexpy.PROG_DIR, 'branch.txt')
|
|
||||||
|
|
||||||
if os.path.isfile(version_file):
|
|
||||||
with open(version_file, 'r') as f:
|
|
||||||
current_version = f.read().strip(' \n\r')
|
|
||||||
else:
|
|
||||||
current_version = None
|
|
||||||
|
|
||||||
if os.path.isfile(branch_file):
|
|
||||||
with open(branch_file, 'r') as f:
|
|
||||||
current_branch = f.read().strip(' \n\r')
|
|
||||||
else:
|
|
||||||
current_branch = common.BRANCH
|
|
||||||
|
|
||||||
return current_version, 'origin', current_branch
|
return current_version, 'origin', current_branch
|
||||||
|
|
||||||
|
|
||||||
|
def get_version_from_file():
|
||||||
|
version_file = os.path.join(plexpy.PROG_DIR, 'version.txt')
|
||||||
|
branch_file = os.path.join(plexpy.PROG_DIR, 'branch.txt')
|
||||||
|
|
||||||
|
if os.path.isfile(version_file):
|
||||||
|
with open(version_file, 'r') as f:
|
||||||
|
current_version = f.read().strip(' \n\r')
|
||||||
|
else:
|
||||||
|
current_version = None
|
||||||
|
|
||||||
|
if os.path.isfile(branch_file):
|
||||||
|
with open(branch_file, 'r') as f:
|
||||||
|
current_branch = f.read().strip(' \n\r')
|
||||||
|
else:
|
||||||
|
current_branch = common.BRANCH
|
||||||
|
|
||||||
|
return current_version, current_branch
|
||||||
|
|
||||||
|
|
||||||
def check_update(scheduler=False, notify=False):
|
def check_update(scheduler=False, notify=False):
|
||||||
check_github(scheduler=scheduler, notify=notify)
|
check_github(scheduler=scheduler, notify=notify)
|
||||||
|
|
||||||
if not plexpy.CURRENT_VERSION:
|
if not plexpy.CURRENT_VERSION:
|
||||||
plexpy.UPDATE_AVAILABLE = None
|
plexpy.UPDATE_AVAILABLE = None
|
||||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.common.BRANCH in ('master', 'beta') and \
|
elif plexpy.COMMITS_BEHIND > 0 and (plexpy.common.BRANCH in ('master', 'beta') or plexpy.FROZEN) and \
|
||||||
plexpy.common.RELEASE != plexpy.LATEST_RELEASE:
|
plexpy.common.RELEASE != plexpy.LATEST_RELEASE:
|
||||||
plexpy.UPDATE_AVAILABLE = 'release'
|
plexpy.UPDATE_AVAILABLE = 'release'
|
||||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and \
|
elif plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and not plexpy.FROZEN:
|
||||||
plexpy.INSTALL_TYPE != 'win':
|
|
||||||
plexpy.UPDATE_AVAILABLE = 'commit'
|
plexpy.UPDATE_AVAILABLE = 'commit'
|
||||||
else:
|
else:
|
||||||
plexpy.UPDATE_AVAILABLE = False
|
plexpy.UPDATE_AVAILABLE = False
|
||||||
|
@ -259,8 +265,11 @@ def check_github(scheduler=False, notify=False):
|
||||||
|
|
||||||
|
|
||||||
def update():
|
def update():
|
||||||
if plexpy.INSTALL_TYPE == 'win':
|
if not plexpy.UPDATE_AVAILABLE:
|
||||||
logger.info('Windows .exe updating not supported yet.')
|
return
|
||||||
|
|
||||||
|
if plexpy.INSTALL_TYPE in ('docker', 'windows', 'macos'):
|
||||||
|
return
|
||||||
|
|
||||||
elif plexpy.INSTALL_TYPE == 'git':
|
elif plexpy.INSTALL_TYPE == 'git':
|
||||||
output, err = runGit('pull --ff-only {} {}'.format(plexpy.CONFIG.GIT_REMOTE,
|
output, err = runGit('pull --ff-only {} {}'.format(plexpy.CONFIG.GIT_REMOTE,
|
||||||
|
@ -276,14 +285,11 @@ def update():
|
||||||
elif line.endswith(('Aborting', 'Aborting.')):
|
elif line.endswith(('Aborting', 'Aborting.')):
|
||||||
logger.error('Unable to update from git: ' + line)
|
logger.error('Unable to update from git: ' + line)
|
||||||
|
|
||||||
elif plexpy.INSTALL_TYPE == 'docker':
|
elif plexpy.INSTALL_TYPE == 'source':
|
||||||
return
|
|
||||||
|
|
||||||
else:
|
|
||||||
tar_download_url = 'https://github.com/{}/{}/tarball/{}'.format(plexpy.CONFIG.GIT_USER,
|
tar_download_url = 'https://github.com/{}/{}/tarball/{}'.format(plexpy.CONFIG.GIT_USER,
|
||||||
plexpy.CONFIG.GIT_REPO,
|
plexpy.CONFIG.GIT_REPO,
|
||||||
plexpy.CONFIG.GIT_BRANCH)
|
plexpy.CONFIG.GIT_BRANCH)
|
||||||
update_dir = os.path.join(plexpy.PROG_DIR, 'update')
|
update_dir = os.path.join(plexpy.DATA_DIR, 'update')
|
||||||
version_path = os.path.join(plexpy.PROG_DIR, 'version.txt')
|
version_path = os.path.join(plexpy.PROG_DIR, 'version.txt')
|
||||||
|
|
||||||
logger.info('Downloading update from: ' + tar_download_url)
|
logger.info('Downloading update from: ' + tar_download_url)
|
||||||
|
@ -294,7 +300,7 @@ def update():
|
||||||
return
|
return
|
||||||
|
|
||||||
download_name = plexpy.CONFIG.GIT_BRANCH + '-github'
|
download_name = plexpy.CONFIG.GIT_BRANCH + '-github'
|
||||||
tar_download_path = os.path.join(plexpy.PROG_DIR, download_name)
|
tar_download_path = os.path.join(plexpy.DATA_DIR, download_name)
|
||||||
|
|
||||||
# Save tar to disk
|
# Save tar to disk
|
||||||
with open(tar_download_path, 'wb') as f:
|
with open(tar_download_path, 'wb') as f:
|
||||||
|
|
|
@ -4007,8 +4007,8 @@ class WebInterface(object):
|
||||||
'message': 'Tautulli is up to date.'
|
'message': 'Tautulli is up to date.'
|
||||||
}
|
}
|
||||||
|
|
||||||
if plexpy.DOCKER:
|
if plexpy.DOCKER or plexpy.FROZEN:
|
||||||
update['docker'] = plexpy.DOCKER
|
update['install_type'] = plexpy.INSTALL_TYPE
|
||||||
|
|
||||||
return update
|
return update
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue