From ae40f976327daa8b92526142000c2286f15b622f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 23 Aug 2022 23:42:59 +0200 Subject: [PATCH] unet-cli: allow editing remote host domain Signed-off-by: Felix Fietkau --- scripts/unet-cli | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/unet-cli b/scripts/unet-cli index 35dc233..52ec873 100755 --- a/scripts/unet-cli +++ b/scripts/unet-cli @@ -55,6 +55,7 @@ function usage() { " auth_key= use as public auth key on the remote host\n", " priv_key= use as private host key on the remote host (default: generate a new key)\n", " interface= use as interface in /etc/config/network on the remote host\n", + " domain= use as hosts file domain on the remote host (default: unet)\n", " connect=[,...] set IP addresses that the host will contact for network updates\n", " tunnels=:[,...] set active tunnel devices\n", " service options (add-service, set-service):\n", @@ -139,6 +140,7 @@ set_interface_attrs() { [ -n "$AUTH_KEY" ] && uci set "network.$INTERFACE.auth_key=$AUTH_KEY" set_list connect "$CONNECT" set_list tunnels "$TUNNELS" + uci set "network.$INTERFACE.domain=$DOMAIN" } check_interface() { @@ -147,7 +149,6 @@ check_interface() { set network.$INTERFACE=interface set network.$INTERFACE.proto=unet set network.$INTERFACE.device=$INTERFACE -set network.$INTERFACE.domain=unet EOF } @@ -233,6 +234,7 @@ function sync_ssh_host(host) { let connect = replace(args.connect ?? "", ",", " "); let auth_key = args.auth_key; let tunnels = replace(replace(args.tunnels ?? "", ",", " "), ":", "="); + let domain = args.domain ?? "unet"; if (!auth_key) { let fh = fs.mkstemp(); @@ -252,6 +254,7 @@ function sync_ssh_host(host) { fh.write("CONNECT='" + connect + "'\n"); fh.write("AUTH_KEY='" + auth_key + "'\n"); fh.write("TUNNELS='" + tunnels + "'\n"); + fh.write("DOMAIN='" + domain + "'\n"); fh.write(ssh_script); fh.flush(); fh.seek(); -- 2.30.2