conversion to app and configmanager part 2 export still missing
This commit is contained in:
11
start_wg.py
11
start_wg.py
@ -3,17 +3,16 @@
|
||||
This script belongs to wirepy and is for the auto start of the tunnel
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
from subprocess import CompletedProcess
|
||||
from wp_app_config import AppConfig
|
||||
from common_tools import ConfigManager
|
||||
|
||||
path_to_file = Path(Path.home() / ".config/wire_py/settings")
|
||||
ConfigManager.init(AppConfig.SETTINGS_FILE)
|
||||
|
||||
a_con = Path(path_to_file).read_text(encoding="utf-8").splitlines(keepends=True)
|
||||
a_con = a_con[7].strip()
|
||||
if a_con != "off":
|
||||
if ConfigManager.get("autostart") != "off":
|
||||
process: CompletedProcess[str] = subprocess.run(
|
||||
["nmcli", "connection", "up", a_con],
|
||||
["nmcli", "connection", "up", ConfigManager.get("autostart")],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
|
Reference in New Issue
Block a user