2023-10-14 22:38:14 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
describe="setup ssh"
|
|
|
|
|
2025-01-12 18:52:10 +01:00
|
|
|
apply() {
|
2023-10-14 22:38:14 +02:00
|
|
|
[ -e "$HOME/.ssh/authorized_keys" ] || ln files/authorized_keys $HOME/.ssh/authorized_keys
|
2025-01-12 18:52:10 +01:00
|
|
|
[ -e "$HOME/.ssh/config" ] || ln files/config $HOME/.ssh/config
|
2023-10-14 22:38:14 +02:00
|
|
|
if ! [ -f "$HOME/.ssh/id_rsa" ]; then
|
|
|
|
echo "Creating new ssh key for this device..."
|
|
|
|
ssh-keygen -f $HOME/.ssh/id_rsa -p "" -q
|
|
|
|
echo "Adding key to authorized_keys..."
|
|
|
|
cat $HOME/.ssh/id_rsa.pub > $HOME/.ssh/authorized_keys
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
undo() {
|
|
|
|
echo "Undoing ssh keys is not supported, please do this manually."
|
2025-01-12 18:52:10 +01:00
|
|
|
}
|