3
0
Fork 0
forked from mirrors/nixpkgs

* Don't try to mount when the mount point isn't there yet.

* Run fsck.

svn path=/nixos/trunk/; revision=7458
This commit is contained in:
Eelco Dolstra 2006-12-21 20:08:15 +00:00
parent e3acce2f4f
commit 647db4dd2a
2 changed files with 12 additions and 2 deletions

View file

@ -33,7 +33,7 @@ import ../upstart-jobs/gather.nix {
# Mount file systems.
(import ../upstart-jobs/filesystems.nix {
inherit (pkgs) utillinux;
inherit (pkgs) utillinux e2fsprogs;
fileSystems = config.get ["fileSystems"];
})

View file

@ -1,4 +1,4 @@
{utillinux, fileSystems}:
{utillinux, e2fsprogs, fileSystems}:
let
@ -18,6 +18,8 @@ start on startup
start on new-devices
script
PATH=${e2fsprogs}/sbin:$PATH
mountPoints=(${toString mountPoints})
devices=(${toString devices})
fsTypes=(${toString fsTypes})
@ -39,6 +41,11 @@ script
fsType=\${fsTypes[$n]}
options=\${optionss[$n]}
if ! test -e \"$device\"; then
echo \"skipping $device, doesn't exist (yet)\"
continue
fi
# If $device is already mounted somewhere else, unmount it first.
# !!! Note: we use /etc/mtab, not /proc/mounts, because mtab
# contains more accurate info when using loop devices.
@ -63,6 +70,9 @@ script
echo \"mounting $device on $mountPoint\"
# !!! should do something with the result; also prevent repeated fscks.
fsck -a \"$device\" || true
if ${utillinux}/bin/mount -t \"$fsType\" -o \"$options\" \"$device\" \"$mountPoint\"; then
newDevices=1
fi