From da026ad0c3ce6b1ec3523dc3f472137ec06c1cdd Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 26 Sep 2024 08:49:53 -0300 Subject: [PATCH] workbench-script: warn when not root --- workbench-script.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/workbench-script.py b/workbench-script.py index 1fdec4e..e4001a5 100644 --- a/workbench-script.py +++ b/workbench-script.py @@ -227,6 +227,8 @@ def smartctl(all_disks, disk=None): ## End Command Functions ## +# TODO permitir selección +# TODO permitir que vaya más rápido def get_data(all_disks): lshw = 'sudo lshw -json' hwinfo = 'sudo hwinfo --reallyall' @@ -341,6 +343,11 @@ def main(): config = load_config(config_file) + # TODO show warning if non root, means data is not complete + # if annotate as potentially invalid snapshot (pending the new API to be done) + if os.geteuid() != 0: + print("workbench: WARNING: This script must be run as root. Collected data will be incomplete or unusable") + all_disks = get_disks() snapshot = gen_snapshot(all_disks)