#!/bin/bash

post_install() {
    mkdir -p /etc/dropbear
    touch /etc/dropbear/root_key
    chmod 600 /etc/dropbear/root_key

    cat<<INSTALLEOF
    Insert your SSH public key into "/etc/dropbear/root_key", e.g. using
    "cat ~/.ssh/id_rsa.pub > /etc/dropbear/root_key". 
    
    Afterwards add the "dropbear" hook after any networking hook (netconf/ppp)
    and before any hook provided with the mkinitcpio-utils package in the
    "HOOKS" array in "/etc/mkinitcpio.conf". Finally rebuild the initramsfs
    ("mkinitcpio -p linux").
INSTALLEOF
}

post_remove() {
    cat<<REMOVEEOF
    Remove "dropbear" from "HOOKS" in "/etc/mkinitcpio.conf", then rebuild
    the initramfs ("mkinitcpio -p linux").
REMOVEEOF
}

post_upgrade() {
    post_install
}
