Basic working version generates sounds and graphics
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
MOUNT_POINT=$1
|
||||
|
||||
# Function to fetch firmware dependencies
|
||||
fetch_dependencies() {
|
||||
FIRMWARE_URL="https://github.com/raspberrypi/firmware/raw/master/boot"
|
||||
REQUIRED_FILES="bootcode.bin start.elf"
|
||||
|
||||
for f in $REQUIRED_FILES; do
|
||||
if [ ! -f "$f" ]; then
|
||||
echo "File '$f' not found. Downloading from official repo..."
|
||||
if command -v wget >/dev/null 2>&1; then
|
||||
wget -q --show-progress "$FIRMWARE_URL/$f" -O "$f"
|
||||
elif command -v curl >/dev/null 2>&1; then
|
||||
curl -L -o "$f" "$FIRMWARE_URL/$f"
|
||||
else
|
||||
echo "Error: Neither wget nor curl found. Cannot download $f."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ -z "$MOUNT_POINT" ]; then
|
||||
if command -v lsblk >/dev/null 2>&1; then
|
||||
echo "Scanning for mounted removable storage..."
|
||||
OPTIONS=()
|
||||
MOUNTPOINTS=()
|
||||
while IFS= read -r line; do
|
||||
eval "$line"
|
||||
if [ "$RM" == "1" ] && [ -n "$MOUNTPOINT" ]; then
|
||||
OPTIONS+=("$NAME ($SIZE) mounted at $MOUNTPOINT")
|
||||
MOUNTPOINTS+=("$MOUNTPOINT")
|
||||
fi
|
||||
done < <(lsblk -P -o NAME,SIZE,MOUNTPOINT,RM)
|
||||
|
||||
if [ ${#OPTIONS[@]} -eq 0 ]; then
|
||||
echo "No mounted removable devices found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Select the SD card partition to deploy to:"
|
||||
select opt in "${OPTIONS[@]}"; do
|
||||
if [ -n "$opt" ]; then
|
||||
MOUNT_POINT="${MOUNTPOINTS[$((REPLY-1))]}"
|
||||
break
|
||||
else
|
||||
echo "Invalid selection."
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Usage: $0 <path_to_sd_card_mount_point>"
|
||||
echo "Example: $0 /media/user/RASPIBOOT"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d "$MOUNT_POINT" ]; then
|
||||
echo "Error: Mount point '$MOUNT_POINT' not found or is not a directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fetch_dependencies || exit 1
|
||||
|
||||
distrobox enter "pi-synth-dev" -- ./build.sh || exit 1
|
||||
|
||||
echo "Deploying to $MOUNT_POINT..."
|
||||
|
||||
for f in kernel.img bootcode.bin start.elf; do
|
||||
if [ ! -f "$f" ]; then
|
||||
echo "Error: Required file '$f' not found. Make sure you have run ./build.sh and downloaded the firmware."
|
||||
exit 1
|
||||
fi
|
||||
echo "Copying $f..."
|
||||
cp "$f" "$MOUNT_POINT/"
|
||||
done
|
||||
|
||||
echo "Deployment complete. Unmounting..."
|
||||
sync # Ensure all writes are finished
|
||||
umount "$MOUNT_POINT"
|
||||
echo "SD card is safe to remove."
|
||||
Reference in New Issue
Block a user