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.
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Update logo..." >>${LOG}
|
2022-08-26 23:18:56 +00:00
|
|
|
if [ ! -L "/storage/.config/emulationstation/resources/logo.png" ]
|
|
|
|
then
|
|
|
|
rm -f /storage/.config/emulationstation/resources/logo.png ||:
|
|
|
|
ln -sf /usr/config/splash/splash.png /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-11-01 11:55:34 +00:00
|
|
|
echo "Sync theme..." >>${LOG}
|
2022-08-03 11:46:37 +00:00
|
|
|
cd /usr/share/themes
|
|
|
|
for theme in *
|
|
|
|
do
|
|
|
|
if [ ! -L /storage/.config/emulationstation/themes/${theme} ] && \
|
|
|
|
[ ! -e /storage/.config/emulationstation/themes/${theme} ]
|
|
|
|
then
|
|
|
|
ln -s /usr/share/themes/${theme} /storage/.config/emulationstation/themes
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd -
|
|
|
|
|
|
|
|
### 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/
|
|
|
|
|
2022-08-20 14:12:53 +00:00
|
|
|
### Replace es_systems and es_features with links to manage them
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Sync ES configuration files..." >>${LOG}
|
2022-08-20 14:12:53 +00:00
|
|
|
for es_cfg in es_features.cfg es_systems.cfg
|
|
|
|
do
|
2022-08-21 16:23:26 +00:00
|
|
|
if [ -e "/storage/.config/emulationstation/${es_cfg}" ]
|
2022-08-20 14:12:53 +00:00
|
|
|
then
|
2022-10-06 21:05:59 +00:00
|
|
|
mv -f /storage/.config/emulationstation/${es_cfg} /storage/.config/emulationstation/last_${es_cfg}
|
2022-08-20 14:12:53 +00:00
|
|
|
fi
|
|
|
|
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg}
|
|
|
|
done
|
|
|
|
|
2022-09-14 21:35:38 +00:00
|
|
|
# Default modules need to be updated to use the new stop/start ui function.
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Sync modules (tools)..." >>${LOG}
|
2022-09-14 21:35:38 +00:00
|
|
|
rsync -av /usr/config/modules/* /storage/.config/modules/
|
2023-01-02 11:56:46 +00:00
|
|
|
rm -f /storage/.config/modules/{"351Files.sh","Start 32bit Retroarch.sh","JelosAddOns.sh","PortMaster.sh","ThemeMaster.sh"} ||:
|
2022-09-14 21:35:38 +00:00
|
|
|
|
2022-07-13 21:59:42 +00:00
|
|
|
# Swap es_input back to a writeable file so external controller configuration works properly.
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Make sure es_input isn't a link..." >>${LOG}
|
2022-07-13 21:59:42 +00:00
|
|
|
if [ -L "/storage/.config/emulationstation/es_input.cfg" ]
|
|
|
|
then
|
|
|
|
rm -f /storage/.config/emulationstation/es_input.cfg
|
|
|
|
cp -f /usr/config/emulationstation/es_input.cfg /storage/.config/emulationstation/es_input.cfg
|
|
|
|
fi
|
2022-07-30 23:34:43 +00:00
|
|
|
|
2022-12-31 02:17:00 +00:00
|
|
|
# Disable integer scaling by default on Handheld
|
2022-09-27 22:35:31 +00:00
|
|
|
if [[ "${HW_DEVICE}" =~ handheld ]]
|
2022-09-25 15:21:09 +00:00
|
|
|
then
|
2022-12-31 02:17:00 +00:00
|
|
|
echo "No integer scaling (Handheld only)..." >>${LOG}
|
2022-09-25 15:21:09 +00:00
|
|
|
sed -i "s#.integerscale=1#.integerscale=0#g" /storage/.config/system/configs/system.cfg
|
|
|
|
fi
|
|
|
|
|
2022-10-04 11:58:38 +00:00
|
|
|
# If smb.conf doesn't exist in ~/.config, add it.
|
|
|
|
if [ ! -e "/storage/.config/smb.conf" ]
|
|
|
|
then
|
2022-11-01 11:55:34 +00:00
|
|
|
echo "Make sure smb.conf is in .config..." >>${LOG}
|
2022-10-04 11:58:38 +00:00
|
|
|
cp -f /usr/config/smb.conf /storage/.config
|
|
|
|
fi
|
2022-10-14 20:51:45 +00:00
|
|
|
|
2023-01-19 11:22:39 +00:00
|
|
|
# Set enhanced power saving off by default
|
|
|
|
ENHPOWER=$(get_setting system.powersave)
|
|
|
|
if [ -z "${ENHPOWER}" ]
|
2022-12-21 00:29:08 +00:00
|
|
|
then
|
2023-01-19 11:22:39 +00:00
|
|
|
echo "Set up enhanced power saving..." >>${LOG}
|
|
|
|
set_setting system.powersave 0
|
2022-12-21 00:29:08 +00:00
|
|
|
fi
|
|
|
|
|
2022-10-25 21:40:48 +00:00
|
|
|
# Set automatic hotkey management by default.
|
2022-11-01 11:55:34 +00:00
|
|
|
AUTOHOTKEYS=$(get_setting system.autohotkeys)
|
|
|
|
if [ -z "${AUTOHOTKEYS}" ]
|
|
|
|
then
|
|
|
|
echo "Set up hotkey management..." >>${LOG}
|
|
|
|
set_setting system.autohotkeys 1
|
|
|
|
fi
|
2022-10-27 10:09:12 +00:00
|
|
|
|
2022-12-21 22:24:01 +00:00
|
|
|
# Swap to schedutil as the default governor
|
|
|
|
GOVERNOR=$(get_setting system.cpugovernor)
|
|
|
|
if [ "${GOVERNOR}" = "interactive" ]
|
|
|
|
then
|
|
|
|
set_setting system.cpugovernor schedutil
|
|
|
|
schedutil
|
|
|
|
fi
|
|
|
|
|
2022-10-27 10:09:12 +00:00
|
|
|
# Set the default weston startup to ES
|
2022-11-01 11:55:34 +00:00
|
|
|
WESTONSTARTUP=$(get_setting weston.startup)
|
|
|
|
if [ -z "${WESTONSTARTUP}" ]
|
|
|
|
then
|
|
|
|
echo "Make sure weston is our default." >>${LOG}
|
|
|
|
set_setting weston.startup "/usr/bin/start_es.sh"
|
|
|
|
fi
|
2022-12-04 20:56:54 +00:00
|
|
|
|
2022-12-04 23:18:49 +00:00
|
|
|
# Disable PCSX2SA auto update check
|
|
|
|
if [ -e "/storage/.config/PCSX2/inis/PCSX2.ini" ] && \
|
|
|
|
[ ! "$(grep -i AutoUpdater /storage/.config/PCSX2/inis/PCSX2.ini)" ]
|
|
|
|
then
|
|
|
|
cat <<EOF >>/storage/.config/PCSX2/inis/PCSX2.ini
|
|
|
|
[AutoUpdater]
|
|
|
|
CheckAtStartup = false
|
|
|
|
EOF
|
|
|
|
fi
|
2023-01-15 00:10:22 +00:00
|
|
|
|
2023-01-20 02:30:33 +00:00
|
|
|
# the controller profile has been renamed.
|
|
|
|
if [ -e "/storage/.config/profile.d/99-controller" ]
|
|
|
|
then
|
|
|
|
rm -f /storage/.config/profile.d/99-controller
|
|
|
|
mkcontroller
|
|
|
|
fi
|
|
|
|
|
2023-01-23 02:38:25 +00:00
|
|
|
# Set a default GPU power savings mode
|
|
|
|
GPUMODE=$(get_setting system.gpuperf)
|
|
|
|
if [ -z "${GPUMODE}" ]
|
|
|
|
then
|
|
|
|
echo "Set a default GPU power savings mode." >>${LOG}
|
|
|
|
set_setting system.gpuperf auto
|
|
|
|
fi
|
|
|
|
|
2023-01-21 15:15:01 +00:00
|
|
|
# Set a default for the audio preamp
|
|
|
|
PREAMP=$(get_setting audio.preamp)
|
|
|
|
if [ -z "${PREAMP}" ]
|
|
|
|
then
|
|
|
|
echo "Set default preamp." >>${LOG}
|
|
|
|
set_setting audio.preamp 50
|
|
|
|
fi
|
|
|
|
|
2023-01-20 02:30:33 +00:00
|
|
|
# Disable IPv6 by default
|
2023-01-15 00:10:22 +00:00
|
|
|
IPV6=$(get_setting ipv6.enabled)
|
|
|
|
if [ -z "${IPV6}" ]
|
|
|
|
then
|
|
|
|
echo "Disable ipv6." >>${LOG}
|
|
|
|
set_setting ipv6.enabled 0
|
|
|
|
fi
|
2023-01-20 02:30:33 +00:00
|
|
|
|
2023-02-10 00:17:29 +00:00
|
|
|
SYNCTHING=$(get_setting syncthing.enabled)
|
|
|
|
if [ -z "${SYNCTHING}" ]
|
|
|
|
then
|
|
|
|
echo "Set syncthing default" >>${LOG}
|
|
|
|
set_setting syncthing.enabled=0
|
|
|
|
fi
|
|
|
|
|
2023-01-20 02:30:33 +00:00
|
|
|
### Force everyone to the stable repo
|
|
|
|
set_setting updates.branch stable
|
2023-03-05 17:09:43 +00:00
|
|
|
|
|
|
|
### Configure box86/64 defaulta
|
|
|
|
for BOX in box86 box64
|
|
|
|
do
|
|
|
|
if [ ! -e "/storage/.config/${BOX}.${BOX}rc" ]
|
|
|
|
then
|
|
|
|
cp -f /usr/config/${BOX}.${BOX}rc /storage/.config/
|
|
|
|
fi
|
|
|
|
done
|