#!/bin/bash
# postinst script for runit-service-spice-vdagent.

set -e

SERVICE1="spice-vdagentd"

case "$1" in
    configure)
	##### GLOBAL SERVICES #####
	if [[ $(ps -p1 | grep -ic "runit") -eq 1 ]]; then
		echo "runit is running as the system's init system - starting service $SERVICE1"
		sv up /etc/sv/$SERVICE1
	fi
	;;

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

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

exit 0
