diff options
Diffstat (limited to 'nixos/modules/system/boot/stage-1-init.sh')
-rw-r--r-- | nixos/modules/system/boot/stage-1-init.sh | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index 480bbfa2b07b..51828c5c090b 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -135,7 +135,7 @@ ln -s @modulesClosure@/lib/modules /lib/modules echo @extraUtils@/bin/modprobe > /proc/sys/kernel/modprobe for i in @kernelModules@; do echo "loading module $(basename $i)..." - modprobe $i || true + modprobe $i done @@ -146,7 +146,7 @@ ln -sfn @udevRules@ /etc/udev/rules.d mkdir -p /dev/.mdadm systemd-udevd --daemon udevadm trigger --action=add -udevadm settle || true +udevadm settle # Load boot-time keymap before any LVM/LUKS initialization @@ -290,10 +290,23 @@ mountFS() { if [ -z "$fsType" ]; then fsType=auto; fi fi - echo "$device /mnt-root$mountPoint $fsType $options" >> /etc/fstab + # Filter out x- options, which busybox doesn't do yet. + local optionsFiltered="$(IFS=,; for i in $options; do if [ "${i:0:2}" != "x-" ]; then echo -n $i,; fi; done)" + + echo "$device /mnt-root$mountPoint $fsType $optionsFiltered" >> /etc/fstab checkFS "$device" "$fsType" + # Optionally resize the filesystem. + case $options in + *x-nixos.autoresize*) + if [ "$fsType" = ext2 -o "$fsType" = ext3 -o "$fsType" = ext4 ]; then + echo "resizing $device..." + resize2fs "$device" + fi + ;; + esac + # Create backing directories for unionfs-fuse. if [ "$fsType" = unionfs-fuse ]; then for i in $(IFS=:; echo ${options##*,dirs=}); do @@ -303,7 +316,7 @@ mountFS() { echo "mounting $device on $mountPoint..." - mkdir -p "/mnt-root$mountPoint" || true + mkdir -p "/mnt-root$mountPoint" # For CIFS mounts, retry a few times before giving up. local n=0 @@ -375,7 +388,7 @@ while read -u 3 mountPoint; do # Wait once more for the udev queue to empty, just in case it's # doing something with $device right now. - udevadm settle || true + udevadm settle mountFS "$device" "$mountPoint" "$options" "$fsType" done @@ -388,9 +401,9 @@ exec 3>&- # Emit a udev rule for /dev/root to prevent systemd from complaining. if [ -e /mnt-root/iso ]; then - eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/mnt-root/iso || true) + eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/mnt-root/iso) else - eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot || true) + eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot) fi if [ "$ROOT_MAJOR" -a "$ROOT_MINOR" -a "$ROOT_MAJOR" != 0 ]; then mkdir -p /run/udev/rules.d @@ -399,7 +412,7 @@ fi # Stop udevd. -udevadm control --exit || true +udevadm control --exit # Kill any remaining processes, just to be sure we're not taking any # with us into stage 2. But keep storage daemons like unionfs-fuse. |