distribution/packages/sysutils/inject_bl301/scripts/update-bl301.sh

55 lines
1.2 KiB
Bash
Raw Normal View History

2022-02-05 14:23:32 +00:00
#!/bin/sh
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)
#
# Update BL301 injection
#
#####################################################
#
# Comand Line Arguments
# -v = Show verbose output
#
#####################################################
VERBOSE=0
INSTALLED=0
UPDATE=1
RET=0
if [ "$1" = "-v" ]; then
VERBOSE=1
fi
if [ -e /usr/lib/coreelec/check-bl301 ]; then
/usr/lib/coreelec/check-bl301
INSTALLED=${?}
2023-02-24 13:53:43 +00:00
if [ "${INSTALLED}" = 1 ]; then
2022-02-05 14:23:32 +00:00
touch /run/bl301_injected
fi
fi
2023-02-24 13:53:43 +00:00
if [ -e /usr/sbin/inject_bl301 ] && [ "${INSTALLED}" = 1 ]; then
2022-02-05 14:23:32 +00:00
inject_bl301 -Y > /storage/update-bl301.log
UPDATE=${?}
fi
if [ "$VERBOSE" = 1 ]; then
2023-02-24 13:53:43 +00:00
if [ "${INSTALLED}" = 1 ] && [ "$UPDATE" = 0 ]; then
2022-02-05 14:23:32 +00:00
echo "CoreELEC BL301 got updated"
2023-02-24 13:53:43 +00:00
elif [ "${INSTALLED}" = 1 ] && [ "$UPDATE" = 1 ]; then
2022-02-05 14:23:32 +00:00
echo "CoreELEC BL301 installed but no update needed"
2023-02-24 13:53:43 +00:00
elif [ "${INSTALLED}" = 1 ]; then
2022-02-05 14:23:32 +00:00
echo "CoreELEC BL301 installed but error on update: " $UPDATE
RET=$UPDATE
2023-02-24 13:53:43 +00:00
elif [ "${INSTALLED}" = 0 ]; then
2022-02-05 14:23:32 +00:00
echo "CoreELEC BL301 not installed"
fi
fi
2023-02-24 13:53:43 +00:00
if [ "${INSTALLED}" = 1 ] && [ "$UPDATE" = 0 ]; then
2022-02-05 14:23:32 +00:00
sync && reboot
fi
exit $RET