Skip to content

Commit

Permalink
nixos/wpa_supplicant: prefer 'install' over 'touch/chmod/mkdir/chgrp'
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornfor committed May 1, 2021
1 parent 6dab4db commit 5d47dc7
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions nixos/modules/services/networking/supplicant.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,10 @@ let

preStart = ''
${optionalString (suppl.configFile.path!=null) ''
touch -a ${suppl.configFile.path}
chmod 600 ${suppl.configFile.path}
(umask 077 && touch -a "${suppl.configFile.path}")
''}
${optionalString suppl.userControlled.enable ''
if ! test -e ${suppl.userControlled.socketDir}; then
mkdir -m 0770 -p ${suppl.userControlled.socketDir}
chgrp ${suppl.userControlled.group} ${suppl.userControlled.socketDir}
fi
if test "$(stat --printf '%G' ${suppl.userControlled.socketDir})" != "${suppl.userControlled.group}"; then
echo "ERROR: bad ownership on ${suppl.userControlled.socketDir}" >&2
exit 1
fi
install -dm770 -g "${suppl.userControlled.group}" "${suppl.userControlled.socketDir}"
''}
'';

Expand Down

0 comments on commit 5d47dc7

Please sign in to comment.