englishtokorea/boot_start.py
2025-05-28 14:26:49 +09:00

23 lines
400 B
Python

import os
import json
routes = json.loads(os.popen("ip -j -4 route").read())
ip=''
for r in routes:
if r.get("dev") == "wlan0" and r.get("prefsrc"):
ip = r['prefsrc']
continue
if ip == "":
print('초기설정')
elif ip == "10.42.0.1":
print('초기설정')
else:
stream = os.popen('sudo nmcli connection up HOTSPOT')
output = stream.read()
print(output)