Custom Services
Creating Custom Services
Section titled “Creating Custom Services”Guide to creating new service modules.
Service Structure
Section titled “Service Structure”images/debian/services/myservice/├── setup.sh # Package installation (runs in QEMU)├── first-boot/init.sh # Runtime config (runs on first boot)├── setupfiles/ # Static files → /etc/setupfiles/├── depends.sh # Optional: dependencies└── motd.sh # Optional: MOTD bannerQuick Template
Section titled “Quick Template”# Create servicemkdir -p images/debian/services/myservice/first-boot
# Package installationcat > images/debian/services/myservice/setup.sh <<'EOF'#!/bin/bashset -eapt updateapt install -y nginxsystemctl enable nginxEOFchmod +x images/debian/services/myservice/setup.sh
# Runtime configurationcat > images/debian/services/myservice/first-boot/init.sh <<'EOF'#!/bin/bashset -esystemctl start nginxEOFchmod +x images/debian/services/myservice/first-boot/init.sh
# Build./bin/autobuild --image debian/myserviceScript Guidelines
Section titled “Script Guidelines”setup.sh (runs in QEMU):
- Install packages
- Configure system
- Enable services (don’t start them)
first-boot/init.sh (runs on Raspberry Pi):
- Detect hardware
- Download large files
- Create containers/VMs
- Start services
Dependencies
Section titled “Dependencies”Create depends.sh:
DEPENDS_ON="qemu" # This service requires qemuAdvanced Topics
Section titled “Advanced Topics”For detailed information see Services Guide:
- Service lifecycle
- Hardware detection
- Best practices
- Debugging