Enable local persistent storage

Machine-specific data, such as SSH keys, should not be included in the
immutable root filesystem image, as this would prevent multiple machines
running from the same image.  These few files can be stored locally, on
the SD card on eMMC flash.

The first time a machine boots up using this image, its local storage is
initialized.  This involves creating a new filesystem on the block
device and generating SSH host keys.  Once the storage is initialized,
it is remounted read-only.  All subsequent mounts are read-only as well.
This commit is contained in:
2022-04-04 20:53:10 -05:00
parent 14d0cdcec1
commit 2a0737ab78
5 changed files with 60 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
[Unit]
Description=Initialize Local Storage
DefaultDependencies=no
After=local-fs-pre.target
After=run-storage.mount
Before=etc-ssh.mount
Before=local-fs.target
Conflicts=shutdown.target
ConditionPathExists=!/run/storage/ssh
[Service]
Type=oneshot
ExecStart=/usr/local/libexec/init-localstorage.sh
[Install]
WantedBy=run-storage.mount

View File

@@ -0,0 +1 @@
../init-localstorage.service