* 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
|
let
|
||||||
|
|
||||||
fileSystems = config.fileSystems;
|
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;
|
mount = config.system.sbin.mount;
|
||||||
|
|
||||||
task =
|
task =
|
||||||
''
|
''
|
||||||
PATH=${pkgs.e2fsprogs}/sbin:${pkgs.utillinuxng}/sbin:$PATH
|
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
|
newDevices=1
|
||||||
|
|
||||||
# If we mount any file system, we repeat this loop, because new
|
# If we mount any file system, we repeat this loop, because new
|
||||||
@ -29,15 +18,13 @@ let
|
|||||||
# for loopback mounts).
|
# for loopback mounts).
|
||||||
|
|
||||||
while test -n "$newDevices"; do
|
while test -n "$newDevices"; do
|
||||||
|
|
||||||
newDevices=
|
newDevices=
|
||||||
|
|
||||||
for ((n = 0; n < ''${#mountPoints[*]}; n++)); do
|
${flip concatMapStrings fileSystems
|
||||||
mountPoint=''${mountPoints[$n]}
|
(fs: ''
|
||||||
device=''${devices[$n]}
|
mountPoint='${fs.mountPoint}'
|
||||||
fsType=''${fsTypes[$n]}
|
device='${if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}"}'
|
||||||
options=''${optionss[$n]}
|
fsType='${fs.fsType}'
|
||||||
autocreate=''${autocreates[$n]}
|
|
||||||
|
|
||||||
# A device is a pseudo-device (i.e. not an actual device
|
# 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
|
# node) if it's not an absolute path (e.g. an NFS server
|
||||||
@ -59,7 +46,7 @@ let
|
|||||||
if test "''${device:0:2}" != //; 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,"${fs.options}" \
|
||||||
"$device" "$mountPoint" || true
|
"$device" "$mountPoint" || true
|
||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
@ -82,7 +69,7 @@ let
|
|||||||
if test "$prevMountPoint" = "$mountPoint"; then
|
if test "$prevMountPoint" = "$mountPoint"; 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,"${fs.options}" \
|
||||||
"$device" "$mountPoint" || true
|
"$device" "$mountPoint" || true
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -101,14 +88,17 @@ let
|
|||||||
fsck -a "$device" || true
|
fsck -a "$device" || true
|
||||||
fi
|
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
|
if ${mount}/bin/mount -t "$fsType" -o "$options" "$device" "$mountPoint"; then
|
||||||
newDevices=1
|
newDevices=1
|
||||||
fi
|
fi
|
||||||
|
'')
|
||||||
done
|
}
|
||||||
|
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user