wireguard-setup/scripts/is_root_namespace.py
2024-02-09 20:38:42 +01:00

12 lines
240 B
Python

#!/usr/bin/env python3
import sys
import re
with open("/proc/self/net/dev", "r") as f:
data = f.read()
match = re.search("^enp[0-9a-z]+:", data, re.MULTILINE)
if match is None:
sys.exit(1)
else:
sys.exit(0)