#!/bin/sh

post_install() {
    dkms add sysdig/${1%%-*}
  cat << EOF
==> To build and install the necessary module run: dkms install sysdig/${1%%-*}
==> To do this automatically at startup run: systemctl enable dkms.service
EOF
}

pre_upgrade() {
    pre_remove "$2"
}

post_upgrade() {
    post_install "$1"
}

pre_remove() {
    [ -n "${1%-*}" ] && dkms remove sysdig/${1%%-*} --all &>/dev/null || true
}
