#!/bin/bash # Raspberry Pi First-Boot Script # Place this file on the bootfs partition as 'firstrun.sh' to execute on first boot. # It will trigger the autosetup.sh script located in /boot/autosetup.sh BOOT_SCRIPT="/boot/firmware/autosetup.sh" # For older Raspberry Pi OS versions, the boot partition is mounted at /boot if [ ! -f "$BOOT_SCRIPT" ]; then BOOT_SCRIPT="/boot/autosetup.sh" fi if [ -f "$BOOT_SCRIPT" ]; then echo "Found autosetup script at $BOOT_SCRIPT" chmod +x "$BOOT_SCRIPT" # Run as the default user (usually pi) sudo -u pi bash "$BOOT_SCRIPT" else echo "No autosetup.sh found on boot partition." fi