* fsck is no longer in e2fsprogs.
* Don't try to remount CIFS filesystems. * For devices specified by label, use /dev/disk/by-label instead of LABEL=. The initrd already did this. * Improved the flagging of pseudo devices. svn path=/nixos/trunk/; revision=17431
This commit is contained in:
parent
530c96761a
commit
684eb63658
@ -112,10 +112,9 @@ let
|
|||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
inherit (pkgs) e2fsprogs;
|
|
||||||
fileSystems = config.fileSystems;
|
fileSystems = config.fileSystems;
|
||||||
mountPoints = map (fs: fs.mountPoint) fileSystems;
|
mountPoints = map (fs: fs.mountPoint) fileSystems;
|
||||||
devices = map (fs: if fs.device != null then fs.device else "LABEL=" + fs.label) fileSystems;
|
devices = map (fs: if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}") fileSystems;
|
||||||
fsTypes = map (fs: fs.fsType) fileSystems;
|
fsTypes = map (fs: fs.fsType) fileSystems;
|
||||||
optionss = map (fs: fs.options) fileSystems;
|
optionss = map (fs: fs.options) fileSystems;
|
||||||
autocreates = map (fs: fs.autocreate) fileSystems;
|
autocreates = map (fs: fs.autocreate) fileSystems;
|
||||||
@ -127,7 +126,7 @@ let
|
|||||||
start on ip-up
|
start on ip-up
|
||||||
|
|
||||||
script
|
script
|
||||||
PATH=${e2fsprogs}/sbin:$PATH
|
PATH=${pkgs.e2fsprogs}/sbin:${pkgs.utillinuxng}/sbin:$PATH
|
||||||
|
|
||||||
mountPoints=(${toString mountPoints})
|
mountPoints=(${toString mountPoints})
|
||||||
devices=(${toString devices})
|
devices=(${toString devices})
|
||||||
@ -152,25 +151,29 @@ let
|
|||||||
options=''${optionss[$n]}
|
options=''${optionss[$n]}
|
||||||
autocreate=''${autocreates[$n]}
|
autocreate=''${autocreates[$n]}
|
||||||
|
|
||||||
isLabel=
|
# A device is a pseudo-device (i.e. not an actual device
|
||||||
if echo "$device" | grep -q '^LABEL='; then isLabel=1; fi
|
# node) if it's not an absolute path (e.g. an NFS server
|
||||||
|
# such as machine:/path), if it starts with // (a CIFS FS),
|
||||||
|
# a known pseudo filesystem (such as tmpfs), or the device
|
||||||
|
# is a directory (e.g. a bind mount).
|
||||||
isPseudo=
|
isPseudo=
|
||||||
if test "$fsType" = "nfs" || test "$fsType" = "tmpfs" ||
|
test "''${device:0:1}" != / -o "''${device:0:2}" = // -o "$fsType" = "tmpfs" \
|
||||||
test "$fsType" = "ext3cow"; then isPseudo=1; fi
|
-o -d "$device" && isPseudo=1
|
||||||
|
|
||||||
if ! test -n "$isLabel" -o -n "$isPseudo" -o -e "$device"; then
|
if ! test -n "$isPseudo" -o -e "$device"; then
|
||||||
echo "skipping $device, doesn't exist (yet)"
|
echo "skipping $device, doesn't exist (yet)"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# !!! quick hack: if mount point already exists, try a
|
# !!! quick hack: if the mount point is already mounted, try
|
||||||
# remount to change the options but nothing else.
|
# a remount to change the options but nothing else.
|
||||||
if cat /proc/mounts | grep -F -q " $mountPoint "; then
|
if cat /proc/mounts | grep -F -q " $mountPoint "; then
|
||||||
|
if test "''${device:0:2}" != //; then
|
||||||
echo "remounting $device on $mountPoint"
|
echo "remounting $device on $mountPoint"
|
||||||
${mount}/bin/mount -t "$fsType" \
|
${mount}/bin/mount -t "$fsType" \
|
||||||
-o remount,"$options" \
|
-o remount,"$options" \
|
||||||
"$device" "$mountPoint" || true
|
"$device" "$mountPoint" || true
|
||||||
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -178,8 +181,7 @@ let
|
|||||||
# !!! 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.
|
||||||
|
|
||||||
# !!! not very smart about labels yet; should resolve the label somehow.
|
if test -z "$isPseudo"; then
|
||||||
if test -z "$isLabel" -a -z "$isPseudo"; then
|
|
||||||
|
|
||||||
device=$(readlink -f "$device")
|
device=$(readlink -f "$device")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user