Sorry for the vague subject!
What I want to achieve is a single filesystem image (for a Pi) that
can be installed on multiple devices (identical SD card contents) but
the list of systemd services that runs will depend on the MAC address
of the unit.
I can think of various ways to do it, I'm after thoughts as to the
best way (which probably isn't in my list!). My thoughts:
1. Have all "optional" services disabled but run a script on startup
which selectively starts them (ought to be OK but I'm not sure how
robust this would be and by starting manually I'd lose some of the
benefits of optimised startup and dependency management by systemd)
2. Modify the actual scripts that the services run so that they do all
start, but those that shouldn't run exit immediately. (Would work for
my own scripts but not for other system services.)
3. Use systemd "ConditionPathExists" or similar; have a unit which
starts first and creates temporary files for all optional units that
should start, then those units won't start if the temporary file
hasn't been created. Downside is that it means hacking unit files for
system services but might be more robust than (1)?
Note that I want the list of units started per MAC to be a single file
(per MAC or combined, I don't mind) - ie I don't want each service to
include the list of MACs that it starts for as that would be a
maintenance nightmare.
Any other suggestions, or comments about my ideas, or other thoughts?
--
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER