coreos-base/oem-gce: bring back shutdown scripts

In the `init.sh` of the OEM GCE container, we have the following
section:

```bash
wait -n "${daemon_pids[@]}" || :
kill "${daemon_pids[@]}" || :

test -n "$stopping" || exit 1

exec /usr/bin/google_metadata_script_runner --script-type shutdown
```

`shutdown` script was not executed because container was receiving a
`SIGKILL`, the started processes was not properly terminated.

According to the `systemd-nspawn` manual:
```bash
If --boot is not used and this option is not specified
the container's processes are terminated abruptly via SIGKILL
```

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Mathieu Tortuyaux 2022-05-23 17:54:48 +02:00
parent b6526733fb
commit ebb6f281e7

View File

@ -25,7 +25,7 @@ ExecStartPre=/usr/bin/umount /var/lib/flatcar-oem-gce.img
Environment=SYSTEMD_NSPAWN_API_VFS_WRITABLE=1
ExecStart=/usr/bin/systemd-nspawn --keep-unit --register=no --link-journal=no \
--machine=oem-gce --capability=CAP_NET_ADMIN --bind=/dev/log --bind=/run/systemd --tmpfs=/run/lock --bind=/etc --bind=/home --bind-ro=/usr/share/google-oslogin/nsswitch.conf \
--read-only --volatile=overlay --image=/var/lib/flatcar-oem-gce.img /init.sh
--read-only --volatile=overlay --image=/var/lib/flatcar-oem-gce.img --kill-signal=SIGTERM /init.sh
[Install]
WantedBy=multi-user.target