distribution/packages/jelos/sources/post-update
fewtarius cd17e0e13c
* Fix fresh flash system menu bug.
* Fix language selection bug.
* Add DEBUG_SUPPORT variable to build debug tools.
2023-04-24 16:19:57 +00:00

110 lines
3.1 KiB
Bash

#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /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
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/
echo "Update logo..." >>${LOG}
FBWIDTH=$(fbset | awk '/geometry/ {print $2}')
FBHEIGHT=$(fbset | awk '/geometry/ {print $3}')
ASPECT=$(printf "%.2f" $(echo "(${FBWIDTH} / ${FBHEIGHT})" | bc -l))
case ${ASPECT} in
1.31|0.76)
ASPECT="3:2"
;;
1.33|0.75)
ASPECT="4:3"
;;
1.67|0.60)
ASPECT="5:3"
;;
1.76|0.56)
ASPECT="16:9"
;;
esac
if [ -f "/storage/.config/emulationstation/resources/logo.png" ]
then
rm -f /storage/.config/emulationstation/resources/logo.png ||:
fi
convert /usr/config/splash/splash.png \
-gravity center \
-crop ${ASPECT} +repage \
/tmp/.logo.png
convert /tmp/.logo.png \
-quality 100 \
-resize ${FBWIDTH}x${FBHEIGHT} \
-background black \
-gravity center \
/storage/.config/emulationstation/resources/logo.png
rm -f /tmp/.logo.png
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.
################################################################################
### Fix docker storage path (dev build issue only)
if [ -e "/usr/bin/docker" ] && \
[ ! -d "/storage/.config/docker" ]
then
cp -rf /usr/config/docker /storage/.config
fi
### 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