workbench-script: warn when not root
This commit is contained in:
parent
d756a3a9be
commit
044f3b9e4b
|
@ -227,6 +227,8 @@ def smartctl(all_disks, disk=None):
|
||||||
## End Command Functions ##
|
## End Command Functions ##
|
||||||
|
|
||||||
|
|
||||||
|
# TODO permitir selección
|
||||||
|
# TODO permitir que vaya más rápido
|
||||||
def get_data(all_disks):
|
def get_data(all_disks):
|
||||||
lshw = 'sudo lshw -json'
|
lshw = 'sudo lshw -json'
|
||||||
hwinfo = 'sudo hwinfo --reallyall'
|
hwinfo = 'sudo hwinfo --reallyall'
|
||||||
|
@ -341,6 +343,11 @@ def main():
|
||||||
|
|
||||||
config = load_config(config_file)
|
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()
|
all_disks = get_disks()
|
||||||
snapshot = gen_snapshot(all_disks)
|
snapshot = gen_snapshot(all_disks)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue