#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)

###
### Fan Control now redirects to the quirk device/bin/fancontrol
### so we don't need to have multiple variants in /usr/bin.
###

if [ -z "${QUIRK_DEVICE}" ] || [ -z "${HW_DEVICE}" ]; then
  . /etc/profile
fi

if [ -f "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/fancontrol" ]; then
  exec "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/fancontrol" $*
elif [ -f "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/fancontrol" ]; then
  exec "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/fancontrol" $*
fi
