Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This script prepares a flash drive for a headless Raspberry Pi setup.
- # --- Configuration ---
- # Replace with your desired username
- USERNAME="pi"
- # Replace with your desired password
- PASSWORD="raspberry"
- # Replace with your Wi-Fi SSID
- WIFI_SSID="YOUR_WIFI_SSID"
- # Replace with your Wi-Fi password
- WIFI_PASSWORD="YOUR_WIFI_PASSWORD"
- # --- Script ---
- # Create userconf.txt for username and password
- echo "$USERNAME:$(echo $PASSWORD | openssl passwd -6 -stdin)" > userconf.txt
- # Create wpa_supplicant.conf for Wi-Fi
- cat > wpa_supplicant.conf << EOL
- ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
- update_config=1
- country=US
- network={
- ssid="$WIFI_SSID"
- psk="$WIFI_PASSWORD"
- }
- EOL
- # Enable SSH
- touch ssh
- echo "Setup complete. Please copy all generated files to the boot partition of your Raspberry Pi's SD card."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement