mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
Merge pull request #304340 from Stunkymonkey/postsrsd-chmod-install
nixos/postsrsd: prefer 'install' over 'chmod/chown'
This commit is contained in:
commit
f5263306d8
@ -120,14 +120,9 @@ in {
|
||||
if [ ! -e "${cfg.secretsFile}" ]; then
|
||||
echo "WARNING: secrets file not found, autogenerating!"
|
||||
DIR="$(dirname "${cfg.secretsFile}")"
|
||||
if [ ! -d "$DIR" ]; then
|
||||
mkdir -p -m750 "$DIR"
|
||||
chown "${cfg.user}:${cfg.group}" "$DIR"
|
||||
fi
|
||||
dd if=/dev/random bs=18 count=1 | base64 > "${cfg.secretsFile}"
|
||||
chmod 600 "${cfg.secretsFile}"
|
||||
install -m 750 -o ${cfg.user} -g ${cfg.group} -d "$DIR"
|
||||
install -m 600 -o ${cfg.user} -g ${cfg.group} <(dd if=/dev/random bs=18 count=1 | base64) "${cfg.secretsFile}"
|
||||
fi
|
||||
chown "${cfg.user}:${cfg.group}" "${cfg.secretsFile}"
|
||||
'';
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user