nfs-kernel:

fix creating directories by skipping comments and interpreting quotes,
 take input from ${exports} which may be different from /etc/exports
 which also restarts the service in this case updating the export list
 Also run rpc.statd in forground so that it doesn't get respawned

svn path=/nixos/trunk/; revision=17358
This commit is contained in:
Marc Weber 2009-09-23 00:54:09 +00:00
parent 478dd67532
commit e49ea46466

View File

@ -19,11 +19,12 @@ let
}; };
exports = mkOption { exports = mkOption {
default = "/etc/exports"; check = v: v != "/etc/exports"; # this won't work
description = " description = "
the file listing the directories to be exported. the file listing the directories to be exported.
install nfsUtils and run man exports to learn about its format. install nfsUtils and run man exports to learn about its format.
The exports setting can either be a file path or the file contents. The exports setting can either be a file path or the file contents.
Don't use /etc/exports. This won't work as nix will overwrite it.
"; ";
}; };
@ -92,17 +93,16 @@ mkIf config.services.nfsKernel.enable {
${if cfg.createMountPoints == true then ${if cfg.createMountPoints == true then
'' ''
cat /etc/exports | while read line # create export directories:
do # skip comments, take first col which may either be a quoted
for i in $line # "foo bar" or just foo (-> man export)
do sed '/^#.*/d;s/^"\([^"]*\)".*/\1/;t;s/[ ].*//' ${exports} \
mkdir -p $i | xargs -d '\n' mkdir -p
break
done
done
'' ''
else ""} else ""}
# exports file is ${exports}
# keep this comment so that this job is restarted whenever exports changes!
exportfs -ra exportfs -ra
end script end script
@ -146,7 +146,7 @@ mkIf config.services.nfsKernel.enable {
mkdir -p /var/lib/nfs mkdir -p /var/lib/nfs
end script end script
respawn ${pkgs.nfsUtils}/sbin/rpc.statd respawn ${pkgs.nfsUtils}/sbin/rpc.statd -F
''; '';
} }
]; ];