* nfsd: run rpc.nfsd from the pre-start script since it's not actually
a daemon (it just starts some kernel threads). In the post-stop script, stop the kernel threads. * exportfs: fix the createMountPoints option. * Mount the nfsd filesystem on /proc/fs/nfsd because mountd prefers this. svn path=/nixos/branches/boot-order/; revision=22187
This commit is contained in:
parent
3eac003800
commit
a9e8bf6491
@ -8,6 +8,8 @@ let
|
|||||||
|
|
||||||
cfg = config.services.nfsKernel;
|
cfg = config.services.nfsKernel;
|
||||||
|
|
||||||
|
exports = pkgs.writeText "exports" cfg.server.exports;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -82,7 +84,7 @@ in
|
|||||||
});
|
});
|
||||||
|
|
||||||
environment.etc = mkIf cfg.server.enable (singleton
|
environment.etc = mkIf cfg.server.enable (singleton
|
||||||
{ source = pkgs.writeText "exports" cfg.server.exports;
|
{ source = exports;
|
||||||
target = "exports";
|
target = "exports";
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,19 +102,23 @@ in
|
|||||||
''
|
''
|
||||||
export PATH=${pkgs.nfsUtils}/sbin:$PATH
|
export PATH=${pkgs.nfsUtils}/sbin:$PATH
|
||||||
mkdir -p /var/lib/nfs
|
mkdir -p /var/lib/nfs
|
||||||
|
|
||||||
${config.system.sbin.modprobe}/sbin/modprobe nfsd || true
|
${config.system.sbin.modprobe}/sbin/modprobe nfsd || true
|
||||||
|
|
||||||
|
${pkgs.sysvtools}/bin/mountpoint -q /proc/fs/nfsd \
|
||||||
|
|| ${config.system.sbin.mount}/bin/mount -t nfsd none /proc/fs/nfsd
|
||||||
|
|
||||||
${optionalString cfg.server.createMountPoints
|
${optionalString cfg.server.createMountPoints
|
||||||
''
|
''
|
||||||
# create export directories:
|
# create export directories:
|
||||||
# skip comments, take first col which may either be a quoted
|
# skip comments, take first col which may either be a quoted
|
||||||
# "foo bar" or just foo (-> man export)
|
# "foo bar" or just foo (-> man export)
|
||||||
sed '/^#.*/d;s/^"\([^"]*\)".*/\1/;t;s/[ ].*//' ${cfg.server.exports} \
|
sed '/^#.*/d;s/^"\([^"]*\)".*/\1/;t;s/[ ].*//' ${exports} \
|
||||||
| xargs -d '\n' mkdir -p
|
| xargs -d '\n' mkdir -p
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
# exports file is ${cfg.server.exports}
|
# exports file is ${exports}
|
||||||
# keep this comment so that this job is restarted whenever exports changes!
|
# keep this comment so that this job is restarted whenever exports changes!
|
||||||
exportfs -ra
|
exportfs -ra
|
||||||
'';
|
'';
|
||||||
@ -128,7 +134,9 @@ in
|
|||||||
startOn = "started nfs-kernel-exports and started portmap";
|
startOn = "started nfs-kernel-exports and started portmap";
|
||||||
stopOn = "stopping nfs-kernel-exports";
|
stopOn = "stopping nfs-kernel-exports";
|
||||||
|
|
||||||
exec = "${pkgs.nfsUtils}/sbin/rpc.nfsd ${if cfg.server.hostName != null then "-H ${cfg.server.hostName}" else ""} ${builtins.toString cfg.server.nproc}";
|
preStart = "${pkgs.nfsUtils}/sbin/rpc.nfsd ${if cfg.server.hostName != null then "-H ${cfg.server.hostName}" else ""} ${builtins.toString cfg.server.nproc}";
|
||||||
|
|
||||||
|
postStop = "${pkgs.nfsUtils}/sbin/rpc.nfsd 0";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ in
|
|||||||
+ " " + fs.fsType
|
+ " " + fs.fsType
|
||||||
+ " " + fs.options
|
+ " " + fs.options
|
||||||
+ " 0"
|
+ " 0"
|
||||||
+ " " + (if fs.mountPoint == "/" then "1" else "2")
|
+ " " + (if fs.fsType == "none" then "0" else if fs.mountPoint == "/" then "1" else "2")
|
||||||
+ "\n"
|
+ "\n"
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -187,8 +187,6 @@ in
|
|||||||
|
|
||||||
task = true;
|
task = true;
|
||||||
|
|
||||||
stopOn = "filesystem";
|
|
||||||
|
|
||||||
extraConfig = "console owner";
|
extraConfig = "console owner";
|
||||||
|
|
||||||
script =
|
script =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user