Works with both RaspiOS desktop and lite images.
Raspberry Pi OS with desktop
curl -O https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2021-03-25/2021-03-04-raspios-buster-armhf.zip
unzip 2021-03-04-raspios-buster-armhf.zip
Raspberry Pi OS Lite
curl -O https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-03-25/2021-03-04-raspios-buster-armhf-lite.zip
unzip 2021-03-04-raspios-buster-armhf-lite.zip
(requires root, an armhf system (RasPi or VM) and Internet connectivity; to cross-build, apt-get install qemu-user-static binfmt-support; custom packages can be placed in debs-to-install/):
customize_image.sh <raspbian-image>
(requires root and Internet connectivity):
collect_sources.sh <raspbian-image> /media/usbstick