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:
|
||||
plexpy.DATA_DIR = args.datadir
|
||||
elif plexpy.FROZEN:
|
||||
plexpy.DATA_DIR = appdirs.user_data_dir("Tautulli", "Tautulli")
|
||||
plexpy.DATA_DIR = appdirs.user_data_dir("Tautulli", False)
|
||||
else:
|
||||
plexpy.DATA_DIR = plexpy.PROG_DIR
|
||||
|
||||
|
@ -268,8 +268,11 @@ def main():
|
|||
plexpy.shutdown(restart=True, checkout=True)
|
||||
elif plexpy.SIGNAL == 'reset':
|
||||
plexpy.shutdown(restart=True, reset=True)
|
||||
else:
|
||||
elif plexpy.SIGNAL == 'update':
|
||||
plexpy.shutdown(restart=True, update=True)
|
||||
else:
|
||||
logger.error('Unknown signal. Shutting down...')
|
||||
plexpy.shutdown()
|
||||
|
||||
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 />' +
|
||||
'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>';
|
||||
} 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 {
|
||||
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
|
||||
# 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.
|
||||
# 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.
|
||||
if CURRENT_VERSION:
|
||||
try:
|
||||
|
@ -2210,9 +2210,6 @@ def shutdown(restart=False, update=False, checkout=False, reset=False):
|
|||
|
||||
CONFIG.write()
|
||||
|
||||
if not restart and not update and not checkout:
|
||||
logger.info("Tautulli is shutting down...")
|
||||
|
||||
if update:
|
||||
logger.info("Tautulli is updating...")
|
||||
try:
|
||||
|
@ -2255,25 +2252,23 @@ def shutdown(restart=False, update=False, checkout=False, reset=False):
|
|||
|
||||
# Separate out logger so we can shutdown logger after
|
||||
if NOFORK:
|
||||
logger.info('Running as service, not forking. Exiting...')
|
||||
elif os.name == 'nt':
|
||||
logger.info('Restarting Tautulli with %s', args)
|
||||
logger.info("Running as service, not forking. Exiting...")
|
||||
else:
|
||||
logger.info('Restarting Tautulli with %s', args)
|
||||
|
||||
logger.shutdown()
|
||||
logger.info("Restarting Tautulli with %s", args)
|
||||
|
||||
# os.execv fails with spaced names on Windows
|
||||
# https://bugs.python.org/issue19066
|
||||
if NOFORK:
|
||||
pass
|
||||
elif os.name == 'nt':
|
||||
elif common.PLATFORM == 'Windows':
|
||||
subprocess.Popen(args, cwd=os.getcwd())
|
||||
else:
|
||||
os.execv(exe, args)
|
||||
|
||||
else:
|
||||
logger.shutdown()
|
||||
logger.info("Tautulli is shutting down...")
|
||||
|
||||
logger.shutdown()
|
||||
|
||||
os._exit(0)
|
||||
|
||||
|
@ -2331,7 +2326,7 @@ def check_folder_writable(folder, fallback, name):
|
|||
os.makedirs(folder)
|
||||
except OSError as 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))
|
||||
return check_folder_writable(None, fallback, name)
|
||||
else:
|
||||
|
@ -2339,7 +2334,7 @@ def check_folder_writable(folder, fallback, name):
|
|||
|
||||
if not os.access(folder, os.W_OK):
|
||||
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))
|
||||
return check_folder_writable(None, fallback, name)
|
||||
else:
|
||||
|
|
|
@ -72,33 +72,37 @@ def runGit(args):
|
|||
elif output:
|
||||
break
|
||||
|
||||
return (output, err)
|
||||
return output, err
|
||||
|
||||
|
||||
def getVersion():
|
||||
def get_version():
|
||||
|
||||
if common.BRANCH.startswith('win32build'):
|
||||
plexpy.INSTALL_TYPE = 'win'
|
||||
if plexpy.FROZEN and common.PLATFORM == 'Windows':
|
||||
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
|
||||
return 'Windows Install', 'origin', 'master'
|
||||
elif plexpy.FROZEN and common.PLATFORM == 'Darwin':
|
||||
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')):
|
||||
|
||||
plexpy.INSTALL_TYPE = 'git'
|
||||
output, err = runGit('rev-parse HEAD')
|
||||
|
||||
if not output:
|
||||
logger.error('Could not find latest installed version.')
|
||||
cur_commit_hash = None
|
||||
|
||||
cur_commit_hash = str(output)
|
||||
else:
|
||||
cur_commit_hash = str(output)
|
||||
|
||||
if not re.match('^[a-z0-9]+$', cur_commit_hash):
|
||||
logger.error('Output does not look like a hash, not using it.')
|
||||
cur_commit_hash = None
|
||||
|
||||
if plexpy.CONFIG.DO_NOT_OVERRIDE_GIT_BRANCH and plexpy.CONFIG.GIT_BRANCH:
|
||||
remote_name = None
|
||||
branch_name = plexpy.CONFIG.GIT_BRANCH
|
||||
|
||||
else:
|
||||
|
@ -126,37 +130,39 @@ def getVersion():
|
|||
return cur_commit_hash, remote_name, branch_name
|
||||
|
||||
else:
|
||||
|
||||
plexpy.INSTALL_TYPE = 'docker' if plexpy.DOCKER else 'source'
|
||||
|
||||
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
|
||||
|
||||
current_version, current_branch = get_version_from_file()
|
||||
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):
|
||||
check_github(scheduler=scheduler, notify=notify)
|
||||
|
||||
if not plexpy.CURRENT_VERSION:
|
||||
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.UPDATE_AVAILABLE = 'release'
|
||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and \
|
||||
plexpy.INSTALL_TYPE != 'win':
|
||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and not plexpy.FROZEN:
|
||||
plexpy.UPDATE_AVAILABLE = 'commit'
|
||||
else:
|
||||
plexpy.UPDATE_AVAILABLE = False
|
||||
|
@ -259,8 +265,11 @@ def check_github(scheduler=False, notify=False):
|
|||
|
||||
|
||||
def update():
|
||||
if plexpy.INSTALL_TYPE == 'win':
|
||||
logger.info('Windows .exe updating not supported yet.')
|
||||
if not plexpy.UPDATE_AVAILABLE:
|
||||
return
|
||||
|
||||
if plexpy.INSTALL_TYPE in ('docker', 'windows', 'macos'):
|
||||
return
|
||||
|
||||
elif plexpy.INSTALL_TYPE == 'git':
|
||||
output, err = runGit('pull --ff-only {} {}'.format(plexpy.CONFIG.GIT_REMOTE,
|
||||
|
@ -276,14 +285,11 @@ def update():
|
|||
elif line.endswith(('Aborting', 'Aborting.')):
|
||||
logger.error('Unable to update from git: ' + line)
|
||||
|
||||
elif plexpy.INSTALL_TYPE == 'docker':
|
||||
return
|
||||
|
||||
else:
|
||||
elif plexpy.INSTALL_TYPE == 'source':
|
||||
tar_download_url = 'https://github.com/{}/{}/tarball/{}'.format(plexpy.CONFIG.GIT_USER,
|
||||
plexpy.CONFIG.GIT_REPO,
|
||||
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')
|
||||
|
||||
logger.info('Downloading update from: ' + tar_download_url)
|
||||
|
@ -294,7 +300,7 @@ def update():
|
|||
return
|
||||
|
||||
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
|
||||
with open(tar_download_path, 'wb') as f:
|
||||
|
|
|
@ -4007,8 +4007,8 @@ class WebInterface(object):
|
|||
'message': 'Tautulli is up to date.'
|
||||
}
|
||||
|
||||
if plexpy.DOCKER:
|
||||
update['docker'] = plexpy.DOCKER
|
||||
if plexpy.DOCKER or plexpy.FROZEN:
|
||||
update['install_type'] = plexpy.INSTALL_TYPE
|
||||
|
||||
return update
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue