2022-03-16 22:03:28 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
|
|
|
|
|
|
|
|
. /etc/profile
|
|
|
|
|
2022-11-01 11:55:34 +00:00
|
|
|
LOG="/var/log/boot.log"
|
|
|
|
|
2022-03-28 23:53:26 +00:00
|
|
|
### This script contains items that we only want to execute after a JELOS upgrade,
|
|
|
|
### or after a fresh installation.
|
|
|
|
|
2023-04-23 00:19:52 +00:00
|
|
|
### Items in this block should always run after updates.
|
|
|
|
################################################################################
|
|
|
|
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Rebuild library cache..." >>${LOG}
|
2022-07-31 15:12:57 +00:00
|
|
|
### Rebuild the library cache
|
|
|
|
rm -f /storage/.cache/ld.so.cache
|
|
|
|
ldconfig -X
|
|
|
|
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Sync configuration files..." >>${LOG}
|
2022-08-03 11:46:37 +00:00
|
|
|
### Sync configurations
|
2022-03-28 23:53:26 +00:00
|
|
|
if [ -d "/storage/.config/system/configs" ]
|
|
|
|
then
|
|
|
|
EXCLUDE="--exclude=configs"
|
|
|
|
fi
|
|
|
|
|
2023-05-26 09:25:08 +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
|
|
|
|
mv /storage/.config/emulationstation/${es_cfg} /storage/.config/emulationstation/last_${es_cfg} >/dev/null 2>&1
|
|
|
|
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg} >/dev/null 2>&1
|
|
|
|
done
|
|
|
|
|
2022-09-16 02:34:00 +00:00
|
|
|
rsync -a --delete ${EXCLUDE} /usr/config/system/ /storage/.config/system/
|
|
|
|
rsync -a --ignore-existing /usr/config/game /storage/.config/
|
|
|
|
rsync -a /usr/config/modules /storage/.config/
|
2022-03-28 23:53:26 +00:00
|
|
|
|
2023-07-24 22:32:28 +00:00
|
|
|
if [ -f "/storage/.config/emulationstation/resources/logo.png" ]
|
|
|
|
then
|
|
|
|
rm -f /storage/.config/emulationstation/resources/logo.png
|
|
|
|
fi
|
|
|
|
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Sync modules..." >>${LOG}
|
2022-10-08 23:38:08 +00:00
|
|
|
rsync -a /usr/config/modules/* /storage/.config/modules/
|
2022-04-26 16:51:27 +00:00
|
|
|
cp -f /usr/config/retroarch/retroarch-core-options.cfg /storage/.config/retroarch/retroarch-core-options.cfg
|
2022-03-16 22:03:28 +00:00
|
|
|
|
2022-08-03 11:46:37 +00:00
|
|
|
### Apply developer ssh keys if they exist
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Apply dev keys if available..." >>${LOG}
|
2022-07-13 21:59:42 +00:00
|
|
|
if [ -e /usr/config/ssh/authorized_keys ]
|
|
|
|
then
|
2022-06-06 18:09:55 +00:00
|
|
|
cp /usr/config/ssh/authorized_keys /storage/.ssh
|
|
|
|
fi
|
|
|
|
|
2022-10-15 12:02:48 +00:00
|
|
|
### Sync rsync configs
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Update rsync configuration files..." >>${LOG}
|
2022-04-03 17:01:59 +00:00
|
|
|
rsync --ignore-existing /usr/config/rsync-rules.conf /storage/.config/
|
|
|
|
rsync --ignore-existing /usr/config/rsync.conf /storage/.config/
|
|
|
|
|
2023-04-24 16:19:57 +00:00
|
|
|
### Sync locale data
|
|
|
|
rsync -a --delete /usr/config/locale/* /storage/.config/locale/ >>/var/log/configure.log 2>&1
|
|
|
|
rm -rf /storage/.config/emulationstation/locale >>/var/log/configure.log 2>&1 ||:
|
|
|
|
ln -sf /usr/share/locale /storage/.config/emulationstation/locale >>/var/log/configure.log 2>&1 ||:
|
|
|
|
|
2023-04-23 00:19:52 +00:00
|
|
|
### Add items below this line that are safe to remove after a period of time.
|
|
|
|
################################################################################
|
|
|
|
|
2023-04-24 16:19:57 +00:00
|
|
|
### Fix docker storage path (dev build issue only)
|
2023-04-23 01:44:25 +00:00
|
|
|
if [ -e "/usr/bin/docker" ] && \
|
|
|
|
[ ! -d "/storage/.config/docker" ]
|
|
|
|
then
|
|
|
|
cp -rf /usr/config/docker /storage/.config
|
|
|
|
fi
|
2023-04-24 16:19:57 +00:00
|
|
|
|
|
|
|
### Ensure panel properties exist.
|
|
|
|
for DPROP in brightness contrast saturation hue
|
|
|
|
do
|
|
|
|
DBRI=$(get_setting display.${DPROP})
|
|
|
|
if [ -z "${DBRI}" ]
|
|
|
|
then
|
|
|
|
set_setting display.${DPROP} 50
|
|
|
|
fi
|
|
|
|
done
|
2023-06-18 20:22:03 +00:00
|
|
|
|
|
|
|
### Update JSListen
|
|
|
|
for JSL in jslisten_hotkeys jslisten_profile
|
|
|
|
do
|
|
|
|
cp -f /usr/config/${JSL} /storage/.config
|
|
|
|
done
|
2023-06-26 10:15:15 +00:00
|
|
|
|
|
|
|
### Add properties for enhanced power savings control.
|
2023-06-28 11:41:10 +00:00
|
|
|
AUDIOPOWERSAVE=$(get_setting system.power.audio)
|
2023-06-26 10:15:15 +00:00
|
|
|
if [ -z "${AUDIOPOWERSAVE}" ]
|
|
|
|
then
|
2023-06-28 11:41:10 +00:00
|
|
|
set_setting system.power.audio 1
|
2023-06-26 10:15:15 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-28 11:41:10 +00:00
|
|
|
CPUPOWERSAVE=$(get_setting system.power.cpu)
|
2023-06-26 10:15:15 +00:00
|
|
|
if [ -z "${CPUPOWERSAVE}" ]
|
|
|
|
then
|
2023-06-28 11:41:10 +00:00
|
|
|
set_setting system.power.cpu 1
|
2023-06-26 10:15:15 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-28 11:41:10 +00:00
|
|
|
PCIEPOWERSAVE=$(get_setting system.power.pcie)
|
2023-06-26 10:15:15 +00:00
|
|
|
if [ -z "${PCIEPOWERSAVE}" ]
|
|
|
|
then
|
2023-07-16 15:26:02 +00:00
|
|
|
set_setting system.power.pcie 0
|
2023-06-26 10:15:15 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-28 11:41:10 +00:00
|
|
|
RTPM=$(get_setting system.power.rtpm)
|
|
|
|
if [ -z "${RTPM}" ]
|
2023-06-26 10:15:15 +00:00
|
|
|
then
|
2023-06-28 11:41:10 +00:00
|
|
|
set_setting system.power.rtpm 0
|
2023-06-26 10:15:15 +00:00
|
|
|
fi
|
2023-06-26 22:07:10 +00:00
|
|
|
|
2023-06-28 11:41:10 +00:00
|
|
|
WAKEEVENTS=$(get_setting system.power.wakeevents)
|
|
|
|
if [ -z "${WAKEEVENTS}" ]
|
2023-06-28 00:38:41 +00:00
|
|
|
then
|
2023-07-16 15:26:02 +00:00
|
|
|
set_setting system.power.wakeevents 0
|
2023-06-28 11:41:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
WIFIPOWERSAVE=$(get_setting system.power.wifi)
|
|
|
|
if [ -z "${WIFIPOWERSAVE}" ]
|
|
|
|
then
|
|
|
|
set_setting system.power.wifi 0
|
2023-06-28 00:38:41 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-26 22:07:10 +00:00
|
|
|
AUDIBLEALERT=$(get_setting system.battery.warning)
|
|
|
|
if [ -z "${AUDIBLEALERT}" ]
|
|
|
|
then
|
|
|
|
set_setting system.battery.warning 1
|
|
|
|
fi
|
2023-07-06 23:04:19 +00:00
|
|
|
|
|
|
|
### Revert the recent ES PowerSavingMode change.
|
|
|
|
sed -i 's#<string name="PowerSaverMode".*$#<string name="PowerSaverMode" value="default"/>#g' /storage/.config/emulationstation/es_settings.cfg
|
2023-07-10 11:59:09 +00:00
|
|
|
|
|
|
|
### Remove properties containing "auto" from the system config.
|
|
|
|
sed -i "/^.*=auto/d" /storage/.config/system/configs/system.cfg
|
2023-07-16 20:17:01 +00:00
|
|
|
|
|
|
|
### Fix up music player to start selection
|
|
|
|
if [ -d "/storage/.local/share/gmu" ]
|
|
|
|
then
|
|
|
|
rm -rf /storage/.local/share/gmu
|
|
|
|
fi
|
|
|
|
if [ ! -d "/storage/.config/gmu/playlists" ]
|
|
|
|
then
|
|
|
|
mkdir -p /storage/.config/gmu/playlists
|
|
|
|
fi
|
|
|
|
cp -rf /usr/config/gmu/playlists/* /storage/.config/gmu/playlists/
|
2023-07-26 13:07:47 +00:00
|
|
|
|
|
|
|
### Remove any input settings retroarch may have added.
|
|
|
|
for setting in $(awk '/input_player'${i}'_/ {print $1}' /storage/.config/retroarch/retroarch.cfg)
|
|
|
|
do
|
|
|
|
sed -i "/^${setting}/d" /storage/.config/retroarch/retroarch.cfg
|
|
|
|
done
|
2023-08-07 02:22:19 +00:00
|
|
|
|
|
|
|
### Switch to pulse for pipewire
|
2023-08-08 18:23:57 +00:00
|
|
|
sed -i 's~^audio_driver = .*$~audio_driver = "pulse"~g' /storage/.config/retroarch/retroarch.cfg
|
2023-08-07 02:22:19 +00:00
|
|
|
|
|
|
|
### Remove stale asound bits
|
|
|
|
rm -f /storage/.config/asound*
|
2023-08-07 16:26:55 +00:00
|
|
|
|
|
|
|
### Flycast needs to switch to pulseaudio
|
|
|
|
if [ -e "/storage/.config/flycast/emu.cfg" ]
|
|
|
|
then
|
|
|
|
cp -f /usr/config/flycast/emu.cfg /storage/.config/flycast/emu.cfg
|
|
|
|
fi
|
2023-08-08 12:13:09 +00:00
|
|
|
|
|
|
|
### Set the default output to Master for pipewire
|
|
|
|
ES_SETTINGS="/storage/.config/emulationstation/es_settings.cfg"
|
|
|
|
|
|
|
|
function set_es_path() {
|
|
|
|
AUDIODEVICE=${1}
|
|
|
|
sed -i '/^.*<string name="AudioDevice".*$/d' ${ES_SETTINGS}
|
|
|
|
if [ -e "/storage/.config/profile.d/99-mixer" ]
|
|
|
|
then
|
|
|
|
rm "/storage/.config/profile.d/99-mixer"
|
|
|
|
fi
|
|
|
|
sed -i '/^.*AudioCard.*$/a \\t<string name="AudioDevice" value="'"${AUDIODEVICE}"'" \/>' ${ES_SETTINGS}
|
|
|
|
echo "DEVICE_AUDIO_MIXER=\"${AUDIODEVICE}\"" >/storage/.config/profile.d/99-mixer
|
|
|
|
}
|
|
|
|
|
|
|
|
set_es_path "Master"
|