diff --git a/modules/core/sovran-manage-domains.nix b/modules/core/sovran-manage-domains.nix index 0989c7d..14aa2b7 100644 --- a/modules/core/sovran-manage-domains.nix +++ b/modules/core/sovran-manage-domains.nix @@ -22,17 +22,17 @@ let confirmDomain = name: '' while true; do echo "" - echo -e " ''${YELLOW}You entered:''${NC}" - echo -e " Domain: ''${CYAN}$DOMAIN''${NC}" + printf "%b%s%b\n" "$YELLOW" " You entered:" "$NC" + printf "%b%s%b\n" "$CYAN" " Domain: $DOMAIN" "$NC" if [ -n "''${DDNS_DISPLAY:-}" ]; then - echo -e " DDNS URL: ''${CYAN}$DDNS_DISPLAY''${NC}" + printf "%b%s%b\n" "$CYAN" " DDNS URL: $DDNS_DISPLAY" "$NC" fi echo "" read -p " Is this correct? (y/n): " CONFIRM case "$CONFIRM" in [yY]) echo "$DOMAIN" > "/var/lib/domains/${name}" - echo -e " ''${GREEN}Saved.''${NC}" + printf "%b%s%b\n" "$GREEN" " Saved." "$NC" break ;; [nN]) @@ -53,11 +53,11 @@ let REDO=false DDNS_DISPLAY="" echo "" - echo -e "''${GREEN}── ${d.label} ──''${NC}" + printf "%b%s%b\n" "$GREEN" "── ${d.label} ──" "$NC" EXISTING="" if [ -f "/var/lib/domains/${d.name}" ]; then EXISTING=$(cat "/var/lib/domains/${d.name}") - echo -e " Current: ''${CYAN}$EXISTING''${NC}" + printf "%b%s%b\n" "$CYAN" " Current: $EXISTING" "$NC" fi read -p " Subdomain (e.g. ${d.example}) or Enter to keep current: " DOMAIN_INPUT DOMAIN="''${DOMAIN_INPUT:-$EXISTING}" @@ -91,7 +91,7 @@ $PENDING_NJALLA" REDO=false DDNS_DISPLAY="" echo "" - echo -e "''${GREEN}── ${d.label} (NEW) ──''${NC}" + printf "%b%s%b\n" "$GREEN" "── ${d.label} (NEW) ──" "$NC" read -p " Subdomain (e.g. ${d.example}): " DOMAIN if [ -n "$DOMAIN" ]; then @@ -118,7 +118,7 @@ $PENDING_NJALLA" domainSummary = lib.concatMapStringsSep "\n" (d: '' if [ -f "/var/lib/domains/${d.name}" ]; then - echo " ${d.label}: $(cat /var/lib/domains/${d.name})" + printf "%b%s%b\n" "$NC" " ${d.label}: $(cat /var/lib/domains/${d.name})" "$NC" fi '') domains; @@ -132,18 +132,18 @@ $PENDING_NJALLA" DOLLAR='$' echo "" - echo -e "''${CYAN}══════════════════════════════════════════════''${NC}" - echo -e "''${CYAN} Sovran_SystemsOS — Domain & DDNS Setup''${NC}" - echo -e "''${CYAN}══════════════════════════════════════════════''${NC}" + printf "%b%s%b\n" "$CYAN" "══════════════════════════════════════════════" "$NC" + printf "%b%s%b\n" "$CYAN" " Sovran_SystemsOS — Domain & DDNS Setup" "$NC" + printf "%b%s%b\n" "$CYAN" "══════════════════════════════════════════════" "$NC" echo "" - echo -e "''${YELLOW}Before running this, you need:''${NC}" + printf "%b%s%b\n" "$YELLOW" "Before running this, you need:" "$NC" echo "" echo " 1. Domains/subdomains purchased on https://njal.la" echo " 2. For each subdomain, add a Dynamic record in" echo " your Njal.la dashboard." echo " 3. Njal.la will give you a curl command like:" echo "" - echo -e " ''${CYAN}curl \"https://njal.la/update/?h=sub.domain.com&k=abc123&auto\"''${NC}" + printf "%b%s%b\n" "$CYAN" " curl \"https://njal.la/update/?h=sub.domain.com&k=abc123&auto\"" "$NC" echo "" echo " Have those curl commands ready." echo "" @@ -161,26 +161,26 @@ $PENDING_NJALLA" while [ "$REDO" = true ]; do REDO=false echo "" - echo -e "''${GREEN}── SSL Certificate Email ──''${NC}" + printf "%b%s%b\n" "$GREEN" "── SSL Certificate Email ──" "$NC" echo "Let's Encrypt needs an email for certificate notifications." EXISTING_EMAIL="" if [ -f "/var/lib/domains/sslemail" ]; then EXISTING_EMAIL=$(cat /var/lib/domains/sslemail) - echo -e " Current: ''${CYAN}$EXISTING_EMAIL''${NC}" + printf "%b%s%b\n" "$CYAN" " Current: $EXISTING_EMAIL" "$NC" fi read -p " Email address (or Enter to keep current): " EMAIL_INPUT SSL_EMAIL="''${EMAIL_INPUT:-$EXISTING_EMAIL}" if [ -n "$SSL_EMAIL" ]; then while true; do echo "" - echo -e " ''${YELLOW}You entered:''${NC}" - echo -e " Email: ''${CYAN}$SSL_EMAIL''${NC}" + printf "%b%s%b\n" "$YELLOW" " You entered:" "$NC" + printf "%b%s%b\n" "$CYAN" " Email: $SSL_EMAIL" "$NC" echo "" read -p " Is this correct? (y/n): " CONFIRM case "$CONFIRM" in [yY]) echo "$SSL_EMAIL" > /var/lib/domains/sslemail - echo -e " ''${GREEN}Saved.''${NC}" + printf "%b%s%b\n" "$GREEN" " Saved." "$NC" break ;; [nN]) @@ -201,9 +201,9 @@ $PENDING_NJALLA" # ── Final review ────────────────────────────────── echo "" - echo -e "''${CYAN}══════════════════════════════════════════════''${NC}" - echo -e "''${CYAN} Review All Entries''${NC}" - echo -e "''${CYAN}══════════════════════════════════════════════''${NC}" + printf "%b%s%b\n" "$CYAN" "══════════════════════════════════════════════" "$NC" + printf "%b%s%b\n" "$CYAN" " Review All Entries" "$NC" + printf "%b%s%b\n" "$CYAN" "══════════════════════════════════════════════" "$NC" echo "" echo " Configured domains:" ${domainSummary} @@ -218,14 +218,14 @@ $PENDING_NJALLA" read -p " Does everything look correct? (y/n): " FINAL_CONFIRM if [ "$FINAL_CONFIRM" != "y" ] && [ "$FINAL_CONFIRM" != "Y" ]; then echo "" - echo -e " ''${YELLOW}Setup cancelled. Run 'sudo sovran-setup-domains' to start over.''${NC}" + printf "%b%s%b\n" "$YELLOW" " Setup cancelled. Run 'sudo sovran-setup-domains' to start over." "$NC" echo "" exit 1 fi # ── Write njalla.sh ─────────────────────────────── echo "" - echo -e "''${GREEN}── Generating DDNS script ──''${NC}" + printf "%b%s%b\n" "$GREEN" "── Generating DDNS script ──" "$NC" cat > /var/lib/njalla/njalla.sh <