#!/bin/sh

exec 2>&1

# if avahi is present, exit if it hasn't yet started
if [ -f /etc/init.d/avahi-daemon ]; then
    /etc/init.d/avahi-daemon status > /dev/null || exit 1
fi

# Ensure middlewared is running (if available)
sv start middlewared

# Stop if we are not on STFT and have an HTC distribution installed
if [[ $HOSTNAME != "stft" && -f /usr/local/htc/manifest.txt ]]; then
      exit 1
fi

exec /usr/bin/htcidentityd
