feat: verify we are root
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import lru_cache
|
||||
from os import geteuid
|
||||
from pathlib import Path
|
||||
from subprocess import call, check_output
|
||||
from datetime import datetime
|
||||
@@ -14,6 +15,9 @@ KEEP_DAYS = 3
|
||||
|
||||
|
||||
def main():
|
||||
if not are_we_root():
|
||||
print("we must be root")
|
||||
exit(1)
|
||||
setup_logger()
|
||||
build_images()
|
||||
update_containers()
|
||||
@@ -149,6 +153,10 @@ def setup_logger() -> None:
|
||||
logging.info('set up logger')
|
||||
|
||||
|
||||
def are_we_root() -> bool:
|
||||
return geteuid() == 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user