add ssh key setup, disable debug

This commit is contained in:
askiiart 2025-06-16 00:37:06 -05:00
parent 419bff5577
commit 5f44878060
Signed by untrusted user who does not match committer: askiiart
GPG key ID: 6A32977DAF31746A

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -euxo pipefail
set -euo pipefail
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
if [ $(whoami) -ne "root"]; then
@ -70,3 +70,11 @@ if ! $(pdbedit -L -v | grep -q "Unix username: .*$smb_user"); then
read -p "Enter the SMB password at the prompt - press enter to continue"
smbpasswd -a $smb_user
fi
IFS=$'\n'
for key in $(jq '."ssh-keys"[]?' $SCRIPT_DIR/data.json -r); do
if ! grep -q "$key" $HOME/.ssh/authorized_keys; then
echo "$key" | tee -a $HOME/.ssh/authorized_keys
fi
done
unset IFS