From d03a509f04c487e89edc24c2a89dc93654dd6649 Mon Sep 17 00:00:00 2001 From: cizia64 Date: Sun, 9 Jun 2024 03:23:08 +0200 Subject: [PATCH] Fix compatibility with firmware 1.0.4 hotfix 9 We avoid to flash the bootlogo if the firmware > 1.0.4 hotfix 6 The BootLogo app is also disabled for these firmware There is less space than before on /dev/mmcblk0p1 because the battery images are now also in this partition, so there no enough space for a 720p bootlogo anymore (smaller should be OK however). --- Apps/BootLogo/launch.sh | 42 +++++++++------- "System/starts/\302\260cutomization.sh" | 64 ++++++++++++++----------- 2 files changed, 61 insertions(+), 45 deletions(-) diff --git a/Apps/BootLogo/launch.sh b/Apps/BootLogo/launch.sh index 3b584e0e..13cbc295 100644 --- a/Apps/BootLogo/launch.sh +++ b/Apps/BootLogo/launch.sh @@ -1,4 +1,19 @@ #!/bin/sh +CrossMixFWfile="/mnt/SDCARD/trimui/firmwares/MinFwVersion.txt" +Current_FW_Revision=$(grep 'DISTRIB_DESCRIPTION' /etc/openwrt_release | cut -d '.' -f 3) +Required_FW_Revision=$(sed -n '2p' "$CrossMixFWfile") + +if [ "$Current_FW_Revision" -gt "$Required_FW_Revision" ]; then # on firmware hotfix 9 there is less space than before on /dev/mmcblk0p1 so we avoid to flash the logo + /mnt/SDCARD/System/bin/sdl2imgshow \ + -i "/mnt/SDCARD/trimui/res/crossmix-os/bg-info.png" \ + -f "/mnt/SDCARD/System/resources/DejaVuSans.ttf" \ + -s 30 \ + -c "220,220,220" \ + -t "Not compatible with firmware superior to v1.0.4 hotfix 6" & + sleep 3 + pkill -f sdl2imgshow + exit 1 +fi echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo 1416000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq @@ -9,32 +24,29 @@ rm -f ./GoBackTo_Apps.json cp /tmp/state.json ./GoBackTo_Apps.json cp ./GoTo_Bootlogo_List.json /tmp/state.json - src_dir="/mnt/SDCARD/Apps/BootLogo/Images/" dest_dir="/mnt/SDCARD/Apps/BootLogo/Thumbnails/" find "$dest_dir" -type f -not -name "- Default Trimui.png" -exec rm -f {} \; sync - /mnt/SDCARD/System/bin/sdl2imgshow \ - -i "/mnt/SDCARD/trimui/res/crossmix-os/bg-info.png" \ - -f "/mnt/SDCARD/System/resources/DejaVuSans.ttf" \ - -s 50 \ - -c "220,220,220" \ - -t "Generating thumbnails..." & - sleep 0.3 - pkill -f sdl2imgshow - + -i "/mnt/SDCARD/trimui/res/crossmix-os/bg-info.png" \ + -f "/mnt/SDCARD/System/resources/DejaVuSans.ttf" \ + -s 50 \ + -c "220,220,220" \ + -t "Generating thumbnails..." & +sleep 0.3 +pkill -f sdl2imgshow # Rename files to start with a capital letter find "$src_dir" -type f -iname "*.bmp" | while read -r bmp_file; do filename=$(basename "$bmp_file") dirname=$(dirname "$bmp_file") new_filename="$(echo "$filename" | awk '{print toupper(substr($0,1,1)) substr($0,2)}')" - # Lowercase extension - new_filename="$(echo "$new_filename" | sed 's/\.BMP$/.bmp/I')" - # replace underscores by spaces - # new_filename="$(echo "$new_filename" | sed 's/_/ /g')" + # Lowercase extension + new_filename="$(echo "$new_filename" | sed 's/\.BMP$/.bmp/I')" + # replace underscores by spaces + # new_filename="$(echo "$new_filename" | sed 's/_/ /g')" mv "$bmp_file" "$dirname/$new_filename" done sync @@ -52,7 +64,5 @@ sync rm -f "/mnt/SDCARD/Apps/BootLogo/Thumbnails/Thumbnails_cache7.db" echo "All conversions have been made." - sync exit - diff --git "a/System/starts/\302\260cutomization.sh" "b/System/starts/\302\260cutomization.sh" index 59e4220d..e92b8d83 100644 --- "a/System/starts/\302\260cutomization.sh" +++ "b/System/starts/\302\260cutomization.sh" @@ -21,6 +21,9 @@ version=$(cat /mnt/SDCARD/System/usr/trimui/crossmix-version.txt) if [ ! -e "/usr/trimui/fw_mod_done" ]; then + # Removing duplicated app + rm -rf /usr/trimui/apps/zformatter_fat32/ + # add pl language if [ ! -e "/usr/trimui/res/skin/pl.lang" ]; then cp "/mnt/SDCARD/trimui/res/lang/pl.lang" "/usr/trimui/res/lang/" @@ -39,9 +42,6 @@ if [ ! -e "/usr/trimui/fw_mod_done" ]; then cp /mnt/SDCARD/System/usr/trimui/res/apps/fn_editor/com.trimui.cpuperformance.sh /usr/trimui/apps/fn_editor/com.trimui.cpuperformance.sh cp /mnt/SDCARD/System/usr/trimui/res/apps/fn_editor/com.trimui.cpuperformance.sh /usr/trimui/scene/com.trimui.cpuperformance.sh - # Removing duplicated app - rm -rf /usr/trimui/apps/zformatter_fat32/ - # Apply default CrossMix theme, sound volume, and grid view cp /mnt/SDCARD/System/usr/trimui/scripts/MainUI_default_system.json /mnt/UDISK/system.json # sed -i "s|\"theme\":.*|\"theme\": \"/mnt/SDCARD/Themes/CrossMix - OS/\",|" "$system_json" @@ -60,41 +60,47 @@ if [ ! -e "/usr/trimui/fw_mod_done" ]; then fi ################ Flash boot logo ################ + CrossMixFWfile="/mnt/SDCARD/trimui/firmwares/MinFwVersion.txt" + Current_FW_Revision=$(grep 'DISTRIB_DESCRIPTION' /etc/openwrt_release | cut -d '.' -f 3) + Required_FW_Revision=$(sed -n '2p' "$CrossMixFWfile") - SOURCE_FILE="/mnt/SDCARD/Apps/BootLogo/Images/- CrossMix-OS.bmp" - TARGET_PARTITION="/dev/mmcblk0p1" - MOUNT_POINT="/mnt/emmcblk0p1" + if ! [ "$Current_FW_Revision" -gt "$Required_FW_Revision" ]; then # on firmware hotfix 9 there is less space than before on /dev/mmcblk0p1 so we avoid to flash the logo - echo "Mounting $TARGET_PARTITION to $MOUNT_POINT..." - mkdir -p $MOUNT_POINT - mount $TARGET_PARTITION $MOUNT_POINT + SOURCE_FILE="/mnt/SDCARD/Apps/BootLogo/Images/- CrossMix-OS.bmp" + TARGET_PARTITION="/dev/mmcblk0p1" + MOUNT_POINT="/mnt/emmcblk0p1" - if [ $? -ne 0 ]; then - echo "Failed to mount $TARGET_PARTITION." - fi + echo "Mounting $TARGET_PARTITION to $MOUNT_POINT..." + mkdir -p $MOUNT_POINT + mount $TARGET_PARTITION $MOUNT_POINT - if [ -f "$SOURCE_FILE" ]; then - echo "Moving "$SOURCE_FILE" to $MOUNT_POINT/bootlogo.bmp..." - cp "$SOURCE_FILE" $MOUNT_POINT/bootlogo.bmp if [ $? -ne 0 ]; then - echo "Failed to move bootlogo file." + echo "Failed to mount $TARGET_PARTITION." + fi + + if [ -f "$SOURCE_FILE" ]; then + echo "Moving "$SOURCE_FILE" to $MOUNT_POINT/bootlogo.bmp..." + cp "$SOURCE_FILE" $MOUNT_POINT/bootlogo.bmp + if [ $? -ne 0 ]; then + echo "Failed to move bootlogo file." + else + echo "Bootlogo file moved successfully." + fi + sync + sync + sleep 0.3 + sync else - echo "Bootlogo file moved successfully." + echo "Source bootlogo file does not exist." fi - sync - sync - sleep 0.3 - sync - else - echo "Source bootlogo file does not exist." - fi - echo "Unmounting $TARGET_PARTITION..." - umount $TARGET_PARTITION - rmdir $MOUNT_POINT + echo "Unmounting $TARGET_PARTITION..." + umount $TARGET_PARTITION + rmdir $MOUNT_POINT - touch "/usr/trimui/fw_mod_done" - sync + touch "/usr/trimui/fw_mod_done" + sync + fi fi ######################### CrossMix-OS at each boot #########################