distribution/packages/jelos/sources/post-update

131 lines
4 KiB
Text
Raw Normal View History

#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
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.
### Rebuild the library cache
rm -f /storage/.cache/ld.so.cache
ldconfig -X
### 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
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
rsync -a /usr/config/modules/* /storage/.config/modules/
cp -f /usr/config/retroarch/retroarch-core-options.cfg /storage/.config/retroarch/retroarch-core-options.cfg
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
if [ -e /usr/config/ssh/authorized_keys ]
then
cp /usr/config/ssh/authorized_keys /storage/.ssh
fi
### Sync rsync configs
rsync --ignore-existing /usr/config/rsync-rules.conf /storage/.config/
rsync --ignore-existing /usr/config/rsync.conf /storage/.config/
### Replace es_systems and es_features with links to manage them
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}" ]
then
2022-10-06 21:05:59 +00:00
mv -f /storage/.config/emulationstation/${es_cfg} /storage/.config/emulationstation/last_${es_cfg}
fi
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg}
done
# Make sure PortMaster is in sync
if [ ! -d "/storage/roms/ports/PortMaster" ]
then
mkdir -p /storage/roms/ports/PortMaster
else
rm -rf /storage/roms/ports/PortMaster
mkdir -p /storage/roms/ports/PortMaster
rm -f /storage/roms/ports/PortMaster.sh ||:
fi
rsync -a --delete /usr/share/PortMaster/* /storage/roms/ports/PortMaster/
chmod +x /storage/roms/ports/PortMaster -R
# Ensure JelosAddOns is in sync
if [ ! -d "/storage/roms/ports/JelosAddOns" ]
then
mkdir -p /storage/roms/ports/JelosAddOns
else
rm -rf /storage/roms/ports/JelosAddOns
mkdir -p /storage/roms/ports/JelosAddOns
rm -f /storage/roms/ports/JelosAddOns.sh ||:
fi
rsync -a /usr/share/JelosAddOns/* /storage/roms/ports/JelosAddOns/
chmod -R 755 /storage/roms/ports/JelosAddOns
# Make sure ThemeMaster is in sync
if [ ! -d "/storage/roms/ports/ThemeMaster" ]
then
mkdir -p /storage/roms/ports/ThemeMaster
else
rm -rf /storage/roms/ports/ThemeMaster
mkdir -p /storage/roms/ports/ThemeMaster
rm -f /storage/roms/ports/ThemeMaster.sh ||:
fi
rsync -a /usr/share/ThemeMaster/* /storage/roms/ports/ThemeMaster/
chmod -R 755 /storage/roms/ports/ThemeMaster
# Default modules need to be updated to use the new stop/start ui function.
rsync -av /usr/config/modules/* /storage/.config/modules/
# Swap es_input back to a writeable file so external controller configuration works properly.
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
# Disable integer scaling by default on Win600
if [[ "${HW_DEVICE}" =~ handheld ]]
then
sed -i "s#.integerscale=1#.integerscale=0#g" /storage/.config/system/configs/system.cfg
fi
# We don't want to use gl on the 552, switch it to glcore.
if [[ "${HW_DEVICE}" =~ RG552 ]]
then
sed -i 's#video_driver = "gl"#video_driver = "glcore"#g' /storage/.config/retroarch/retroarch.cfg
fi
# If smb.conf doesn't exist in ~/.config, add it.
if [ ! -e "/storage/.config/smb.conf" ]
then
cp -f /usr/config/smb.conf /storage/.config
fi