Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(diagnostics): OS name without further release files #1703

Merged
merged 3 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 17 additions & 12 deletions common/backintime.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,14 @@ def createParsers(app_name = 'backintime'):
arg = '-%s' % alias
else:
arg = '--%s' % alias

group.add_argument(arg,
nargs = nargs,
action = PseudoAliasAction,
help = argparse.SUPPRESS)
nargs=nargs,
action=PseudoAliasAction,
help=argparse.SUPPRESS)


def startApp(app_name = 'backintime'):
def startApp(app_name='backintime'):
"""
Start the requested command or return config if there was no command
in arguments.
Expand All @@ -507,21 +509,22 @@ def startApp(app_name = 'backintime'):
args = argParse(None)

# Name, Version, As Root, OS
diag = collect_minimal_diagnostics()
logger.debug(
f'{diag["backintime"]} {list(diag["host-setup"]["OS"].values())}')
for key, val in collect_minimal_diagnostics().items():
logger.debug(f'{key}: {val}')

# Add source path to $PATH environ if running from source
if tools.runningFromSource():
tools.addSourceToPathEnviron()

# Warn about sudo
if tools.usingSudo() and os.getenv('BIT_SUDO_WARNING_PRINTED', 'false') == 'false':
if (tools.usingSudo()
and os.getenv('BIT_SUDO_WARNING_PRINTED', 'false') == 'false'):

os.putenv('BIT_SUDO_WARNING_PRINTED', 'true')
logger.warning("It looks like you're using 'sudo' to start %(app)s. "
"This will cause some trouble. Please use either 'sudo -i %(app_name)s' "
"or 'pkexec %(app_name)s'."
%{'app_name': app_name, 'app': config.Config.APP_NAME})
logger.warning(
"It looks like you're using 'sudo' to start "
f"{config.Config.APP_NAME}. This will cause some trouble. "
f"Please use either 'sudo -i {app_name}' or 'pkexec {app_name}'.")

# Call commands
if 'func' in dir(args):
Expand All @@ -530,8 +533,10 @@ def startApp(app_name = 'backintime'):
else:
setQuiet(args)
printHeader()

return getConfig(args, False)


def argParse(args):
"""
Parse arguments given on commandline.
Expand Down
8 changes: 8 additions & 0 deletions common/diagnostics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# SPDX-FileCopyrightText: © 2022 Christian BUHTZ <c.buhtz@posteo.jp>
# SPDX-FileCopyrightText: © 2022 Jürgen Altfeld <python@altfeld-im.de>
buhtz marked this conversation as resolved.
Show resolved Hide resolved
#
# SPDX-License-Identifier: GPL-2.0
#
# This file is part of the program "Back In time" which is released under GNU
# General Public License v2 (GPLv2).
# See file LICENSE or go to <https://www.gnu.org/licenses/#GPL>.
"""Provides the ability to collect diagnostic information on Back In Time.

These are version numbers of the dependent tools, environment variables,
Expand Down