c88a508544
Replace current config.txt with default version if the version info is missing or below the required minimum version. This is needed to roll out required changes if users update from LibreELEC 9.x Signed-off-by: Matthias Reichl <hias@horus.com>
58 lines
1.9 KiB
Bash
Executable File
58 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
|
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash"
|
|
[ -z "$SYSTEM_ROOT" ] && SYSTEM_ROOT=""
|
|
|
|
MIN_CONFIG_TXT_VERSION=1
|
|
|
|
# mount $BOOT_ROOT r/w
|
|
mount -o remount,rw $BOOT_ROOT
|
|
|
|
# Something has gone horribly wrong... clean up
|
|
[ -s $BOOT_ROOT/overlays ] || rm -fr $BOOT_ROOT/overlays $BOOT_ROOT/FSCK*.REC
|
|
|
|
# update bootloader files
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/LICENCE* $BOOT_ROOT
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/bootcode.bin $BOOT_ROOT
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/fixup.dat $BOOT_ROOT
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/start.elf $BOOT_ROOT
|
|
|
|
rm -f $BOOT_ROOT/bcm283*.dtb # cleanup excess dtb's used by upstream kernels (ie. not LE)
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/*.dtb $BOOT_ROOT
|
|
cp -pR $SYSTEM_ROOT/usr/share/bootloader/overlays $BOOT_ROOT
|
|
|
|
# cleanup unneeded files
|
|
rm -rf $BOOT_ROOT/loader.bin
|
|
rm -rf $BOOT_ROOT/fixup_x.dat
|
|
rm -rf $BOOT_ROOT/start_x.elf
|
|
|
|
# some config.txt magic
|
|
if [ ! -f $BOOT_ROOT/config.txt ]; then
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/config.txt $BOOT_ROOT
|
|
else
|
|
CONFIG_TXT_VERSION=$( \
|
|
grep "^# config.txt version v[0-9]\+" $BOOT_ROOT/config.txt | \
|
|
head -n 1 | \
|
|
sed 's/^# config.txt version v\([0-9]\+\) .*$/\1/' \
|
|
)
|
|
if [ ${CONFIG_TXT_VERSION:-0} -lt $MIN_CONFIG_TXT_VERSION ]; then
|
|
mv -f $BOOT_ROOT/config.txt $BOOT_ROOT/config.txt.old
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/config.txt $BOOT_ROOT/config.txt
|
|
echo "WARNING incompatible config.txt detected, replacing with default."
|
|
echo "Previous config.txt has been moved to config.txt.old"
|
|
fi
|
|
fi
|
|
|
|
# Add distro config file
|
|
if [ -f $SYSTEM_ROOT/usr/share/bootloader/distroconfig.txt ]; then
|
|
cp -p $SYSTEM_ROOT/usr/share/bootloader/distroconfig.txt $BOOT_ROOT
|
|
fi
|
|
|
|
# mount $BOOT_ROOT r/o
|
|
sync
|
|
mount -o remount,ro $BOOT_ROOT
|