2022-03-16 22:03:28 +00:00
|
|
|
#!/bin/bash
|
2023-10-23 22:44:47 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2023-10-24 16:00:57 +00:00
|
|
|
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
2022-03-16 22:03:28 +00:00
|
|
|
|
|
|
|
. /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-10-11 02:14:22 +00:00
|
|
|
### 20231010 - Stop setting vram in ES settings.
|
|
|
|
sed -i '/^.*<int name="MaxVRAM".*$/d' ${ES_SETTINGS}
|
2023-11-01 15:45:58 +00:00
|
|
|
|
|
|
|
### 20231031 - Switch back to alsathread for RetroArch
|
|
|
|
sed -i 's~"pulse"~"alsathread"~g' /storage/.config/retroarch/retroarch.cfg
|
2023-11-11 11:22:38 +00:00
|
|
|
|
2023-11-15 00:00:28 +00:00
|
|
|
### 20231114 - Update hosts.conf
|
|
|
|
grep "127.0.0.1" /storage/.config/hosts.conf >/dev/null 2>&1 || cp /usr/config/hosts.conf /storage/.config/
|
|
|
|
|
2023-12-03 13:04:06 +00:00
|
|
|
### 20231127 - Migrate games to overlayfs (updated 20231203)
|
|
|
|
NULL=$(cat /proc/mounts | grep -v -e "/storage/roms" 2>/dev/null | grep ${1})
|
|
|
|
if [ ! "$?" = 0 ]
|
|
|
|
then
|
|
|
|
umount /storage/roms
|
|
|
|
fi
|
2023-11-27 22:41:15 +00:00
|
|
|
GAMECOUNT=$(find /storage/roms -type f | wc -l)
|
|
|
|
if [ "${GAMECOUNT}" -gt 20 ] && \
|
|
|
|
[ ! -e "/storage/.migrated_games" ]
|
|
|
|
then
|
|
|
|
echo "Migrating games to overlayfs" >>${LOG}
|
|
|
|
if [ -d "/storage/games-internal" ]
|
|
|
|
then
|
|
|
|
echo "Backing up games-internal" >>${LOG}
|
|
|
|
mv /storage/games-internal /storage/games-internal.backup
|
|
|
|
fi
|
|
|
|
mv /storage/roms /storage/games-internal
|
|
|
|
mkdir /storage/roms
|
|
|
|
touch /storage/.migrated_games
|
|
|
|
else
|
|
|
|
echo "Game weight too low (${GAMECOUNT}) or content already migrated." >>${LOG}
|
|
|
|
fi
|
2023-12-03 13:04:06 +00:00
|
|
|
|
|
|
|
### Migration part 2
|
|
|
|
for GAMES in /storage/games-internal /storage/games-external
|
|
|
|
do
|
2023-12-04 11:50:35 +00:00
|
|
|
COUNT=$(find ${GAMES}/roms 2>/dev/null| wc -l)
|
2023-12-04 17:16:13 +00:00
|
|
|
if [ "${COUNT}" -lt 320 ]
|
2023-12-03 13:04:06 +00:00
|
|
|
then
|
2023-12-04 17:16:13 +00:00
|
|
|
if [ ! -d "${GAMES}/roms" ]
|
|
|
|
then
|
|
|
|
mkdir -p "${GAMES}/roms" 2>/dev/null
|
|
|
|
else
|
|
|
|
find "${GAMES}/roms" -type d -empty -delete
|
|
|
|
fi
|
2023-12-04 11:50:35 +00:00
|
|
|
mv "${GAMES}/"* "${GAMES}/roms/" 2>/dev/null
|
2023-12-04 17:16:13 +00:00
|
|
|
find "${GAMES}" -type d -empty -delete
|
2023-12-03 13:04:06 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
systemctl restart jelos-automount
|
2023-11-27 22:41:15 +00:00
|
|
|
|
2023-11-29 22:25:24 +00:00
|
|
|
### 20231129 - Don't default to performance.
|
|
|
|
EPP=$(get_setting system.power.epp)
|
|
|
|
if [ -z "${EPP}" ] || \
|
|
|
|
[ "${EPP}" = "performance" ]
|
|
|
|
then
|
|
|
|
EPP="balance_performance"
|
|
|
|
set_setting system.power.epp ${EPP}
|
|
|
|
fi
|
|
|
|
|
2023-11-30 15:28:57 +00:00
|
|
|
### 20231130 - Replace smb.conf for new overlay mechanism.
|
|
|
|
cp -f /usr/config/smb.conf /storage/.config
|
|
|
|
|
2023-12-02 11:54:54 +00:00
|
|
|
### 20231202 - Remove stale profile bits if they exist.
|
|
|
|
for FILE in 001-deviceconfig 99-mixer
|
|
|
|
do
|
|
|
|
rm -rf ${FILE} 2>/dev/null
|
|
|
|
done
|
|
|
|
|
2023-12-03 13:13:59 +00:00
|
|
|
### 20231203 - Disable merged storage by default.
|
|
|
|
MERGED_STORAGE=$(get_setting system.merged.storage)
|
|
|
|
if [ -z "${MERGED_STORAGE}" ]
|
|
|
|
then
|
|
|
|
set_setting system.merged.storage 0
|
|
|
|
fi
|
|
|
|
|
2023-11-11 11:22:38 +00:00
|
|
|
### Items below this line should not be removed.
|
|
|
|
tocon "Update complete, rebooting..."
|
|
|
|
reboot
|