workbench-script: warn when not root

This commit is contained in:
pedro 2024-09-26 08:49:53 -03:00
parent fa4758fdf6
commit da026ad0c3

View file

@ -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)