#!/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."
}