#!/bin/bash # Batocera Update Script - Version 40 # Date: 2024-12-10 # Set the Batocera image URL and download directory FILE_URL="https://updates.batocera.org/x86_64/stable/last/batocera-x86_64-40-20240801.img.gz" DOWNLOAD_DIR="/tmp" # Step 1: Download the specified Batocera image to /tmp echo "Downloading the Batocera image from $FILE_URL to $DOWNLOAD_DIR..." IMAGE_FILE="$DOWNLOAD_DIR/$(basename $FILE_URL)" curl -fSLo $IMAGE_FILE $FILE_URL # Step 2: Prompt the user to choose the target USB device echo "Identifying available USB drives..." echo "Available drives and descriptions:" lsblk -o NAME,SIZE,MODEL,TYPE | grep disk echo "" echo "WARNING: Be careful to select the correct drive. Writing to the wrong drive will erase all data on it." read -p "Enter the target drive name (e.g., sda, sdb, etc.): " TARGET_DRIVE if [ -z "$TARGET_DRIVE" ]; then echo "No drive selected. Exiting." exit 1 fi TARGET_PATH="/dev/$TARGET_DRIVE" # Confirm the user's choice echo "You selected $TARGET_PATH. Are you sure you want to proceed? (yes/no)" read -r CONFIRM if [ "$CONFIRM" != "yes" ]; then echo "Operation canceled by user." exit 1 fi # Step 3: Extract and write the image to the target drive IMAGE_FILE="$DOWNLOAD_DIR/$(basename $FILE_URL)" echo "Flashing Batocera image to $TARGET_PATH..." gunzip -c $IMAGE_FILE | sudo dd status=progress of=$TARGET_PATH conv=fsync sync sudo eject $TARGET_PATH echo "#================================================================================" echo "Image flashed and drive ejected." echo "#================================================================================" #================================================================================ # SSH Access # Access Batocera via SSH using one of the following: # Default username: root # Default password: linux echo "Access Batocera via SSH:" echo " ssh root@batocera.local or ssh root@" # Editing Boot Configuration echo "To edit the boot configuration:" echo " vi /boot/batocera-boot.conf" # Audio Setup echo "To configure audio settings:" echo "1. Run the following commands to list devices:" echo " aplay -L" echo " batocera-audio list" echo " batocera-audio list-profiles" echo "2. Adjust settings in the Batocera menu or KODI:" echo " - Navigate to System Settings > Hardware Audio Output." echo " - Ensure the audio profile matches your device." # Example: Checking KODI audio passthrough settings echo "To verify KODI settings:" echo " grep -RI hdmi .kodi/userdata/" echo "#================================================================================" echo "All tasks completed. Enjoy your Batocera setup!" echo "#================================================================================"