forked from mirrors/nixpkgs
* Provide an option to add more files to the ISO image.
svn path=/nixos/branches/modular-nixos/; revision=15903
This commit is contained in:
parent
ca061eb628
commit
37edcf4fae
|
@ -6,13 +6,24 @@ targets_=($targets)
|
|||
objects=($objects)
|
||||
symlinks=($symlinks)
|
||||
|
||||
|
||||
# Remove the initial slash from a path, since genisofs likes it that way.
|
||||
stripSlash() {
|
||||
res="$1"
|
||||
if test "${res:0:1}" = /; then res=${res:1}; fi
|
||||
}
|
||||
|
||||
stripSlash "$bootImage"; bootImage="$res"
|
||||
|
||||
|
||||
if test -n "$bootable"; then
|
||||
|
||||
# The -boot-info-table option modifies the $bootImage file, so
|
||||
# find it in `contents' and make a copy of it (since the original
|
||||
# is read-only in the Nix store...).
|
||||
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
||||
if test "${targets_[$i]}" = "$bootImage"; then
|
||||
stripSlash "${targets_[$i]}"
|
||||
if test "$res" = "$bootImage"; then
|
||||
echo "copying the boot image ${sources_[$i]}"
|
||||
cp "${sources_[$i]}" boot.img
|
||||
chmod u+w boot.img
|
||||
|
@ -23,11 +34,14 @@ if test -n "$bootable"; then
|
|||
bootFlags="-b $bootImage -c .boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
|
||||
fi
|
||||
|
||||
|
||||
touch pathlist
|
||||
|
||||
|
||||
# Add the individual files.
|
||||
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
||||
echo "${targets_[$i]}=$(readlink -f ${sources_[$i]})" >> pathlist
|
||||
stripSlash "${targets_[$i]}"
|
||||
echo "$res=$(readlink -f ${sources_[$i]})" >> pathlist
|
||||
done
|
||||
|
||||
|
||||
|
@ -54,6 +68,7 @@ for ((n = 0; n < ${#objects[*]}; n++)); do
|
|||
fi
|
||||
done
|
||||
|
||||
# !!! what does this do?
|
||||
cat pathlist | sed -e 's/=\(.*\)=\(.*\)=/\\=\1=\2\\=/' | tee pathlist.safer
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,23 @@
|
|||
{config, pkgs, ...}:
|
||||
|
||||
let
|
||||
|
||||
options = {
|
||||
|
||||
isoImage.contents = pkgs.lib.mkOption {
|
||||
example =
|
||||
[ { source = pkgs.memtest86 + "/memtest.bin";
|
||||
target = "boot/memtest.bin";
|
||||
}
|
||||
];
|
||||
description = ''
|
||||
This option lists files that have to be copied to fixed
|
||||
locations in the generated ISO image.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
cdLabel = "NIXOS_INSTALLATION_CD";
|
||||
|
||||
|
@ -15,18 +32,14 @@ let
|
|||
timeout 10
|
||||
splashimage /boot/background.xpm.gz
|
||||
|
||||
title Boot from hard disk
|
||||
root (hd0)
|
||||
chainloader +1
|
||||
|
||||
title NixOS Installer / Rescue
|
||||
kernel /boot/vmlinuz init=/init ${toString config.boot.kernelParams}
|
||||
initrd /boot/initrd
|
||||
${config.boot.extraGrubEntries}
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
require = options;
|
||||
|
||||
# In stage 1 of the boot, mount the CD/DVD as the root FS by label
|
||||
# so that we don't need to know its device.
|
||||
fileSystems =
|
||||
|
@ -44,36 +57,52 @@ in
|
|||
# and move that bit of code here.
|
||||
boot.isLiveCD = true;
|
||||
|
||||
# Individual files to be included on the CD, outside of the Nix
|
||||
# store on the CD.
|
||||
isoImage.contents =
|
||||
[ { source = "${pkgs.grub}/lib/grub/${if pkgs.stdenv.system == "i686-linux" then "i386-pc" else "x86_64-unknown"}/stage2_eltorito";
|
||||
target = "/boot/grub/stage2_eltorito";
|
||||
}
|
||||
{ source = pkgs.writeText "menu.lst" grubCfg;
|
||||
target = "/boot/grub/menu.lst";
|
||||
}
|
||||
{ source = config.boot.kernelPackages.kernel + "/vmlinuz";
|
||||
target = "/boot/vmlinuz";
|
||||
}
|
||||
{ source = config.system.build.initialRamdisk + "/initrd";
|
||||
target = "/boot/initrd";
|
||||
}
|
||||
{ source = config.boot.grubSplashImage;
|
||||
target = "/boot/background.xpm.gz";
|
||||
}
|
||||
];
|
||||
|
||||
# The Grub menu.
|
||||
boot.extraGrubEntries =
|
||||
''
|
||||
title Boot from hard disk
|
||||
root (hd0)
|
||||
chainloader +1
|
||||
|
||||
title NixOS Installer / Rescue
|
||||
kernel /boot/vmlinuz init=/init ${toString config.boot.kernelParams}
|
||||
initrd /boot/initrd
|
||||
'';
|
||||
|
||||
# Create the ISO image.
|
||||
system.build.isoImage = import ../../../lib/make-iso9660-image.nix {
|
||||
inherit (pkgs) stdenv perl cdrkit pathsFromGraph;
|
||||
#isoName = "${relName}-${platform}.iso";
|
||||
|
||||
bootable = true;
|
||||
bootImage = "boot/grub/stage2_eltorito";
|
||||
bootImage = "/boot/grub/stage2_eltorito";
|
||||
|
||||
#compressImage = ...;
|
||||
|
||||
volumeID = cdLabel;
|
||||
|
||||
# Single files to be copied to fixed locations on the CD.
|
||||
contents =
|
||||
[ { source = "${pkgs.grub}/lib/grub/${if pkgs.stdenv.system == "i686-linux" then "i386-pc" else "x86_64-unknown"}/stage2_eltorito";
|
||||
target = "boot/grub/stage2_eltorito";
|
||||
}
|
||||
{ source = pkgs.writeText "menu.lst" grubCfg;
|
||||
target = "boot/grub/menu.lst";
|
||||
}
|
||||
{ source = config.boot.kernelPackages.kernel + "/vmlinuz";
|
||||
target = "boot/vmlinuz";
|
||||
}
|
||||
{ source = config.system.build.initialRamdisk + "/initrd";
|
||||
target = "boot/initrd";
|
||||
}
|
||||
{ source = config.boot.grubSplashImage;
|
||||
target = "boot/background.xpm.gz";
|
||||
}
|
||||
];
|
||||
contents = config.isoImage.contents;
|
||||
|
||||
# Closures to be copied to the Nix store on the CD.
|
||||
storeContents =
|
||||
|
|
Loading…
Reference in a new issue