Development

This commit is contained in:
Matthew Grotke 2026-05-26 00:16:26 -04:00
parent 3729ecfa76
commit c7d1231714

View file

@ -10,6 +10,7 @@ Usage:
sudo python3 install.py
"""
import argparse
import os
import re
import secrets
@ -19,6 +20,8 @@ import subprocess
import sys
from pathlib import Path
AUTO_YES = False
SCRIPT_DIR = Path(__file__).parent.resolve()
COMPOSE_FILE = SCRIPT_DIR.parent / "docker" / "routlin-dash" / "docker-compose.yml"
CADDYFILE = Path("/etc/caddy/Caddyfile")
@ -71,6 +74,10 @@ def check_root():
def prompt_yn(question, default=None):
"""Prompt for yes/no. default: 'y', 'n', or None (require explicit answer)."""
if AUTO_YES:
choice = (default == "y") if default else True
print(f" {question} [auto: {'y' if choice else 'n'}]")
return choice
hint = {None: "[y/n]", "y": "[Y/n]", "n": "[y/N]"}[default]
while True:
ans = input(f" {question} {hint}: ").strip().lower()
@ -535,6 +542,13 @@ def _lan_ip():
# ===================================================================
def main():
global AUTO_YES
parser = argparse.ArgumentParser(description="Routlin setup wizard.")
parser.add_argument('-y', '--yes', action='store_true',
help='Auto-accept all yes/no prompts using their defaults.')
args = parser.parse_args()
AUTO_YES = args.yes
check_root()
print()