#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024-present ArchR (https://github.com/archr-linux/Arch-R)

###
### redirects to the quirk device or platform battery_led_status
### 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/battery_led_status" ]; then
  exec "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/battery_led_status" $*
elif [ -f "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/battery_led_status" ]; then
  exec "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/battery_led_status" $*
fi
