diff options
author | Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2015-07-25 23:57:55 +0300 |
---|---|---|
committer | Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2015-07-26 00:31:20 +0300 |
commit | 8665b0d8b10dc612b9b3dd5174837278026739e4 (patch) | |
tree | e0854872839b4dc643e1158ad2c81e278a59af3a /nixos/modules/system/boot/loader | |
parent | a6c95a3f7d2215965e098f404a9ad544a8fdd99c (diff) | |
download | nixlib-8665b0d8b10dc612b9b3dd5174837278026739e4.tar nixlib-8665b0d8b10dc612b9b3dd5174837278026739e4.tar.gz nixlib-8665b0d8b10dc612b9b3dd5174837278026739e4.tar.bz2 nixlib-8665b0d8b10dc612b9b3dd5174837278026739e4.tar.lz nixlib-8665b0d8b10dc612b9b3dd5174837278026739e4.tar.xz nixlib-8665b0d8b10dc612b9b3dd5174837278026739e4.tar.zst nixlib-8665b0d8b10dc612b9b3dd5174837278026739e4.zip |
extlinux-conf-builder: Fix warning when building in chroot
When using extlinux-conf-builder in a nix build using chroots, the following error message could be seen: /nix/store/XXX-extlinux-conf-builder.sh: line 121: cd: /nix/var/nix/profiles: No such file or directory To avoid this, just skip the code path parsing /nix/var/nix/profiles when $numGenerations (passed from the command line) is 0 (which is the only legal value of $numGenerations in a nix build context).
Diffstat (limited to 'nixos/modules/system/boot/loader')
-rw-r--r-- | nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh b/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh index 7da9c488f690..b9a42b2a196d 100644 --- a/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh +++ b/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh @@ -115,16 +115,18 @@ EOF addEntry $default default >> $tmpFile -# Add up to $numGenerations generations of the system profile to the menu, -# in reverse (most recent to least recent) order. -for generation in $( - (cd /nix/var/nix/profiles && ls -d system-*-link) \ - | sed 's/system-\([0-9]\+\)-link/\1/' \ - | sort -n -r \ - | head -n $numGenerations); do - link=/nix/var/nix/profiles/system-$generation-link - addEntry $link $generation -done >> $tmpFile +if [ "$numGenerations" -gt 0 ]; then + # Add up to $numGenerations generations of the system profile to the menu, + # in reverse (most recent to least recent) order. + for generation in $( + (cd /nix/var/nix/profiles && ls -d system-*-link) \ + | sed 's/system-\([0-9]\+\)-link/\1/' \ + | sort -n -r \ + | head -n $numGenerations); do + link=/nix/var/nix/profiles/system-$generation-link + addEntry $link $generation + done >> $tmpFile +fi mv -f $tmpFile $target/extlinux/extlinux.conf |