elementary / switchboard-plug-parental-controls

Switchboard Screen Time & Limits Plug
https://elementary.io
GNU General Public License v3.0
11 stars 14 forks source link

Separate default and run-time config file #155

Open davidak opened 2 years ago

davidak commented 2 years ago

Problem

I'm packaging this for NixOS (https://github.com/NixOS/nixpkgs/pull/140430).

The Nix packages are read-only, so when the config file is installed from the package, it can not be changed at runtime.

Also, generally, files in /etc are supposed to be edited manually by the sysadmin, not by a service.

Oct 10 07:08:42 gaming pantheon-parent[7005]: UserConfig.vala:76: Could not find daemon config file: /etc/pantheon-parental-controls/daemon.conf does not exist
Oct 10 07:08:42 gaming pantheon-parent[7005]: UserConfig.vala:167: Failed to create file “etc/pantheon-parental-controls/daemon.conf.IUKEB1”: No such file or directory

Proposal

Deliver the default config file in datadir (share) in the package.

At run-time, check for the config file in localstatedir (var). If it does not exist, copy the default config.

Keen in mind that the default config file in the nix package is read-only, so copy (or write) the file in a way that it is writable.

Prior Art (Optional)

No response