diff --git a/setup.sh b/setup.sh index 2cabc9d..f7b74ed 100644 --- a/setup.sh +++ b/setup.sh @@ -809,6 +809,17 @@ function ensure_ip_in_kcl () { yq -i '.Kernel.CommandLine = "'"${new_kcl}"'"' "${zbm_config}" } +function set_pub_keys () { + local authorized_keys_file raw_pub_keys + authorized_keys_file="${1:?}" + raw_pub_keys="${2:?}" + :> "${authorized_keys_file}" + while IFS= read -r pub_key_line; do + printf -- '%s\n' "${pub_key_line}" >> "${authorized_keys_file}" + done < <(<<<"${raw_pub_keys}" sed -r -e 's/,,/\n/g') + sed -i '/^$/d' "${authorized_keys_file}" +} + function we_want_ssh () { #2.10 if [[ "${ARCHZBM_NET_CLIENT_IP}" ]] || \