Introduce new uci-default functions:
     - ucidef_set_root_password [password hash/cleartext]
     - ucidef_set_ssh_authorized_key [ssh key]

Signed-off-by: John Crispin <j...@phrozen.org>
---
 .../base-files/files/lib/functions/uci-defaults.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh 
b/package/base-files/files/lib/functions/uci-defaults.sh
index ba7288c2c6..bcc78220cc 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -677,6 +677,20 @@ ucidef_set_country() {
        json_select ..
 }
 
+ucidef_set_root_password() {
+       local passwd="$1"
+       json_select_object credentials
+               json_add_string root_password "$passwd"
+       json_select ..
+}
+
+ucidef_set_ssh_authorized_key() {
+       local ssh_key="$1"
+       json_select_object credentials
+               json_add_string ssh_authorized_key "$ssh_key"
+       json_select ..
+}
+
 ucidef_set_ntpserver() {
        local server
 
-- 
2.34.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to