automatically trim keys (#165)

This commit is contained in:
MicroBlock 2023-09-14 22:28:25 +08:00 committed by GitHub
parent d52253d559
commit b8a97173e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,9 +40,11 @@ makeConf() {
networking.hostName = "$(hostname -s)";
networking.domain = "$(hostname -d)";
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [$(while read -r line; do echo -n "
''$line'' "; done <<< "$keys")
];
users.users.root.openssh.authorizedKeys.keys = [$(while read -r line; do
line=$(echo -n "$line" | sed 's/\r//g')
trimmed_line=$(echo -n "$line" | tr -d '[:space:]')
echo -n "''$trimmed_line'' "
done <<< "$keys")];
}
EOF