Skip to content
Snippets Groups Projects
Commit 2a7aaf96 authored by Peter Senna Tschudin's avatar Peter Senna Tschudin Committed by Emanuele Aina
Browse files

Automatically move configuration files to persistent storage


This patch adds ETC_FILES_AUTO that contains a list of configuration
files that are moved to persistent storage during disk initialization.

It also adds a systemd service file to scan the persistent storage for
configuration files during boot. Minor changes were necessary so that
psdk exits cleanly when no persistent disks are found and when no
changes are required.

On first boot after configuring a persistent disk, systemd will show:

 user@apertis:~$ sudo systemctl status psdk-conf-scan.service
 ● psdk-conf-scan.service - Scan for configuration files on persistent storage
    Loaded: loaded (/etc/systemd/system/psdk-conf-scan.service; enabled; vendor preset: enabled)
    Active: active (exited) since Mon 2019-06-17 09:06:39 UTC; 19s ago
   Process: 473 ExecStart=/usr/bin/psdk -s (code=exited, status=0/SUCCESS)
  Main PID: 473 (code=exited, status=0/SUCCESS)

 Jun 17 09:06:39 apertis sudo[538]: pam_unix(sudo:session): session opened for user root by (uid=0)
 Jun 17 09:06:39 apertis sudo[538]: pam_unix(sudo:session): session closed for user root
 Jun 17 09:06:39 apertis sudo[547]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/mv -f /etc/cntlm.conf /etc/cntlm
 Jun 17 09:06:39 apertis sudo[547]: pam_unix(sudo:session): session opened for user root by (uid=0)
 Jun 17 09:06:39 apertis sudo[547]: pam_unix(sudo:session): session closed for user root
 Jun 17 09:06:39 apertis sudo[551]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/ln -sf /home/etc/cntlm.conf /etc
 Jun 17 09:06:39 apertis sudo[551]: pam_unix(sudo:session): session opened for user root by (uid=0)
 Jun 17 09:06:39 apertis sudo[551]: pam_unix(sudo:session): session closed for user root
 Jun 17 09:06:39 apertis psdk[473]: Using configuration file found on persistent storage. From now on, changes made to /etc/cn
 Jun 17 09:06:39 apertis systemd[1]: Started Scan for configuration files on persistent storage.

And then on following boots:

 user@apertis:~$ sudo systemctl status psdk-conf-scan.service
 ● psdk-conf-scan.service - Scan for configuration files on persistent storage
    Loaded: loaded (/etc/systemd/system/psdk-conf-scan.service; enabled; vendor preset: enabled)
    Active: active (exited) since Mon 2019-06-17 09:07:59 UTC; 5s ago
   Process: 471 ExecStart=/usr/bin/psdk -s (code=exited, status=0/SUCCESS)
  Main PID: 471 (code=exited, status=0/SUCCESS)

 Jun 17 09:07:59 apertis systemd[1]: Starting Scan for configuration files on persistent storage...
 Jun 17 09:07:59 apertis sudo[545]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/find /home/etc -type f
 Jun 17 09:07:59 apertis sudo[545]: pam_unix(sudo:session): session opened for user root by (uid=0)
 Jun 17 09:07:59 apertis sudo[545]: pam_unix(sudo:session): session closed for user root
 Jun 17 09:07:59 apertis psdk[471]: /etc/cntlm.conf is already on persistent storage. No action needed.
 Jun 17 09:07:59 apertis systemd[1]: Started Scan for configuration files on persistent storage.

Signed-off-by: default avatarPeter Senna Tschudin <peter.senna@collabora.com>
parent 437ef8b4
No related branches found
No related tags found
1 merge request!2V3
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment