feat: verify we are root

This commit is contained in:
timeshifter
2023-05-31 15:40:42 +02:00
parent b94d46366a
commit fb95159f32
+8
View File
@@ -3,6 +3,7 @@
from __future__ import annotations from __future__ import annotations
from functools import lru_cache from functools import lru_cache
from os import geteuid
from pathlib import Path from pathlib import Path
from subprocess import call, check_output from subprocess import call, check_output
from datetime import datetime from datetime import datetime
@@ -14,6 +15,9 @@ KEEP_DAYS = 3
def main(): def main():
if not are_we_root():
print("we must be root")
exit(1)
setup_logger() setup_logger()
build_images() build_images()
update_containers() update_containers()
@@ -149,6 +153,10 @@ def setup_logger() -> None:
logging.info('set up logger') logging.info('set up logger')
def are_we_root() -> bool:
return geteuid() == 0
if __name__ == "__main__": if __name__ == "__main__":
main() main()