Here's another approach to creating what you want. Use sdm.
Copy the script below to your system and modify as desired. This is very basic but it will:You can have sdm install applications and pretty much configure anything using sdm plugins (Link is to the plugins docs).
The basic script:How to use it:
Copy the script below to your system and modify as desired. This is very basic but it will:
- Create a user (you probably want to change the username and password
)
- Configure the localization (L10n) settings
- You'll need to change some or all of the settings if you're not on the US West coast
- sudo sdm --info can display the acceptable settings for: timezone, locale, keymap, and wifi-country (e.g., sudo sdm --info timezone)
- Configure the hotspot with SSID "MyPiNet" and password "password"
- After you burn the IMG to a disk, boot the system. It will run through the final system configuration including completing the hotspot configuration, and reboot. After the 2nd boot the system will be fully configured and ready to go with the hotspot activated.
Code:
network:pv4-static-ip=192.168.14.32|ipv4-static-gateway=192.168.14.1|ipv4-static-dns=192.168.14.1
The basic script:
Code:
#!/bin/bash## Edit the text inside the EOF/EOF as appropriate for your configuration# ** Suggestion: Copy this file to somewhere in your path and edit your copy# (~/bin is a good location)function errexit() { echo -e "$1" exit 1}[ $EUID -eq 0 ] && sudo="" || sudo="sudo"img="$1"[ "$img" == "" ] && errexit "? No IMG specified"[ "$(type -t sdm)" == "" ] && errexit "? sdm is not installed"assets="."[ -f $assets/my.plugins ] && mv $assets/my.plugins $assets/my.plugins.1(cat <<EOF# Plugin List generated $(date +"%Y-%m-%d %H:%M:%S")user:deluser=piuser:adduser=bls|password=mypassworddisables:piwiz|triggerhappyL10n:locale=en_US.UTF-8|timezone=Americas/Los_Angeles|wificountry=UShotspot:ipforward=eth0EOF ) | bash -c "cat >|$assets/my.plugins"$sudo sdm --customize --plugin @$assets/my.plugins --reboot 10 --expand-root --regen-ssh-host-keys \ --extend --xmb 1024 --logwidth 192 $img
- Install sdm on your RasPiOS system
Code:
curl -L https://raw.githubusercontent.com/gitbls/sdm/master/EZsdmInstaller | bash
- Download a fresh, unxz'd and unmodified copy of the desired RasPiOS IMG. (I use 2024-11-19-raspios-arm64.img but any RasPiOS IMG will work).
- Use the above script to customize it
Code:
./customize 2024-11-19-raspios-arm64.img # Or whatever you call the script
- Burn the IMG to an SD card or SSD:Once you have the script configured and working for your network, simply change the configuration as needed for your friend and repeat the process.
Code:
sudo sdm --burn /dev/sdX --hostname myhostname 2024-11-19-raspios-arm64.img # Modify /dev/sdX as appropriate for your system
Questions? Best to post an issue on the sdm GitHub, but if you don't have a GitHub account, ask them here.
Statistics: Posted by bls — Thu Jan 30, 2025 11:40 pm