1
0
This repository has been archived on 2024-11-10. You can view files and clone it, but cannot push or open issues or pull requests.

36 lines
735 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
KODI_ROOT=$HOME/.kodi
KODI_ROOT_FAILED=$KODI_ROOT.FAILED
BOOT_STATUS=$HOME/.config/boot.status
process_boot_status()
{
BOOT_STATE="$(cat $BOOT_STATUS 2>/dev/null)"
if [ "${BOOT_STATE}" = "SAFE" ]; then
if [ ! -d $KODI_ROOT_FAILED ]; then
# entering safe mode - rename failed .kodi, and restart with clean .kodi
mv $KODI_ROOT $KODI_ROOT_FAILED
reboot
else
# exiting safe mode - restore failed .kodi
rm -fr $KODI_ROOT
mv $KODI_ROOT_FAILED $KODI_ROOT
echo "OK" > $BOOT_STATUS
fi
else
echo "OK" > $BOOT_STATUS
fi
return 0
}
process_boot_status
exit 0