nixos/geoipupdate: Add error handling to scripts

This commit is contained in:
talyz 2022-03-28 15:04:31 +02:00
parent 5d0fa80cce
commit 23c15323ce
No known key found for this signature in database
GPG Key ID: 2DED2151F4671A2B

View File

@ -102,6 +102,9 @@ in
systemd.services.geoipupdate-create-db-dir = {
serviceConfig.Type = "oneshot";
script = ''
set -o errexit -o pipefail -o nounset -o errtrace
shopt -s inherit_errexit
mkdir -p ${cfg.settings.DatabaseDirectory}
chmod 0755 ${cfg.settings.DatabaseDirectory}
'';
@ -135,6 +138,9 @@ in
geoipupdateConf = pkgs.writeText "geoipupdate.conf" (geoipupdateKeyValue cfg.settings);
script = ''
set -o errexit -o pipefail -o nounset -o errtrace
shopt -s inherit_errexit
chown geoip "${cfg.settings.DatabaseDirectory}"
cp ${geoipupdateConf} /run/geoipupdate/GeoIP.conf