This commit is contained in:
pikus 2026-03-20 23:34:16 +03:00
parent d8b70cf993
commit 7618902486

View File

@ -229,7 +229,7 @@ async def main():
with open(cfg["script"], "w") as f:
f.write(
f'#!/bin/bash\n\n'
f'if ! ip rule list | grep -q "lookup {cfg["table"]}.*priority {cfg["priority"]}"; then\n'
f'if ! ip rule list | grep -q "lookup {cfg["table"]}"; then\n'
f' ip rule add table {cfg["table"]} priority {cfg["priority"]}\n'
f'fi\n\n'
f'ip route flush table {cfg["table"]}\n\n'
@ -253,7 +253,7 @@ async def main():
f.write(
f'#!/bin/bash\n\n'
f'ip route flush table {cfg["table"]}\n'
f'ip rule del table {cfg["table"]} priority {cfg["priority"]} 2>/dev/null\n'
f'ip rule del table {cfg["table"]} 2>/dev/null\n'
)
os.chmod(cfg["rollback_script"], 0o755)