* Don't squeeze all the filesystem option values into one environment
variable, since they might get confused (NIXOS-84). svn path=/nixos/trunk/; revision=17919
This commit is contained in:
parent
feeff52285
commit
1e1ae9cd1e
@ -5,23 +5,12 @@ with pkgs.lib;
|
||||
let
|
||||
|
||||
fileSystems = config.fileSystems;
|
||||
mountPoints = map (fs: fs.mountPoint) 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;
|
||||
optionss = map (fs: fs.options) fileSystems;
|
||||
autocreates = map (fs: fs.autocreate) fileSystems;
|
||||
mount = config.system.sbin.mount;
|
||||
|
||||
task =
|
||||
''
|
||||
PATH=${pkgs.e2fsprogs}/sbin:${pkgs.utillinuxng}/sbin:$PATH
|
||||
|
||||
mountPoints=(${toString mountPoints})
|
||||
devices=(${toString devices})
|
||||
fsTypes=(${toString fsTypes})
|
||||
optionss=(${toString optionss})
|
||||
autocreates=(${toString autocreates})
|
||||
|
||||
newDevices=1
|
||||
|
||||
# If we mount any file system, we repeat this loop, because new
|
||||
@ -29,15 +18,13 @@ let
|
||||
# for loopback mounts).
|
||||
|
||||
while test -n "$newDevices"; do
|
||||
|
||||
newDevices=
|
||||
|
||||
for ((n = 0; n < ''${#mountPoints[*]}; n++)); do
|
||||
mountPoint=''${mountPoints[$n]}
|
||||
device=''${devices[$n]}
|
||||
fsType=''${fsTypes[$n]}
|
||||
options=''${optionss[$n]}
|
||||
autocreate=''${autocreates[$n]}
|
||||
${flip concatMapStrings fileSystems
|
||||
(fs: ''
|
||||
mountPoint='${fs.mountPoint}'
|
||||
device='${if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}"}'
|
||||
fsType='${fs.fsType}'
|
||||
|
||||
# A device is a pseudo-device (i.e. not an actual device
|
||||
# node) if it's not an absolute path (e.g. an NFS server
|
||||
@ -59,7 +46,7 @@ let
|
||||
if test "''${device:0:2}" != //; then
|
||||
echo "remounting $device on $mountPoint"
|
||||
${mount}/bin/mount -t "$fsType" \
|
||||
-o remount,"$options" \
|
||||
-o remount,"${fs.options}" \
|
||||
"$device" "$mountPoint" || true
|
||||
fi
|
||||
continue
|
||||
@ -82,7 +69,7 @@ let
|
||||
if test "$prevMountPoint" = "$mountPoint"; then
|
||||
echo "remounting $device on $mountPoint"
|
||||
${mount}/bin/mount -t "$fsType" \
|
||||
-o remount,"$options" \
|
||||
-o remount,"${fs.options}" \
|
||||
"$device" "$mountPoint" || true
|
||||
continue
|
||||
fi
|
||||
@ -101,14 +88,17 @@ let
|
||||
fsck -a "$device" || true
|
||||
fi
|
||||
|
||||
if test "$autocreate" = 1; then mkdir -p "$mountPoint"; fi
|
||||
${optionalString fs.autocreate
|
||||
''
|
||||
mkdir -p "$mountPoint"
|
||||
''
|
||||
}
|
||||
|
||||
if ${mount}/bin/mount -t "$fsType" -o "$options" "$device" "$mountPoint"; then
|
||||
newDevices=1
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
'')
|
||||
}
|
||||
done
|
||||
'';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user