Skip to content

Commit

Permalink
Updates fixes
Browse files Browse the repository at this point in the history
- Typo fixes
- LOG_FILE variables fixed
- Use the new System/bin/shutdown script for reboot and shutdown during update
- Use the new System/bin/shutdown script in reboot app
- Scraper will build its database if Emus/show.json doesn't exist
  • Loading branch information
cizia64 committed Jul 15, 2024
1 parent 1f7bac7 commit 97777de
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Apps/Reboot/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ fi

sync
sleep 0.3
reboot
/mnt/SDCARD/System/bin/shutdown -r
8 changes: 8 additions & 0 deletions Apps/Scraper/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ database_file="/mnt/SDCARD/Apps/Scraper/Menu/Menu_cache7.db"
crc_Emus_file="/mnt/SDCARD/Apps/Scraper/show_json_crc.txt"
crc_DB_file="/mnt/SDCARD/Apps/Scraper/current_crc_DB.txt"

if [ ! -f "$show_json_path" ]; then
/mnt/SDCARD/Apps/EmuCleaner/launch.sh -s
rm "$database_file"
rm "$crc_Emus_file"
sync
fi


# Calculate current CRC32 of show.json (list of displayed emulators) and Menu_cache7.db
current_crc_Emus=$(crc32 "$show_json_path" | awk '{print $1}')
current_crc_DB=$(crc32 "$database_file" | awk '{print $1}')
Expand Down
2 changes: 1 addition & 1 deletion System/starts/_FirmwareCheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ -n "$UPDATE_FILE" ]; then
if [ "$(echo "$update_version" | tr -d '.')" -gt "$(echo "$initial_version" | tr -d '.')" ]; then
echo "The CrossMix update file (v$update_version) is greater than the current version installed ($initial_version)."

if [ ! -f "/mnt/SDCARD/trimui/res/crossmix-os/bg_info.png" ] ||
if [ ! -f "/mnt/SDCARD/trimui/res/crossmix-os/bg-info.png" ] ||
[ ! -f "/mnt/SDCARD/System/bin/sdl2imgshow" ] ||
[ ! -f "/mnt/SDCARD/System/usr/trimui/scripts/crossmix_update.sh" ] ||
[ ! -f "/mnt/SDCARD/System/usr/trimui/scripts/getkey.sh" ] ||
Expand Down
9 changes: 9 additions & 0 deletions System/starts/°customization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ if [ "$version" != "$FW_patched_version" ]; then
cp /mnt/SDCARD/System/usr/trimui/res/apps/fn_editor/com.trimui.cpuperformance.sh /usr/trimui/scene/com.trimui.cpuperformance.sh

# Apply default CrossMix theme, sound volume, and grid view
if [ ! -f /mnt/UDISK/system.json ]; then
cp /mnt/SDCARD/System/usr/trimui/scripts/MainUI_default_system.json /mnt/UDISK/system.json
else
/usr/trimui/bin/systemval theme "/mnt/SDCARD/Themes/CrossMix - OS/"
/usr/trimui/bin/systemval menustylel1 1
/usr/trimui/bin/systemval bgmvol 10
fi

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"

# we set the customization flag
Expand Down
35 changes: 21 additions & 14 deletions System/usr/trimui/scripts/crossmix_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if [ -z "$initial_version" ]; then
fi
update_version=$(echo "$UPDATE_FILE" | awk -F'_v|\.zip' '{print $2}')


# infoscreen.sh -m "test OK." -t 1
cp /mnt/SDCARD/System/bin/7zz /tmp
rm -rf "/mnt/SDCARD/System Volume Information"
Expand All @@ -38,24 +37,30 @@ fi
mkdir -p "$BCK_DIR"
sync

LOG_FILE="/mnt/SDCARD/_Updates/CrossMix_v$update_version_$timestamp.log"
LOG_FILE="/mnt/SDCARD/_Updates/CrossMix_v${update_version}_${timestamp}.log"
exec > >(tee -a "$LOG_FILE") 2>&1

echo "=========================================================================================="
echo "============== Updating CrossMix-OS v$initial_version to v$update_version =============="

echo " ============== Updating CrossMix-OS v$initial_version to v$update_version =============="

check_available_space() {
echo "=========================================================================================="
echo " ============== Checking available space on the SD Card =============="
echo "=========================================================================================="
echo " ============== Checking available space on the SD Card =============="
# Available space in MB
mount_point=$(mount | grep -m 1 '/mnt/SDCARD' | awk '{print $1}')
available_space=$(df -m $mount_point | awk 'NR==2{print $4}')
echo "Available space: $available_space MB"
echo "Available space: $available_space MB"
# Check available space
if [ "$available_space" -lt "4000" ]; then
echo -e "${RED}Available space is insufficient on SD card${NC}\n"
echo "CrossMix-OS update requires 4 GB of free space. Exiting."
echo "CrossMix-OS update requires 4 GB of free space. Shutdown now."
sleep 10
if [ -f /mnt/SDCARD/System/bin/shutdown ]; then
/mnt/SDCARD/System/bin/shutdown
else
poweroff &
fi
sleep 30
# infoscreen.sh -m "CrossMix-OS update requires 4 GB of free space." -t 5
exit 1
fi
Expand All @@ -73,7 +78,6 @@ move_items() {
/mnt/SDCARD/_Updates
$UPDATE_FILE
"


for item in /mnt/SDCARD/*; do
excluded=0
Expand Down Expand Up @@ -131,7 +135,6 @@ else
# infoscreen.sh -m "CrossMix v$update_version extraction encountered errors." -t 5
fi


echo "=========================================================================================="
echo " ============== Restore saves and savestates... =============="
# Restore files from backup
Expand Down Expand Up @@ -221,12 +224,16 @@ rm /mnt/SDCARD/Apps/Scraper/Menu/Menu_cache7.db
echo "=========================================================================================="
echo " ============== Installation completed, rebooting in 10 seconds... =============="

echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1008000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1008000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1008000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1008000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
rm /tmp/stay_awake
sync
sleep 10

reboot &
if [ -f /mnt/SDCARD/System/bin/shutdown ]; then
/mnt/SDCARD/System/bin/shutdown -r
else
reboot &
fi
sleep 30

0 comments on commit 97777de

Please sign in to comment.