Re: [02/05] Embedded with systemd: systemd and different modes

Andrei POPESCU <[email protected]> Mon, 17 Nov 2014 08:40:07 +0200
Newsgroups gmane.linux.debian.devel.embedded,gmane.linux.debian.user
Message-ID <[email protected]>
On Du, 16 nov 14, 20:52:13, Robert wrote:
> 
> To help with field debugging I currently check the state of one of the
> buttons at startup and if it is pressed, the unit starts the 802.11 in
> host (hostapd) mode and starts sshd.
> 
> This was trivial to configure with /sbin/init calling a shellscript that
> checks the GPIO and then chooses between two different runlevels. The
> runlevels are setup by making a few symlinks in rcx.d.
> 
> Since it is not possible to make decisions in systemd unit files, this
> has become much harder. I have a solution for this, but it is smelly.
> How would you solve this? This is quite a common use case (at least in
> the world I live in), and I will post my solution later but I don't want
> to poison anybodies thinking right now.

Just by having a quick look at the manpages, you have all the various 
Condition* directives (see systemd.unit(5)) and ExecStartPre= (see 
systemd.service(5)).

Maybe it would help if you posted your script?

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
http://nuvreauspam.ro/gpg-transition.txt
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJUaZhGAAoJEP/HhUTvIjQcVnQP/0CVkD1yXC1J1przLx00mfFY
H+O8EqaOCDZ6FqRWJbUl7RMO8WwOJuPfoaSkZUOZn8ed3+H50fYgV/5n0UqNm007
mIq3ZnJjadn09mqZ1PNGoG713Z8wWjDnv30yVZ3JcNVh/AXTz+9ZCIswFThSSt31
Z3T5yPmelhcf+1/HQWqubYgACM9FfT8X4DcGQPO6DNWgterLwJH2w2VekUGOTjhi
7ptuWLtfBzuQ/r9CWApj2JQ0HTN8i2LBoL8U2ptlbYFN34gn3Uz/GIux8gP84IoK
czGe2QKMZd5Rn9crHa9g6MSKbZ9mMhJkLYLymtP5p7c80qnyihWUq9eOolag19MD
GnGxViHQDC4UmQxUsRBSz/lkj6WbAPlyxY7/E/YkUAomCY6k39MVBx9meo6sLdVn
MhAdCF1YriJA2ZICKYb9CmlQm7//IR5mtviGTXGrr65T8McFsUuWNMnt1LsN9OUf
HU3MTIAUU6cBe5sL7+1JIKHq2rO+0szAprhlw7JsLxGf3wrdEp5IpcKYZS3uTNvR
eUUZuAEi1IxRKvgYr67K8IbJFlDzHExBxJWD0QAvrT3o28X8H/lQAFs7VbJttLfU
xdf9vnG+HDFG/1xuL9Q/5DVEUJEc4aFJu7MIxLkVv3HLBi+waoTHgHvu+Hb4ICRn
6Gb6TyGsSDP/0cW5tsH6
=BtYN
-----END PGP SIGNATURE-----