distribution/packages/jelos/sources/post-update
Sparticuz d3b6b90d45 Merge remote-tracking branch 'upstream/dev' into mainline
* upstream/dev: (52 commits)
  Fix udevil regression.
  Fix game migration to new path during post-update.
  Bump AMD64 kernel to 6.6.4.
  Bump Kernel to 6.1.65 on supported devices
  Fix merged storage to switch on and off correctly.  Hide internal/external switch, but make it available as system.merged.device (1/0).
  Yuzu-sa - Add cpu accuracy ES feature
  Additional merged storage optimizations, add a script to remove empty directories that may cause overlay issues.
  Disable merged storage by default, fix bind mount to use correct (updated) path.
  * Add support for changing the merged storage target between the internal and external card.   * Since JELOS creates the games directory structure it is possible that the overlay will hide games if you switch targets as it will consider them removed.  Delete the empty directories and reboot to resolve.     * Ex: find /storage/games-internal -type d -empty -delete && find /storage/games-external -type d -empty -delete && reboot   * Merged storage can now be disabled persistently.   * A new directory structure is required to enable switching:     * /storage/games-internal/roms     * /storage/games-external/roms     * The target /storage/roms has not changed. * Lowers clocks to powersave for RK3566 devices.
  Remove stale profile bits that still seem to exist on some devices and break audio.
  Remove stale xorg bits from package.
  Bump Citra-SA and Yuzu-SA
  Switch the xorg-server package to xwayland.  Tested the emulators that appeared to depend on it, they seemed to start up ok.
  Yuzu-SA: never ask to confirm close
  Add Yuzu Rumble Strength Feature
  Amlogic/linux: remove unneeded drm panel orientation quirk
  Amlogic/linux: silence dmesg spam
  Amlogic/linux: remove 1908 opp as this is not present in the bsp
  Amlogic/linux: simplify rgb10-max3-pro device tree
  Fix mesa oops
  ...
2023-12-04 11:13:00 -05:00

150 lines
4.7 KiB
Bash

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
. /etc/profile
LOG="/var/log/boot.log"
### This script contains items that we only want to execute after a JELOS upgrade,
### or after a fresh installation.
### Items in this block should always run after updates.
################################################################################
echo "Rebuild library cache..." >>${LOG}
### Rebuild the library cache
rm -f /storage/.cache/ld.so.cache
ldconfig -X
echo "Sync configuration files..." >>${LOG}
### Sync configurations
if [ -d "/storage/.config/system/configs" ]
then
EXCLUDE="--exclude=configs"
fi
### 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
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/
if [ -f "/storage/.config/emulationstation/resources/logo.png" ]
then
rm -f /storage/.config/emulationstation/resources/logo.png
fi
echo "Sync modules..." >>${LOG}
rsync -a /usr/config/modules/* /storage/.config/modules/
cp -f /usr/config/retroarch/retroarch-core-options.cfg /storage/.config/retroarch/retroarch-core-options.cfg
### Apply developer ssh keys if they exist
echo "Apply dev keys if available..." >>${LOG}
if [ -e /usr/config/ssh/authorized_keys ]
then
cp /usr/config/ssh/authorized_keys /storage/.ssh
fi
### Sync rsync configs
echo "Update rsync configuration files..." >>${LOG}
rsync --ignore-existing /usr/config/rsync-rules.conf /storage/.config/
rsync --ignore-existing /usr/config/rsync.conf /storage/.config/
### 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 ||:
### Add items below this line that are safe to remove after a period of time.
################################################################################
### 20231010 - Stop setting vram in ES settings.
sed -i '/^.*<int name="MaxVRAM".*$/d' ${ES_SETTINGS}
### 20231031 - Switch back to alsathread for RetroArch
sed -i 's~"pulse"~"alsathread"~g' /storage/.config/retroarch/retroarch.cfg
### 20231114 - Update hosts.conf
grep "127.0.0.1" /storage/.config/hosts.conf >/dev/null 2>&1 || cp /usr/config/hosts.conf /storage/.config/
### 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
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
### Migration part 2
for GAMES in /storage/games-internal /storage/games-external
do
COUNT=$(find ${GAMES}/roms 2>/dev/null| wc -l)
if [ "${COUNT}" -lt 10 ]
then
mkdir -p "${GAMES}/roms" 2>/dev/null
mv "${GAMES}/"* "${GAMES}/roms/" 2>/dev/null
fi
done
systemctl restart jelos-automount
### 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
### 20231130 - Replace smb.conf for new overlay mechanism.
cp -f /usr/config/smb.conf /storage/.config
### 20231202 - Remove stale profile bits if they exist.
for FILE in 001-deviceconfig 99-mixer
do
rm -rf ${FILE} 2>/dev/null
done
### 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
### 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
### 20231130 - Replace smb.conf for new overlay mechanism.
cp -f /usr/config/smb.conf /storage/.config
### Items below this line should not be removed.
tocon "Update complete, rebooting..."
reboot