dotfiles/crates/01-ssh/crate.sh

17 lines
487 B
Bash
Raw Normal View History

2023-10-14 22:38:14 +02:00
#!/bin/sh
describe="setup ssh"
apply() {
[ -e "$HOME/.ssh/authorized_keys" ] || ln files/authorized_keys $HOME/.ssh/authorized_keys
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."
}