#!/bin/sh
set -e

case "$1" in
    configure)
        # Check if the second argument (previous version) is completely empty
        if [ -z "$2" ]; then
            # Fresh installation only
            if [ -x /usr/lib/audio_selector/create_service ]; then
                /usr/lib/audio_selector/create_service -l
            fi
        else
            [ -d /service/librespot ] && svc -r /service/librespot
        fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0
