2022-03-28 21:47:29 +00:00
|
|
|
#!/bin/bash
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
2022-05-18 11:25:39 +00:00
|
|
|
# Copyright (C) 2022-present Fewtarius
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2023-09-05 11:46:24 +00:00
|
|
|
. /etc/profile.d/001-functions
|
2022-02-28 21:36:40 +00:00
|
|
|
|
|
|
|
if [ ! -e "/storage/.configured" ]
|
|
|
|
then
|
2023-04-22 20:01:07 +00:00
|
|
|
tocon "Initializing configuration..."
|
2022-02-28 21:36:40 +00:00
|
|
|
# Copy config files, but don't overwrite. Only run if /storage is fresh
|
2023-05-26 09:25:08 +00:00
|
|
|
rsync -a --ignore-existing --exclude={es_features.cfg,es_systems.cfg} /usr/config/* /storage/.config/ >/var/log/configure.log 2>&1
|
2022-08-31 21:50:23 +00:00
|
|
|
|
2023-07-25 21:06:19 +00:00
|
|
|
if [ -d "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/config" ]
|
2023-07-01 18:46:51 +00:00
|
|
|
then
|
2023-07-25 21:06:19 +00:00
|
|
|
rsync -a --exclude={es_features.cfg,es_systems.cfg} /usr/lib/autostart/quirks/platforms/"${HW_DEVICE}"/config/* /storage/.config/ >>/var/log/configure.log 2>&1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/config" ]
|
|
|
|
then
|
|
|
|
rsync -a --exclude={es_features.cfg,es_systems.cfg} /usr/lib/autostart/quirks/devices/"${QUIRK_DEVICE}"/config/* /storage/.config/ >>/var/log/configure.log 2>&1
|
2023-07-01 18:46:51 +00:00
|
|
|
fi
|
|
|
|
|
2023-04-21 21:40:02 +00:00
|
|
|
if [ -e "/usr/bin/emulationstation" ]
|
|
|
|
then
|
2023-04-22 20:01:07 +00:00
|
|
|
tocon "Installing themes..."
|
2023-04-28 12:16:27 +00:00
|
|
|
mkdir -p /storage/.config/emulationstation/themes >/dev/null
|
|
|
|
ln -s /usr/share/themes/es-theme-art-book-next /storage/.config/emulationstation/themes/system-theme >/dev/null 2>&1
|
|
|
|
ln -s /usr/share/themes/es-theme-minielec /storage/.config/emulationstation/themes/es-theme-minielec >/dev/null 2>&1
|
|
|
|
ln -s /usr/share/themes/es-theme-minimal /storage/.config/emulationstation/themes/es-theme-minimal >/dev/null 2>&1
|
2023-04-21 21:40:02 +00:00
|
|
|
|
|
|
|
### Link the game controller database so it is managed with OS updates.
|
2023-04-22 20:01:07 +00:00
|
|
|
tocon "Configuring controller database..."
|
2023-04-28 12:16:27 +00:00
|
|
|
rm -f /storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt >/dev/null 2>&1
|
|
|
|
ln -s /usr/config/SDL-GameControllerDB/gamecontrollerdb.txt /storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt >/dev/null 2>&1
|
2023-04-21 21:40:02 +00:00
|
|
|
|
|
|
|
### Remove and link es configs so they are managed with OS updates.
|
|
|
|
for es_cfg in es_features.cfg es_systems.cfg
|
|
|
|
do
|
2023-04-28 12:16:27 +00:00
|
|
|
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg} >/dev/null 2>&1
|
2023-04-21 21:40:02 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
fi
|
2023-04-28 12:16:27 +00:00
|
|
|
mkdir -p /storage/.config/modprobe.d >/dev/null 2>&1
|
|
|
|
touch /storage/.configured >/dev/null 2>&1
|
2022-02-28 21:36:40 +00:00
|
|
|
fi
|
2022-04-14 09:59:09 +00:00
|
|
|
|
2022-07-31 15:12:57 +00:00
|
|
|
if [ ! -e "/storage/.cache/ld.so.cache" ]
|
|
|
|
then
|
2023-04-22 20:01:07 +00:00
|
|
|
tocon "Initializing library cache..."
|
2022-07-31 15:12:57 +00:00
|
|
|
### Create library cache
|
2023-04-28 12:16:27 +00:00
|
|
|
ldconfig -X >/dev/null 2>&1
|
2022-07-31 15:12:57 +00:00
|
|
|
fi
|
|
|
|
|
2023-04-24 16:19:57 +00:00
|
|
|
if [ ! -d "/storage/.config/locale" ]
|
2022-04-14 09:59:09 +00:00
|
|
|
then
|
2023-04-22 20:01:07 +00:00
|
|
|
tocon "Initializing language support..."
|
2023-04-28 12:16:27 +00:00
|
|
|
rsync -a --delete /usr/config/locale/* /storage/.config/locale/ >/dev/null 2>&1
|
2023-04-28 16:08:40 +00:00
|
|
|
if [ ! -L "/storage/.config/emulationstation/locale" ] &&
|
2023-04-24 16:19:57 +00:00
|
|
|
[ -e "/usr/bin/emulationstation" ]
|
|
|
|
then
|
2023-04-28 12:16:27 +00:00
|
|
|
rm -rf /storage/.config/emulationstation/locale >/dev/null 2>&1 ||:
|
2023-04-24 16:19:57 +00:00
|
|
|
ln -sf /usr/share/locale /storage/.config/emulationstation/locale
|
|
|
|
fi
|
2022-04-14 09:59:09 +00:00
|
|
|
fi
|