refactor(warp): Replace bash installer with python script

Integrates the new `warp.py` script into the installation and uninstallation workflows. This refactors the `install.py` and `uninstall.py` scripts to call the local Python-based WARP manager instead of downloading and executing an external bash script.
This commit is contained in:
ReturnFI
2025-11-21 08:28:54 +00:00
parent 264eff9578
commit e5a0fc467e
3 changed files with 412 additions and 8 deletions

View File

@ -13,6 +13,7 @@ if str(core_scripts_dir) not in sys.path:
from paths import CONFIG_FILE, CLI_PATH
WARP_SCRIPT_PATH = Path(__file__).resolve().parent / "warp.py"
TEMP_CONFIG = Path("/etc/hysteria/config_temp.json")
@ -20,10 +21,6 @@ def systemctl_active(service: str) -> bool:
return subprocess.run(["systemctl", "is-active", "--quiet", service]).returncode == 0
def run_shell(command: str):
subprocess.run(command, shell=True, check=False)
def load_config(path: Path):
if path.exists():
with path.open("r", encoding="utf-8") as f:
@ -99,7 +96,7 @@ def restart_hysteria():
def main():
if systemctl_active("wg-quick@wgcf.service"):
print("🧹 Uninstalling WARP...")
run_shell('bash -c "bash <(curl -fsSL https://raw.githubusercontent.com/ReturnFI/Warp/main/warp.sh) dwg"')
subprocess.run([sys.executable, str(WARP_SCRIPT_PATH), "uninstall"])
config = load_config(CONFIG_FILE)
if config:
config = reset_acl_inline(config)
@ -114,4 +111,4 @@ def main():
if __name__ == "__main__":
main()
main()