nixos/printing: fix ShellCheck issues

ShellCheck reports the following:

> SC2174 (warning): When used with -p, -m only applies to the deepest
> directory.

Avoid this warning by splitting `mkdir -m MODE -p DIR` into
`(umask MASK && mkdir -p DIR)`.
This commit is contained in:
Victor Engmark 2024-11-20 14:54:00 +13:00 committed by Bjørn Forsman
parent eeab2e4e5e
commit bfe7bb410f

View File

@ -384,14 +384,11 @@ in
preStart = lib.optionalString cfg.stateless ''
rm -rf /var/cache/cups /var/lib/cups /var/spool/cups
'' + ''
mkdir -m 0700 -p /var/cache/cups
mkdir -m 0700 -p /var/spool/cups
mkdir -m 0755 -p ${cfg.tempDir}
mkdir -m 0755 -p /var/lib/cups
(umask 077 && mkdir -p /var/cache/cups /var/spool/cups)
(umask 022 && mkdir -p ${cfg.tempDir} /var/lib/cups)
# While cups will automatically create self-signed certificates if accessed via TLS,
# this directory to store the certificates needs to be created manually.
mkdir -m 0700 -p /var/lib/cups/ssl
(umask 077 && mkdir -p /var/lib/cups/ssl)
# Backwards compatibility
if [ ! -L /etc/cups ]; then