dietpi-factory sets up new DietPi machines unattended. Describe the setup once in a profile - hostname, network, SSH, software - and deploy it to Proxmox containers and VMs, flashable images for the Pi and bare metal, or a Debian system that is already running. The machine boots headless and configures itself, driven by DietPi's own automation.
./factory.sh
The wizard asks for hostname, network, SSH server and key, password, software picks and an optional own first boot script, and writes profiles/<name>/. Profiles can contain passwords and keys, so the directory is gitignored - copy it to wherever the deployment script runs.
Every deployment script takes a profile directory as first argument (or the PROFILE_DIR variable). With the bash -c one liners the argument needs a placeholder in front, since the first word after the command becomes $0:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/mews-se/dietpi-factory/main/proxmox/create-dietpi-lxc.sh)" _ profiles/myprofile
Without a profile, minimal defaults are used: DHCP, headless, unattended, DietPi's own choices for everything else. ASSUME_DEFAULTS=1 skips all dialogs in the Proxmox scripts.
Run on the Proxmox host:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/mews-se/dietpi-factory/main/proxmox/create-dietpi-lxc.sh)"
Answer the dialogs (container ID, resources, storage, DHCP or static). A Debian container is created and converted to DietPi with the official dietpi-installer, then restarted so the first boot setup finishes on its own.
Run on the Proxmox host:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/mews-se/dietpi-factory/main/proxmox/create-dietpi-vm.sh)"
The official Proxmox qcow2 is downloaded, the profile is injected into the disk image before the first boot and the VM sets itself up unattended. The disk is grown when a larger size than the image's 8 GiB is requested. Both BIOS (default) and UEFI images are supported, UEFI gets OVMF and an EFI disk with Secure Boot ready, the images ship the signed Debian boot chain. The disk is attached with discard and SSD emulation so TRIM reaches thin storage.
Run as root on any Linux box:
sudo scripts/bake-image.sh RPi5 profiles/myprofile
The image argument is a name or search term matched against dietpi.com/downloads/images, a URL or a local file. A partial match like RPi5 opens a menu with the variants. Downloads are cached and verified in /var/cache/dietpi-factory and reused across runs. The result lands in build/ as a ready-to-flash .img for dd or Etcher. The output is published atomically; when two bakes write the same output name, the last one finished wins.
Run on the target machine (VPS, VM or bare metal):
bash -c "$(curl -fsSL https://raw.githubusercontent.com/mews-se/dietpi-factory/main/vps/convert-to-dietpi.sh)"
Treat it as a reinstall: everything outside the base system is removed, including user home directories. Hardware model and Debian release are detected automatically, and the profile's SSH key is installed for root before the reboot. Make sure the profile carries your SSH key before converting a remote machine. ASSUME_YES=1 skips the confirmation.
The machine finishes its first boot setup by itself and registers its hostname over DHCP. Log in as root or dietpi with the profile password, or with the profile's SSH key.
With the default password the first run setup logs two FAILED lines about "password (software check)": DietPi notices the default password and tries to prompt for a better one, which no one can answer unattended. Harmless, and gone as soon as the profile carries an own password (the wizard always asks for one).
factory.sh profile wizard, writes profiles/<name>/ (gitignored)
config/dietpi.txt base profile
proxmox/create-dietpi-lxc.sh LXC creator
proxmox/create-dietpi-vm.sh VM creator from the official Proxmox qcow2
scripts/bake-image.sh bakes a profile into an official image
vps/convert-to-dietpi.sh converts a running Debian system to DietPi
A generic DietPi LXC script pair in community-scripts layout lives in the ProxmoxVED fork, aimed at an upstream PR.
DietPi reads /boot/dietpi.txt at first boot. With AUTO_SETUP_AUTOMATED=1 the whole setup runs unattended and /boot/Automation_Custom_Script.sh runs at the end when provided. See the DietPi docs and dietpi.txt.
A few things learned the hard way: dietpi-installer replaces dietpi.txt (the profile is merged in afterwards), it removes ifupdown2 without a replacement (ifupdown is reinstalled), DISTRO_TARGET must be preset when there is no tty, and the installer stamps the branch it was launched from as the permanent dietpi-update target - the scripts point it back at master afterwards, or updates would never arrive.
DietPi by MichaIng does the actual heavy lifting, this factory just feeds its automation. The one liner style is borrowed from community-scripts and the VM import took inspiration from dazeb's proxmox-dietpi-installer.
MIT