wireguard-setup/scripts/is_root_namespace.py

12 lines
240 B
Python
Raw Permalink Normal View History

2024-02-09 19:38:42 +00:00
#!/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)