Modules/Impermanence: Fix home ownership service
This commit is contained in:
@ -155,8 +155,9 @@ in {
|
|||||||
# Don't chown if NFS shares are already mounted.
|
# Don't chown if NFS shares are already mounted.
|
||||||
# This can happen outside of regular booting (e.g. nixos-rebuild switch),
|
# This can happen outside of regular booting (e.g. nixos-rebuild switch),
|
||||||
# so we don't return an error.
|
# so we don't return an error.
|
||||||
nfs_mounts=$(grep ' nfs4 ' /proc/mounts)
|
# NOTE: Use || true as NixOS sets the damn -e, otherwise this unit fails on boot!
|
||||||
if [ -n "$nfs_mounts" ]; then
|
nfs_mounts=$(grep ' nfs4 ' /proc/mounts || true)
|
||||||
|
if [[ -n "$nfs_mounts" ]]; then
|
||||||
echo "NFS shares are mounted into the home directory, aborting:"
|
echo "NFS shares are mounted into the home directory, aborting:"
|
||||||
echo "$nfs_mounts"
|
echo "$nfs_mounts"
|
||||||
exit 0
|
exit 0
|
||||||
@ -169,6 +170,7 @@ in {
|
|||||||
echo "Set ownership for ${homeDir} to ${homeUser}:${homeGroup}"
|
echo "Set ownership for ${homeDir} to ${homeUser}:${homeGroup}"
|
||||||
else
|
else
|
||||||
echo "ERROR: Home ${homeDir} does not exist!"
|
echo "ERROR: Home ${homeDir} does not exist!"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user