wrappers: use new systemd.IsActive in core18 early boot
The systemd.Status() call in early boot may not work correctly.
For units that are not available it will error because there is
no unit type set. Because we only need to know if the unit is
active we need to use a new "systemd.IsActive()" helper.
We currently retry network operations on various high level errors
like 500. However we do not retry on network errors like DNS
connection refused. To fix that this PR will also retry when
we hit net.Error conditions that are marked as Temporary() (like
dns connection refused errors when the DNS server is not quite
ready yet).
This has also a couple of hacks detecting error messages
directly because of go1.6 behavior and Arch ATM using the cgo
resolver. We should try to work to not need them later.
wrappers: only restart service in core18 when they are active
This fixes the issue that on the very first boot the
snapd.seeded.service must not be restarted. This service has a
"Requires=snapd.socket" relation and that means that when we
seed and we start snapd.socket for the first time we must not
stop it or otherwise systemd will also stop snapd.seeded.service
which will means that systemd will start the units configured with
"After=snapd.seeded.service" which would be too early.
systemd: start snapd.autoimport.service in --no-block mode
When seeding in core18 we need to make sure that the
snadpd.autoimport.service is started in non-blocking mode. Otherwise
it would wait forever because it has a "After=snapd.seeding.service"
but the snapd.seeding.service will only finish if the code that
writes the core18 snapd units can run. So this prevents a deadlock.
Note that by starting it with --no-block the right thing will happen,
i.e. the unit is starting but waits until the snapd.seeded.service
is done and then it will run (which is what we want).
data/selinux: fix syntax error in definition of snappy_admin interface
The snappy_admin interface in snappy.if is incorrectly defined. It is missing a
start quote in the interface name. This causes sepolgen-ifgen to raise an error
when installing selinux-policy-devel package. The error is logged as follows:
/usr/share/selinux/devel/include/contrib/snappy.if: Syntax error on line 260 gen_require [type=GEN_REQ]
/usr/share/selinux/devel/include/contrib/snappy.if: Syntax error on line 263 ' [type=SQUOTE]
/usr/share/selinux/devel/include/contrib/snappy.if: Syntax error on line 273 ' [type=SQUOTE]