mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-20 20:53:48 +00:00
* 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:
parent
e3acce2f4f
commit
647db4dd2a
@ -33,7 +33,7 @@ import ../upstart-jobs/gather.nix {
|
|||||||
|
|
||||||
# Mount file systems.
|
# Mount file systems.
|
||||||
(import ../upstart-jobs/filesystems.nix {
|
(import ../upstart-jobs/filesystems.nix {
|
||||||
inherit (pkgs) utillinux;
|
inherit (pkgs) utillinux e2fsprogs;
|
||||||
fileSystems = config.get ["fileSystems"];
|
fileSystems = config.get ["fileSystems"];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{utillinux, fileSystems}:
|
{utillinux, e2fsprogs, fileSystems}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
@ -18,6 +18,8 @@ start on startup
|
|||||||
start on new-devices
|
start on new-devices
|
||||||
|
|
||||||
script
|
script
|
||||||
|
PATH=${e2fsprogs}/sbin:$PATH
|
||||||
|
|
||||||
mountPoints=(${toString mountPoints})
|
mountPoints=(${toString mountPoints})
|
||||||
devices=(${toString devices})
|
devices=(${toString devices})
|
||||||
fsTypes=(${toString fsTypes})
|
fsTypes=(${toString fsTypes})
|
||||||
@ -39,6 +41,11 @@ script
|
|||||||
fsType=\${fsTypes[$n]}
|
fsType=\${fsTypes[$n]}
|
||||||
options=\${optionss[$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.
|
# If $device is already mounted somewhere else, unmount it first.
|
||||||
# !!! Note: we use /etc/mtab, not /proc/mounts, because mtab
|
# !!! Note: we use /etc/mtab, not /proc/mounts, because mtab
|
||||||
# contains more accurate info when using loop devices.
|
# contains more accurate info when using loop devices.
|
||||||
@ -63,6 +70,9 @@ script
|
|||||||
|
|
||||||
echo \"mounting $device on $mountPoint\"
|
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
|
if ${utillinux}/bin/mount -t \"$fsType\" -o \"$options\" \"$device\" \"$mountPoint\"; then
|
||||||
newDevices=1
|
newDevices=1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user