distribution/packages/sysutils/systemd/scripts/userconfig-setup

67 lines
2.7 KiB
Text
Raw Normal View History

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)
# Copyright (C) 2022-present Fewtarius
2022-02-05 14:23:32 +00:00
2022-03-28 21:47:29 +00:00
. /etc/profile
2022-02-28 21:36:40 +00:00
if [ ! -e "/storage/.configured" ]
then
tocon "Initializing configuration..."
2022-02-28 21:36:40 +00:00
# Copy config files, but don't overwrite. Only run if /storage is fresh
rsync -a --ignore-existing --exclude={es_features.cfg,es_systems.cfg} /usr/config/* /storage/.config/ >/var/log/configure.log 2>&1
if [ -d "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/config" ]
then
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
fi
if [ -e "/usr/bin/emulationstation" ]
then
tocon "Installing themes..."
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
### Link the game controller database so it is managed with OS updates.
tocon "Configuring controller database..."
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
### Remove and link es configs so they are managed with OS updates.
for es_cfg in es_features.cfg es_systems.cfg
do
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg} >/dev/null 2>&1
done
fi
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
if [ ! -e "/storage/.cache/ld.so.cache" ]
then
tocon "Initializing library cache..."
### Create library cache
ldconfig -X >/dev/null 2>&1
fi
if [ ! -d "/storage/.config/locale" ]
then
tocon "Initializing language support..."
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" ] &&
[ -e "/usr/bin/emulationstation" ]
then
rm -rf /storage/.config/emulationstation/locale >/dev/null 2>&1 ||:
ln -sf /usr/share/locale /storage/.config/emulationstation/locale
fi
fi