This commit is contained in:
Zsolt Ero
2024-01-03 22:12:57 +01:00
parent 9059c27707
commit b3ce2bd9dd
4 changed files with 10 additions and 10 deletions

View File

@@ -9,19 +9,19 @@ import requests
def assert_sudo():
if os.geteuid() != 0:
sys.exit('Needs sudo')
sys.exit(' needs sudo')
def assert_linux():
if not Path('/etc/fstab').exists():
sys.exit('Needs to be run on Linux')
sys.exit(' needs to be run on Linux')
def assert_single_process():
p = subprocess.run(['pgrep', '-fl', sys.argv[0]], capture_output=True, text=True)
lines = [l for l in p.stdout.splitlines() if 'python' in l]
if len(lines) >= 2:
sys.exit('Detected multiple processes, terminating')
sys.exit(' detected multiple processes, terminating')
def download_if_size_differs(url: str, local_file: Path) -> bool: