post_install() {
    if [ ! -L /usr/share/dump1090/html/data ]; then
        ln -s /var/run/dump1090 /usr/share/dump1090/html/data
    fi

    echo "Internal webserver has been permanently disabled in dump1090"
    echo "To enable lighttpd, copy /usr/share/dump1090/lighttpd.conf to /etc/lighttpd/lighttpd.conf"
    echo "Then run systemctl enable lighttpd && systemctl start lighttpd"
}

pre_remove() {
    systemctl stop dump1090
    systemctl disable dump1090
    unlink /usr/share/dump1090/html/data
}

post_upgrade() {
    post_install
}

